Skip to content

Commit f1fbba2

Browse files
committedDec 22, 2021
Merge
2 parents 9a478b3 + dfb15c3 commit f1fbba2

21 files changed

+205
-90
lines changed
 

‎make/modules/jdk.jstatd/Launcher.gmk

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -27,4 +27,5 @@ include LauncherCommon.gmk
2727

2828
$(eval $(call SetupBuildLauncher, jstatd, \
2929
MAIN_CLASS := sun.tools.jstatd.Jstatd, \
30+
JAVA_ARGS := -Djava.security.manager=allow, \
3031
))

‎src/hotspot/cpu/x86/assembler_x86.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -2788,6 +2788,15 @@ void Assembler::kshiftlbl(KRegister dst, KRegister src, int imm8) {
27882788
emit_int8(imm8);
27892789
}
27902790

2791+
void Assembler::kshiftlql(KRegister dst, KRegister src, int imm8) {
2792+
assert(VM_Version::supports_avx512bw(), "");
2793+
InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
2794+
int encode = vex_prefix_and_encode(dst->encoding(), 0 , src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
2795+
emit_int16(0x33, (0xC0 | encode));
2796+
emit_int8(imm8);
2797+
}
2798+
2799+
27912800
void Assembler::kshiftrbl(KRegister dst, KRegister src, int imm8) {
27922801
assert(VM_Version::supports_avx512dq(), "");
27932802
InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
@@ -2819,6 +2828,13 @@ void Assembler::kshiftrql(KRegister dst, KRegister src, int imm8) {
28192828
emit_int8(imm8);
28202829
}
28212830

2831+
void Assembler::kunpckdql(KRegister dst, KRegister src1, KRegister src2) {
2832+
assert(VM_Version::supports_avx512bw(), "");
2833+
InstructionAttr attributes(AVX_256bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
2834+
int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
2835+
emit_int16(0x4B, (0xC0 | encode));
2836+
}
2837+
28222838
void Assembler::movb(Address dst, int imm8) {
28232839
InstructionMark im(this);
28242840
prefix(dst);

‎src/hotspot/cpu/x86/assembler_x86.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -1510,12 +1510,15 @@ class Assembler : public AbstractAssembler {
15101510

15111511
void kxnorbl(KRegister dst, KRegister src1, KRegister src2);
15121512
void kshiftlbl(KRegister dst, KRegister src, int imm8);
1513+
void kshiftlql(KRegister dst, KRegister src, int imm8);
15131514
void kshiftrbl(KRegister dst, KRegister src, int imm8);
15141515
void kshiftrwl(KRegister dst, KRegister src, int imm8);
15151516
void kshiftrdl(KRegister dst, KRegister src, int imm8);
15161517
void kshiftrql(KRegister dst, KRegister src, int imm8);
15171518
void ktestq(KRegister src1, KRegister src2);
15181519
void ktestd(KRegister src1, KRegister src2);
1520+
void kunpckdql(KRegister dst, KRegister src1, KRegister src2);
1521+
15191522

15201523
void ktestql(KRegister dst, KRegister src);
15211524
void ktestdl(KRegister dst, KRegister src);

‎src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -4312,3 +4312,30 @@ void C2_MacroAssembler::vector_mask_operation(int opc, Register dst, XMMRegister
43124312
vector_mask_operation_helper(opc, dst, tmp, masklen);
43134313
}
43144314
#endif
4315+
4316+
void C2_MacroAssembler::vector_maskall_operation(KRegister dst, Register src, int mask_len) {
4317+
if (VM_Version::supports_avx512bw()) {
4318+
if (mask_len > 32) {
4319+
kmovql(dst, src);
4320+
} else {
4321+
kmovdl(dst, src);
4322+
if (mask_len != 32) {
4323+
kshiftrdl(dst, dst, 32 - mask_len);
4324+
}
4325+
}
4326+
} else {
4327+
assert(mask_len <= 16, "");
4328+
kmovwl(dst, src);
4329+
if (mask_len != 16) {
4330+
kshiftrwl(dst, dst, 16 - mask_len);
4331+
}
4332+
}
4333+
}
4334+
4335+
#ifndef _LP64
4336+
void C2_MacroAssembler::vector_maskall_operation32(KRegister dst, Register src, KRegister tmp, int mask_len) {
4337+
assert(VM_Version::supports_avx512bw(), "");
4338+
kmovdl(tmp, src);
4339+
kunpckdql(dst, tmp, tmp);
4340+
}
4341+
#endif

‎src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@
234234
Register rtmp2, XMMRegister xtmp, int mask_len, int vec_enc);
235235
#endif
236236

237+
void vector_maskall_operation(KRegister dst, Register src, int mask_len);
238+
239+
#ifndef _LP64
240+
void vector_maskall_operation32(KRegister dst, Register src, KRegister ktmp, int mask_len);
241+
#endif
242+
237243
void string_indexof_char(Register str1, Register cnt1, Register ch, Register result,
238244
XMMRegister vec1, XMMRegister vec2, XMMRegister vec3, Register tmp);
239245

‎src/hotspot/cpu/x86/stubGenerator_x86_64.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -4138,6 +4138,7 @@ class StubGenerator: public StubCodeGenerator {
41384138
const Register len = c_rarg3; // src len (must be multiple of blocksize 16)
41394139
__ enter(); // required for proper stackwalking of RuntimeStub frame
41404140
__ aesecb_encrypt(from, to, key, len);
4141+
__ vzeroupper();
41414142
__ leave(); // required for proper stackwalking of RuntimeStub frame
41424143
__ ret(0);
41434144
return start;
@@ -4153,6 +4154,7 @@ class StubGenerator: public StubCodeGenerator {
41534154
const Register len = c_rarg3; // src len (must be multiple of blocksize 16)
41544155
__ enter(); // required for proper stackwalking of RuntimeStub frame
41554156
__ aesecb_decrypt(from, to, key, len);
4157+
__ vzeroupper();
41564158
__ leave(); // required for proper stackwalking of RuntimeStub frame
41574159
__ ret(0);
41584160
return start;
@@ -4452,6 +4454,7 @@ class StubGenerator: public StubCodeGenerator {
44524454
__ movptr(avx512_subkeyHtbl, rsp);
44534455

44544456
__ aesgcm_encrypt(in, len, ct, out, key, state, subkeyHtbl, avx512_subkeyHtbl, counter);
4457+
__ vzeroupper();
44554458

44564459
__ movq(rsp, rbp);
44574460
__ pop(rbp);
@@ -4571,6 +4574,7 @@ class StubGenerator: public StubCodeGenerator {
45714574
#endif
45724575
__ push(rbx);
45734576
__ aesctr_encrypt(from, to, key, counter, len_reg, used, used_addr, saved_encCounter_start);
4577+
__ vzeroupper();
45744578
// Restore state before leaving routine
45754579
__ pop(rbx);
45764580
#ifdef _WIN64
@@ -5191,6 +5195,7 @@ address generate_cipherBlockChaining_decryptVectorAESCrypt() {
51915195
__ evpxorq(RK14, RK14, RK14, Assembler::AVX_512bit);
51925196

51935197
__ BIND(Lcbc_exit);
5198+
__ vzeroupper();
51945199
__ pop(rbx);
51955200
#ifdef _WIN64
51965201
__ movl(rax, len_mem);
@@ -7066,6 +7071,7 @@ address generate_avx_ghash_processBlocks() {
70667071
__ shrdl(tmp4, tmp3);
70677072
__ movl(Address(newArr, nIdx, Address::times_4), tmp4);
70687073
__ BIND(Exit);
7074+
__ vzeroupper();
70697075
// Restore callee save registers.
70707076
__ pop(tmp5);
70717077
#ifdef _WINDOWS
@@ -7187,6 +7193,7 @@ address generate_avx_ghash_processBlocks() {
71877193
__ movl(Address(newArr, idx, Address::times_4), tmp3);
71887194

71897195
__ BIND(Exit);
7196+
__ vzeroupper();
71907197
// Restore callee save registers.
71917198
__ pop(tmp5);
71927199
#ifdef _WINDOWS

‎src/hotspot/cpu/x86/x86.ad

+7-53
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType
18271827
}
18281828
break;
18291829
case Op_MaskAll:
1830-
if (!is_LP64 || !VM_Version::supports_evex()) {
1830+
if (!VM_Version::supports_evex()) {
18311831
return false;
18321832
}
18331833
if ((vlen > 16 || is_subword_type(bt)) && !VM_Version::supports_avx512bw()) {
@@ -9460,64 +9460,18 @@ instruct evcmp_masked(kReg dst, vec src1, vec src2, immI8 cond, kReg mask, rRegP
94609460
ins_pipe( pipe_slow );
94619461
%}
94629462

9463-
#ifdef _LP64
9464-
instruct mask_all_evexI_imm(kReg dst, immI cnt, rRegL tmp) %{
9465-
match(Set dst (MaskAll cnt));
9466-
effect(TEMP_DEF dst, TEMP tmp);
9467-
format %{ "mask_all_evexI $dst, $cnt \t! using $tmp as TEMP" %}
9468-
ins_encode %{
9469-
int vec_len = Matcher::vector_length(this);
9470-
if (VM_Version::supports_avx512bw()) {
9471-
__ movq($tmp$$Register, $cnt$$constant);
9472-
__ kmovql($dst$$KRegister, $tmp$$Register);
9473-
__ kshiftrql($dst$$KRegister, $dst$$KRegister, 64 - vec_len);
9474-
} else {
9475-
assert(vec_len <= 16, "");
9476-
__ movq($tmp$$Register, $cnt$$constant);
9477-
__ kmovwl($dst$$KRegister, $tmp$$Register);
9478-
__ kshiftrwl($dst$$KRegister, $dst$$KRegister, 16 - vec_len);
9479-
}
9480-
%}
9481-
ins_pipe( pipe_slow );
9482-
%}
9483-
9484-
instruct mask_all_evexI(kReg dst, rRegI src, rRegL tmp) %{
9463+
instruct mask_all_evexI_LE32(kReg dst, rRegI src) %{
9464+
predicate(Matcher::vector_length(n) <= 32);
94859465
match(Set dst (MaskAll src));
9486-
effect(TEMP_DEF dst, TEMP tmp);
9487-
format %{ "mask_all_evexI $dst, $src \t! using $tmp as TEMP" %}
9466+
format %{ "mask_all_evexI_LE32 $dst, $src \t" %}
94889467
ins_encode %{
9489-
int vec_len = Matcher::vector_length(this);
9490-
if (VM_Version::supports_avx512bw()) {
9491-
__ movslq($tmp$$Register, $src$$Register);
9492-
__ kmovql($dst$$KRegister, $tmp$$Register);
9493-
__ kshiftrql($dst$$KRegister, $dst$$KRegister, 64 - vec_len);
9494-
} else {
9495-
assert(vec_len <= 16, "");
9496-
__ kmovwl($dst$$KRegister, $src$$Register);
9497-
__ kshiftrwl($dst$$KRegister, $dst$$KRegister, 16 - vec_len);
9498-
}
9499-
%}
9500-
ins_pipe( pipe_slow );
9501-
%}
9502-
9503-
instruct mask_all_evexL(kReg dst, rRegL src) %{
9504-
match(Set dst (MaskAll src));
9505-
effect(TEMP_DEF dst);
9506-
format %{ "mask_all_evexL $dst, $src \t! mask all operation" %}
9507-
ins_encode %{
9508-
int vec_len = Matcher::vector_length(this);
9509-
if (VM_Version::supports_avx512bw()) {
9510-
__ kmovql($dst$$KRegister, $src$$Register);
9511-
__ kshiftrql($dst$$KRegister, $dst$$KRegister, 64 - vec_len);
9512-
} else {
9513-
assert(vec_len <= 16, "");
9514-
__ kmovwl($dst$$KRegister, $src$$Register);
9515-
__ kshiftrwl($dst$$KRegister, $dst$$KRegister, 16 - vec_len);
9516-
}
9468+
int mask_len = Matcher::vector_length(this);
9469+
__ vector_maskall_operation($dst$$KRegister, $src$$Register, mask_len);
95179470
%}
95189471
ins_pipe( pipe_slow );
95199472
%}
95209473

9474+
#ifdef _LP64
95219475
instruct mask_not_immLT8(kReg dst, kReg src, rRegI rtmp, kReg ktmp, immI_M1 cnt) %{
95229476
predicate(Matcher::vector_length(n) < 8 && VM_Version::supports_avx512dq());
95239477
match(Set dst (XorVMask src (MaskAll cnt)));

‎src/hotspot/cpu/x86/x86_32.ad

+33
Original file line numberDiff line numberDiff line change
@@ -13847,7 +13847,40 @@ instruct cmpFastUnlock(eFlagsReg cr, eRegP object, eAXRegP box, eRegP tmp ) %{
1384713847
ins_pipe(pipe_slow);
1384813848
%}
1384913849

13850+
instruct mask_all_evexL_LT32(kReg dst, eRegL src) %{
13851+
predicate(Matcher::vector_length(n) <= 32);
13852+
match(Set dst (MaskAll src));
13853+
format %{ "mask_all_evexL_LE32 $dst, $src \t" %}
13854+
ins_encode %{
13855+
int mask_len = Matcher::vector_length(this);
13856+
__ vector_maskall_operation($dst$$KRegister, $src$$Register, mask_len);
13857+
%}
13858+
ins_pipe( pipe_slow );
13859+
%}
1385013860

13861+
instruct mask_all_evexL_GT32(kReg dst, eRegL src, kReg ktmp) %{
13862+
predicate(Matcher::vector_length(n) > 32);
13863+
match(Set dst (MaskAll src));
13864+
effect(TEMP ktmp);
13865+
format %{ "mask_all_evexL_GT32 $dst, $src \t! using $ktmp as TEMP " %}
13866+
ins_encode %{
13867+
int mask_len = Matcher::vector_length(this);
13868+
__ vector_maskall_operation32($dst$$KRegister, $src$$Register, $ktmp$$KRegister, mask_len);
13869+
%}
13870+
ins_pipe( pipe_slow );
13871+
%}
13872+
13873+
instruct mask_all_evexI_GT32(kReg dst, rRegI src, kReg ktmp) %{
13874+
predicate(Matcher::vector_length(n) > 32);
13875+
match(Set dst (MaskAll src));
13876+
effect(TEMP ktmp);
13877+
format %{ "mask_all_evexI_GT32 $dst, $src \t! using $ktmp as TEMP" %}
13878+
ins_encode %{
13879+
int mask_len = Matcher::vector_length(this);
13880+
__ vector_maskall_operation32($dst$$KRegister, $src$$Register, $ktmp$$KRegister, mask_len);
13881+
%}
13882+
ins_pipe( pipe_slow );
13883+
%}
1385113884

1385213885
// ============================================================================
1385313886
// Safepoint Instruction

‎src/hotspot/cpu/x86/x86_64.ad

+23
Original file line numberDiff line numberDiff line change
@@ -13011,6 +13011,29 @@ instruct safePoint_poll_tls(rFlagsReg cr, rRegP poll)
1301113011
ins_pipe(ialu_reg_mem);
1301213012
%}
1301313013

13014+
instruct mask_all_evexL(kReg dst, rRegL src) %{
13015+
match(Set dst (MaskAll src));
13016+
format %{ "mask_all_evexL $dst, $src \t! mask all operation" %}
13017+
ins_encode %{
13018+
int mask_len = Matcher::vector_length(this);
13019+
__ vector_maskall_operation($dst$$KRegister, $src$$Register, mask_len);
13020+
%}
13021+
ins_pipe( pipe_slow );
13022+
%}
13023+
13024+
instruct mask_all_evexI_GT32(kReg dst, rRegI src, rRegL tmp) %{
13025+
predicate(Matcher::vector_length(n) > 32);
13026+
match(Set dst (MaskAll src));
13027+
effect(TEMP tmp);
13028+
format %{ "mask_all_evexI_GT32 $dst, $src \t! using $tmp as TEMP" %}
13029+
ins_encode %{
13030+
int mask_len = Matcher::vector_length(this);
13031+
__ movslq($tmp$$Register, $src$$Register);
13032+
__ vector_maskall_operation($dst$$KRegister, $tmp$$Register, mask_len);
13033+
%}
13034+
ins_pipe( pipe_slow );
13035+
%}
13036+
1301413037
// ============================================================================
1301513038
// Procedure Call/Return Instructions
1301613039
// Call Java Static Instruction

‎src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp

+3-9
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static void prepare_for_resolution() {
202202

203203
static bool stack_trace_precondition(const ObjectSample* sample) {
204204
assert(sample != NULL, "invariant");
205-
return sample->has_stack_trace_id() && !sample->is_dead() && !sample->stacktrace().valid();
205+
return sample->has_stack_trace_id() && !sample->is_dead();
206206
}
207207

208208
class StackTraceBlobInstaller {
@@ -249,7 +249,7 @@ void StackTraceBlobInstaller::install(ObjectSample* sample) {
249249
writer.write_type(TYPE_STACKTRACE);
250250
writer.write_count(1);
251251
ObjectSampleCheckpoint::write_stacktrace(stack_trace, writer);
252-
blob = writer.move();
252+
blob = writer.copy();
253253
_cache.put(sample, blob);
254254
sample->set_stacktrace(blob);
255255
}
@@ -278,7 +278,7 @@ void ObjectSampleCheckpoint::on_rotation(const ObjectSampler* sampler) {
278278
}
279279

280280
static bool is_klass_unloaded(traceid klass_id) {
281-
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
281+
assert(ClassLoaderDataGraph_lock->owned_by_self(), "invariant");
282282
return JfrKlassUnloading::is_unloaded(klass_id);
283283
}
284284

@@ -381,12 +381,6 @@ void ObjectSampleCheckpoint::write(const ObjectSampler* sampler, EdgeStore* edge
381381
assert(sampler != NULL, "invariant");
382382
assert(edge_store != NULL, "invariant");
383383
assert(thread != NULL, "invariant");
384-
{
385-
// First install stacktrace blobs for the most recently added candidates.
386-
MutexLocker lock(SafepointSynchronize::is_at_safepoint() ? nullptr : ClassLoaderDataGraph_lock);
387-
// the lock is needed to ensure the unload lists do not grow in the middle of inspection.
388-
install_stack_traces(sampler);
389-
}
390384
write_sample_blobs(sampler, emit_all, thread);
391385
// write reference chains
392386
if (!edge_store->is_empty()) {

‎src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingFile.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import jdk.jfr.internal.consumer.ChunkHeader;
4242
import jdk.jfr.internal.consumer.ChunkParser;
4343
import jdk.jfr.internal.consumer.FileAccess;
44+
import jdk.jfr.internal.consumer.ParserState;
4445
import jdk.jfr.internal.consumer.RecordingInput;
4546

4647
/**
@@ -61,6 +62,7 @@
6162
*/
6263
public final class RecordingFile implements Closeable {
6364

65+
private final ParserState parserState = new ParserState();
6466
private boolean isLastEventInChunk;
6567
private final File file;
6668
private RecordingInput input;
@@ -247,7 +249,7 @@ boolean isLastEventInChunk() {
247249
private void findNext() throws IOException {
248250
while (nextEvent == null) {
249251
if (chunkParser == null) {
250-
chunkParser = new ChunkParser(input);
252+
chunkParser = new ChunkParser(input, parserState);
251253
} else if (!chunkParser.isLastChunk()) {
252254
chunkParser = chunkParser.nextChunkParser();
253255
} else {

‎src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/AbstractEventStream.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public abstract class AbstractEventStream implements EventStream {
6565
private volatile Thread thread;
6666
private Dispatcher dispatcher;
6767

68-
private volatile boolean closed;
68+
protected final ParserState parserState = new ParserState();
6969

7070
private boolean daemon = false;
7171

@@ -215,12 +215,12 @@ public final void awaitTermination(Duration timeout) throws InterruptedException
215215

216216
protected abstract void process() throws IOException;
217217

218-
protected final void setClosed(boolean closed) {
219-
this.closed = closed;
218+
protected final void closeParser() {
219+
parserState.close();
220220
}
221221

222222
protected final boolean isClosed() {
223-
return closed;
223+
return parserState.isClosed();
224224
}
225225

226226
public final void startAsync(long startNanos) {

0 commit comments

Comments
 (0)
Please sign in to comment.