Skip to content

Commit b5a073b

Browse files
authored
Merge branch 'openjdk:master' into backport-sendaoYan-fe29cad5-master
2 parents e6ca83a + dbfdc50 commit b5a073b

File tree

66 files changed

+2042
-2748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2042
-2748
lines changed

make/hotspot/lib/JvmOverrideFiles.gmk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 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
@@ -36,6 +36,7 @@ ifeq ($(TOOLCHAIN_TYPE), gcc)
3636
BUILD_LIBJVM_assembler_x86.cpp_CXXFLAGS := -Wno-maybe-uninitialized
3737
BUILD_LIBJVM_cardTableBarrierSetAssembler_x86.cpp_CXXFLAGS := -Wno-maybe-uninitialized
3838
BUILD_LIBJVM_interp_masm_x86.cpp_CXXFLAGS := -Wno-uninitialized
39+
BUILD_LIBJVM_ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp_CXXFLAGS := -Wno-nonnull
3940
ifeq ($(DEBUG_LEVEL), release)
4041
# Need extra inlining to collapse shared marking code into the hot marking loop
4142
BUILD_LIBJVM_shenandoahMark.cpp_CXXFLAGS := --param inline-unit-growth=1000

src/hotspot/cpu/ppc/interp_masm_ppc.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
126126

127127
void get_cache_index_at_bcp(Register Rdst, int bcp_offset, size_t index_size);
128128

129-
void get_cache_and_index_at_bcp(Register cache, int bcp_offset, size_t index_size = sizeof(u2));
129+
void get_cache_and_index_at_bcp(Register cache, int bcp_offset, size_t index_size = sizeof(u2),
130+
bool for_fast_bytecode = false);
130131

131132
void get_u4(Register Rdst, Register Rsrc, int offset, signedOrNot is_signed);
132133

src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,18 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register Rdst, int bcp_of
450450
}
451451

452452
void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, int bcp_offset,
453-
size_t index_size) {
453+
size_t index_size, bool for_fast_bytecode) {
454454
get_cache_index_at_bcp(cache, bcp_offset, index_size);
455455
sldi(cache, cache, exact_log2(in_words(ConstantPoolCacheEntry::size()) * BytesPerWord));
456456
add(cache, R27_constPoolCache, cache);
457+
458+
if (for_fast_bytecode) {
459+
// Prevent speculative loading from ConstantPoolCacheEntry as it can miss the info written by another thread.
460+
// TemplateTable::patch_bytecode uses release-store.
461+
// We reached here via control dependency (Bytecode dispatch has used the rewritten Bytecode).
462+
// So, we can use control-isync based ordering.
463+
isync();
464+
}
457465
}
458466

459467
// Load 4-byte signed or unsigned integer in Java format (that is, big-endian format)

src/hotspot/cpu/ppc/templateTable_ppc_64.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ void TemplateTable::patch_bytecode(Bytecodes::Code new_bc, Register Rnew_bc, Reg
146146
__ bind(L_fast_patch);
147147
}
148148

149-
// Patch bytecode.
149+
// Patch bytecode with release store to coordinate with ConstantPoolCacheEntry
150+
// loads in fast bytecode codelets.
151+
__ release();
150152
__ stb(Rnew_bc, 0, R14_bcp);
151153

152154
__ bind(L_patch_done);
@@ -310,6 +312,7 @@ void TemplateTable::fast_aldc(bool wide) {
310312
// We are resolved if the resolved reference cache entry contains a
311313
// non-null object (CallSite, etc.)
312314
__ get_cache_index_at_bcp(R31, 1, index_size); // Load index.
315+
// Only rewritten during link time. So, no need for memory barriers for accessing resolved info.
313316
__ load_resolved_reference_at_index(R17_tos, R31, R11_scratch1, R12_scratch2, &is_null);
314317

315318
// Convert null sentinel to NULL
@@ -2309,7 +2312,7 @@ void TemplateTable::load_invoke_cp_cache_entry(int byte_no,
23092312
if (is_invokevfinal) {
23102313
assert(Ritable_index == noreg, "register not used");
23112314
// Already resolved.
2312-
__ get_cache_and_index_at_bcp(Rcache, 1);
2315+
__ get_cache_and_index_at_bcp(Rcache, 1, sizeof(u2), /* for_fast_bytecode */ true);
23132316
} else {
23142317
resolve_cache_and_index(byte_no, Rcache, /* temp */ Rmethod, is_invokedynamic ? sizeof(u4) : sizeof(u2));
23152318
}
@@ -3016,7 +3019,7 @@ void TemplateTable::fast_storefield(TosState state) {
30163019
const ConditionRegister CR_is_vol = CCR2; // Non-volatile condition register (survives runtime call in do_oop_store).
30173020

30183021
// Constant pool already resolved => Load flags and offset of field.
3019-
__ get_cache_and_index_at_bcp(Rcache, 1);
3022+
__ get_cache_and_index_at_bcp(Rcache, 1, sizeof(u2), /* for_fast_bytecode */ true);
30203023
jvmti_post_field_mod(Rcache, Rscratch, false /* not static */);
30213024
load_field_cp_cache_entry(noreg, Rcache, noreg, Roffset, Rflags, false); // Uses R11, R12
30223025

@@ -3097,7 +3100,7 @@ void TemplateTable::fast_accessfield(TosState state) {
30973100
// R12_scratch2 used by load_field_cp_cache_entry
30983101

30993102
// Constant pool already resolved. Get the field offset.
3100-
__ get_cache_and_index_at_bcp(Rcache, 1);
3103+
__ get_cache_and_index_at_bcp(Rcache, 1, sizeof(u2), /* for_fast_bytecode */ true);
31013104
load_field_cp_cache_entry(noreg, Rcache, noreg, Roffset, Rflags, false); // Uses R11, R12
31023105

31033106
// JVMTI support
@@ -3236,7 +3239,7 @@ void TemplateTable::fast_xaccess(TosState state) {
32363239
__ ld(Rclass_or_obj, 0, R18_locals);
32373240

32383241
// Constant pool already resolved. Get the field offset.
3239-
__ get_cache_and_index_at_bcp(Rcache, 2);
3242+
__ get_cache_and_index_at_bcp(Rcache, 2, sizeof(u2), /* for_fast_bytecode */ true);
32403243
load_field_cp_cache_entry(noreg, Rcache, noreg, Roffset, Rflags, false); // Uses R11, R12
32413244

32423245
// JVMTI support not needed, since we switch back to single bytecode as soon as debugger attaches.

src/hotspot/cpu/x86/assembler_x86.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7546,6 +7546,10 @@ void Assembler::evprolq(XMMRegister dst, XMMRegister src, int shift, int vector_
75467546
emit_int24(0x72, (0xC0 | encode), shift & 0xFF);
75477547
}
75487548

7549+
// Register is a class, but it would be assigned numerical value.
7550+
// "0" is assigned for xmm0. Thus we need to ignore -Wnonnull.
7551+
PRAGMA_DIAG_PUSH
7552+
PRAGMA_NONNULL_IGNORED
75497553
void Assembler::evprord(XMMRegister dst, XMMRegister src, int shift, int vector_len) {
75507554
assert(VM_Version::supports_evex(), "requires EVEX support");
75517555
assert(vector_len == Assembler::AVX_512bit || VM_Version::supports_avx512vl(), "requires VL support");
@@ -7563,6 +7567,7 @@ void Assembler::evprorq(XMMRegister dst, XMMRegister src, int shift, int vector_
75637567
int encode = vex_prefix_and_encode(xmm0->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
75647568
emit_int24(0x72, (0xC0 | encode), shift & 0xFF);
75657569
}
7570+
PRAGMA_DIAG_POP
75667571

75677572
void Assembler::evprolvd(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) {
75687573
assert(VM_Version::supports_evex(), "requires EVEX support");

src/hotspot/cpu/x86/c1_Runtime1_x86.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,11 @@ enum reg_save_layout {
318318
// expensive. The deopt blob is the only thing which needs to
319319
// describe FPU registers. In all other cases it should be sufficient
320320
// to simply save their current value.
321-
321+
//
322+
// Register is a class, but it would be assigned numerical value.
323+
// "0" is assigned for rax. Thus we need to ignore -Wnonnull.
324+
PRAGMA_DIAG_PUSH
325+
PRAGMA_NONNULL_IGNORED
322326
static OopMap* generate_oop_map(StubAssembler* sasm, int num_rt_args,
323327
bool save_fpu_registers = true) {
324328

@@ -418,6 +422,7 @@ static OopMap* generate_oop_map(StubAssembler* sasm, int num_rt_args,
418422

419423
return map;
420424
}
425+
PRAGMA_DIAG_POP
421426

422427
#define __ this->
423428

src/hotspot/cpu/x86/frame_x86.inline.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const {
230230

231231
// Compiled frames
232232

233+
// Register is a class, but it would be assigned numerical value.
234+
// "0" is assigned for rax. Thus we need to ignore -Wnonnull.
235+
PRAGMA_DIAG_PUSH
236+
PRAGMA_NONNULL_IGNORED
233237
inline oop frame::saved_oop_result(RegisterMap* map) const {
234238
oop* result_adr = (oop *)map->location(rax->as_VMReg());
235239
guarantee(result_adr != NULL, "bad register save location");
@@ -243,5 +247,6 @@ inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {
243247

244248
*result_adr = obj;
245249
}
250+
PRAGMA_DIAG_POP
246251

247252
#endif // CPU_X86_FRAME_X86_INLINE_HPP

src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,10 @@ class ZSaveLiveRegisters {
465465
_spill_offset += 8;
466466
}
467467

468+
// Register is a class, but it would be assigned numerical value.
469+
// "0" is assigned for rax. Thus we need to ignore -Wnonnull.
470+
PRAGMA_DIAG_PUSH
471+
PRAGMA_NONNULL_IGNORED
468472
void initialize(ZLoadBarrierStubC2* stub) {
469473
// Create mask of caller saved registers that need to
470474
// be saved/restored if live
@@ -540,6 +544,7 @@ class ZSaveLiveRegisters {
540544
// Stack pointer must be 16 bytes aligned for the call
541545
_spill_offset = _spill_size = align_up(xmm_spill_size + gp_spill_size + opmask_spill_size + arg_spill_size, 16);
542546
}
547+
PRAGMA_DIAG_POP
543548

544549
public:
545550
ZSaveLiveRegisters(MacroAssembler* masm, ZLoadBarrierStubC2* stub) :

src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ class RegisterSaver {
168168
static void restore_result_registers(MacroAssembler* masm);
169169
};
170170

171+
// Register is a class, but it would be assigned numerical value.
172+
// "0" is assigned for rax. Thus we need to ignore -Wnonnull.
173+
PRAGMA_DIAG_PUSH
174+
PRAGMA_NONNULL_IGNORED
171175
OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_frame_words, int* total_frame_words, bool save_wide_vectors) {
172176
int off = 0;
173177
int num_xmm_regs = XMMRegisterImpl::number_of_registers;
@@ -361,6 +365,7 @@ OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_
361365

362366
return map;
363367
}
368+
PRAGMA_DIAG_POP
364369

365370
void RegisterSaver::restore_live_registers(MacroAssembler* masm, bool restore_wide_vectors) {
366371
int num_xmm_regs = XMMRegisterImpl::number_of_registers;

src/hotspot/cpu/x86/universalUpcallHandler_x86_64.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,10 @@ static void shuffle_arguments(MacroAssembler* _masm, const GrowableArray<ArgMove
587587
}
588588
}
589589

590+
// Register is a class, but it would be assigned numerical value.
591+
// "0" is assigned for rax and for xmm0. Thus we need to ignore -Wnonnull.
592+
PRAGMA_DIAG_PUSH
593+
PRAGMA_NONNULL_IGNORED
590594
address ProgrammableUpcallHandler::generate_optimized_upcall_stub(jobject receiver, Method* entry, jobject jabi, jobject jconv) {
591595
ResourceMark rm;
592596
const ABIDescriptor abi = ForeignGlobals::parse_abi_descriptor(jabi);
@@ -779,6 +783,7 @@ address ProgrammableUpcallHandler::generate_optimized_upcall_stub(jobject receiv
779783

780784
return blob->code_begin();
781785
}
786+
PRAGMA_DIAG_POP
782787

783788
bool ProgrammableUpcallHandler::supports_optimized_upcalls() {
784789
return true;

0 commit comments

Comments
 (0)