Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into 8314225_is_lock_o…
Browse files Browse the repository at this point in the history
…wned_no_monitor_chunks_check
  • Loading branch information
kevinjwalls committed May 3, 2024
2 parents 5139f33 + b20fa7b commit b538080
Show file tree
Hide file tree
Showing 266 changed files with 4,968 additions and 3,140 deletions.
5 changes: 3 additions & 2 deletions doc/testing.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ <h2 id="test-selection">Test selection</h2>
<p>The test specifications given in <code>TEST</code> is parsed into
fully qualified test descriptors, which clearly and unambigously show
which tests will be run. As an example, <code>:tier1</code> will expand
to
<code>jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 jtreg:$(TOPDIR)/test/nashorn:tier1 jtreg:$(TOPDIR)/test/jaxp:tier1</code>.
to include all subcomponent test directories that define `tier1`,
for example:
<code>jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1 jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 ...</code>.
You can always submit a list of fully qualified test descriptors in the
<code>TEST</code> variable if you want to shortcut the parser.</p>
<h3 id="common-test-groups">Common Test Groups</h3>
Expand Down
10 changes: 5 additions & 5 deletions doc/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ test runs, the `test TEST="x"` solution needs to be used.

The test specifications given in `TEST` is parsed into fully qualified test
descriptors, which clearly and unambigously show which tests will be run. As an
example, `:tier1` will expand to `jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1
jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1
jtreg:$(TOPDIR)/test/nashorn:tier1 jtreg:$(TOPDIR)/test/jaxp:tier1`. You can
always submit a list of fully qualified test descriptors in the `TEST` variable
if you want to shortcut the parser.
example, `:tier1` will expand to include all subcomponent test directories
that define `tier1`, for example: `jtreg:$(TOPDIR)/test/hotspot/jtreg:tier1
jtreg:$(TOPDIR)/test/jdk:tier1 jtreg:$(TOPDIR)/test/langtools:tier1 ...`. You
can always submit a list of fully qualified test descriptors in the `TEST`
variable if you want to shortcut the parser.

### Common Test Groups

Expand Down
2 changes: 1 addition & 1 deletion make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
elif test "x$OPENJDK_TARGET_OS" = xaix; then
CFLAGS_OS_DEF_JVM="-DAIX -Dalloca'(size)'=__builtin_alloca'(size)' -D_LARGE_FILES"
CFLAGS_OS_DEF_JVM="-DAIX -D_LARGE_FILES"
CFLAGS_OS_DEF_JDK="-D_LARGE_FILES"
elif test "x$OPENJDK_TARGET_OS" = xbsd; then
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -970,7 +970,7 @@ private void addAttributes(ModuleDescription md,
}
if (header.moduleMainClass != null) {
int attrIdx = addString(cp, Attribute.ModuleMainClass);
int targetIdx = addString(cp, header.moduleMainClass);
int targetIdx = addClassName(cp, header.moduleMainClass);
attributes.put(Attribute.ModuleMainClass,
new ModuleMainClass_attribute(attrIdx, targetIdx));
}
Expand Down
28 changes: 26 additions & 2 deletions src/hotspot/cpu/aarch64/aarch64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,11 @@ reg_class no_special_ptr_reg %{
return _NO_SPECIAL_PTR_REG_mask;
%}

// Class for all non_special pointer registers (excluding rfp)
reg_class no_special_no_rfp_ptr_reg %{
return _NO_SPECIAL_NO_RFP_PTR_REG_mask;
%}

// Class for all float registers
reg_class float_reg(
V0,
Expand Down Expand Up @@ -1125,6 +1130,7 @@ extern RegMask _PTR_REG_mask;
extern RegMask _NO_SPECIAL_REG32_mask;
extern RegMask _NO_SPECIAL_REG_mask;
extern RegMask _NO_SPECIAL_PTR_REG_mask;
extern RegMask _NO_SPECIAL_NO_RFP_PTR_REG_mask;

class CallStubImpl {

Expand Down Expand Up @@ -1213,6 +1219,7 @@ source %{
RegMask _NO_SPECIAL_REG32_mask;
RegMask _NO_SPECIAL_REG_mask;
RegMask _NO_SPECIAL_PTR_REG_mask;
RegMask _NO_SPECIAL_NO_RFP_PTR_REG_mask;

void reg_mask_init() {
// We derive below RegMask(s) from the ones which are auto-generated from
Expand Down Expand Up @@ -1249,6 +1256,9 @@ source %{
_NO_SPECIAL_REG_mask.Remove(OptoReg::as_OptoReg(r29->as_VMReg()));
_NO_SPECIAL_PTR_REG_mask.Remove(OptoReg::as_OptoReg(r29->as_VMReg()));
}

_NO_SPECIAL_NO_RFP_PTR_REG_mask = _NO_SPECIAL_PTR_REG_mask;
_NO_SPECIAL_NO_RFP_PTR_REG_mask.Remove(OptoReg::as_OptoReg(r29->as_VMReg()));
}

// Optimizaton of volatile gets and puts
Expand Down Expand Up @@ -4690,6 +4700,18 @@ operand iRegPNoSp()
interface(REG_INTER);
%}

// This operand is not allowed to use rfp even if
// rfp is not used to hold the frame pointer.
operand iRegPNoSpNoRfp()
%{
constraint(ALLOC_IN_RC(no_special_no_rfp_ptr_reg));
match(RegP);
match(iRegPNoSp);
op_cost(0);
format %{ %}
interface(REG_INTER);
%}

// Pointer 64 bit Register R0 only
operand iRegP_R0()
%{
Expand Down Expand Up @@ -16087,7 +16109,9 @@ instruct CallLeafNoFPDirect(method meth)
// Also known as an 'interprocedural jump'.
// Target of jump will eventually return to caller.
// TailJump below removes the return address.
instruct TailCalljmpInd(iRegPNoSp jump_target, inline_cache_RegP method_ptr)
// Don't use rfp for 'jump_target' because a MachEpilogNode has already been
// emitted just above the TailCall which has reset rfp to the caller state.
instruct TailCalljmpInd(iRegPNoSpNoRfp jump_target, inline_cache_RegP method_ptr)
%{
match(TailCall jump_target method_ptr);

Expand All @@ -16100,7 +16124,7 @@ instruct TailCalljmpInd(iRegPNoSp jump_target, inline_cache_RegP method_ptr)
ins_pipe(pipe_class_call);
%}

instruct TailjmpInd(iRegPNoSp jump_target, iRegP_R0 ex_oop)
instruct TailjmpInd(iRegPNoSpNoRfp jump_target, iRegP_R0 ex_oop)
%{
match(TailJump jump_target ex_oop);

Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,6 @@ class ZSetupArguments {
#define __ masm->

void ZBarrierSetAssembler::generate_c2_load_barrier_stub(MacroAssembler* masm, ZLoadBarrierStubC2* stub) const {
Assembler::InlineSkippedInstructionsCounter skipped_counter(masm);
BLOCK_COMMENT("ZLoadBarrierStubC2");

// Stub entry
Expand All @@ -1160,7 +1159,6 @@ void ZBarrierSetAssembler::generate_c2_load_barrier_stub(MacroAssembler* masm, Z
}

void ZBarrierSetAssembler::generate_c2_store_barrier_stub(MacroAssembler* masm, ZStoreBarrierStubC2* stub) const {
Assembler::InlineSkippedInstructionsCounter skipped_counter(masm);
BLOCK_COMMENT("ZStoreBarrierStubC2");

// Stub entry
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1778,6 +1778,8 @@ void InterpreterMacroAssembler::load_field_entry(Register cache, Register index,
ldr(cache, Address(rcpool, ConstantPoolCache::field_entries_offset()));
add(cache, cache, Array<ResolvedFieldEntry>::base_offset_in_bytes());
lea(cache, Address(cache, index));
// Prevents stale data from being read after the bytecode is patched to the fast bytecode
membar(MacroAssembler::LoadLoad);
}

void InterpreterMacroAssembler::load_method_entry(Register cache, Register index, int bcp_offset) {
Expand Down
6 changes: 1 addition & 5 deletions src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,11 +1560,7 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass,
}

#ifndef PRODUCT
mov(rscratch2, (address)&SharedRuntime::_partial_subtype_ctr);
Address pst_counter_addr(rscratch2);
ldr(rscratch1, pst_counter_addr);
add(rscratch1, rscratch1, 1);
str(rscratch1, pst_counter_addr);
incrementw(ExternalAddress((address)&SharedRuntime::_partial_subtype_ctr));
#endif //PRODUCT

// We will consult the secondary-super array.
Expand Down
5 changes: 1 addition & 4 deletions src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ class StubGenerator: public StubCodeGenerator {
#define inc_counter_np(counter) ((void)0)
#else
void inc_counter_np_(uint& counter) {
__ lea(rscratch2, ExternalAddress((address)&counter));
__ ldrw(rscratch1, Address(rscratch2));
__ addw(rscratch1, rscratch1, 1);
__ strw(rscratch1, Address(rscratch2));
__ incrementw(ExternalAddress((address)&counter));
}
#define inc_counter_np(counter) \
BLOCK_COMMENT("inc_counter " #counter); \
Expand Down
15 changes: 5 additions & 10 deletions src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,9 @@ void TemplateTable::load_resolved_field_entry(Register obj,
__ load_unsigned_byte(flags, Address(cache, in_bytes(ResolvedFieldEntry::flags_offset())));

// TOS state
__ load_unsigned_byte(tos_state, Address(cache, in_bytes(ResolvedFieldEntry::type_offset())));
if (tos_state != noreg) {
__ load_unsigned_byte(tos_state, Address(cache, in_bytes(ResolvedFieldEntry::type_offset())));
}

// Klass overwrite register
if (is_static) {
Expand Down Expand Up @@ -3069,13 +3071,9 @@ void TemplateTable::fast_storefield(TosState state)

// access constant pool cache
__ load_field_entry(r2, r1);
__ push(r0);
// R1: field offset, R2: TOS, R3: flags
load_resolved_field_entry(r2, r2, r0, r1, r3);
__ pop(r0);

// Must prevent reordering of the following cp cache loads with bytecode load
__ membar(MacroAssembler::LoadLoad);
// R1: field offset, R2: field holder, R3: flags
load_resolved_field_entry(r2, r2, noreg, r1, r3);

{
Label notVolatile;
Expand Down Expand Up @@ -3163,9 +3161,6 @@ void TemplateTable::fast_accessfield(TosState state)
// access constant pool cache
__ load_field_entry(r2, r1);

// Must prevent reordering of the following cp cache loads with bytecode load
__ membar(MacroAssembler::LoadLoad);

__ load_sized_value(r1, Address(r2, in_bytes(ResolvedFieldEntry::field_offset_offset())), sizeof(int), true /*is_signed*/);
__ load_unsigned_byte(r3, Address(r2, in_bytes(ResolvedFieldEntry::flags_offset())));

Expand Down
4 changes: 1 addition & 3 deletions src/hotspot/cpu/ppc/gc/z/zBarrierSetAssembler_ppc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -887,7 +887,6 @@ class ZSetupArguments {
#define __ masm->

void ZBarrierSetAssembler::generate_c2_load_barrier_stub(MacroAssembler* masm, ZLoadBarrierStubC2* stub) const {
Assembler::InlineSkippedInstructionsCounter skipped_counter(masm);
__ block_comment("generate_c2_load_barrier_stub (zgc) {");

__ bind(*stub->entry());
Expand All @@ -911,7 +910,6 @@ void ZBarrierSetAssembler::generate_c2_load_barrier_stub(MacroAssembler* masm, Z
}

void ZBarrierSetAssembler::generate_c2_store_barrier_stub(MacroAssembler* masm, ZStoreBarrierStubC2* stub) const {
Assembler::InlineSkippedInstructionsCounter skipped_counter(masm);
__ block_comment("ZStoreBarrierStubC2");

// Stub entry
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/cpu/riscv/interp_masm_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,8 @@ void InterpreterMacroAssembler::load_field_entry(Register cache, Register index,
ld(cache, Address(xcpool, ConstantPoolCache::field_entries_offset()));
add(cache, cache, Array<ResolvedIndyEntry>::base_offset_in_bytes());
add(cache, cache, index);
// Prevents stale data from being read after the bytecode is patched to the fast bytecode
membar(MacroAssembler::LoadLoad);
}

void InterpreterMacroAssembler::get_method_counters(Register method,
Expand Down
10 changes: 3 additions & 7 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2098,7 +2098,7 @@ void MacroAssembler::movoop(Register dst, jobject obj) {
RelocationHolder rspec = oop_Relocation::spec(oop_index);

if (BarrierSet::barrier_set()->barrier_set_assembler()->supports_instruction_patching()) {
mv(dst, Address((address)obj, rspec));
la(dst, Address((address)obj, rspec));
} else {
address dummy = address(uintptr_t(pc()) & -wordSize); // A nearby aligned address
ld_constant(dst, Address(dummy, rspec));
Expand All @@ -2114,7 +2114,7 @@ void MacroAssembler::mov_metadata(Register dst, Metadata* obj) {
oop_index = oop_recorder()->find_index(obj);
}
RelocationHolder rspec = metadata_Relocation::spec(oop_index);
mv(dst, Address((address)obj, rspec));
la(dst, Address((address)obj, rspec));
}

// Writes to stack successive pages until offset reached to check for
Expand Down Expand Up @@ -3344,11 +3344,7 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass,
mv(x10, super_klass);

#ifndef PRODUCT
mv(t1, (address)&SharedRuntime::_partial_subtype_ctr);
Address pst_counter_addr(t1);
ld(t0, pst_counter_addr);
add(t0, t0, 1);
sd(t0, pst_counter_addr);
incrementw(ExternalAddress((address)&SharedRuntime::_partial_subtype_ctr));
#endif // PRODUCT

// We will consult the secondary-super array.
Expand Down
7 changes: 0 additions & 7 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,6 @@ class MacroAssembler: public Assembler {
template<typename T, ENABLE_IF(std::is_integral<T>::value)>
inline void mv(Register Rd, T o) { li(Rd, (int64_t)o); }

void mv(Register Rd, Address dest) {
assert(dest.getMode() == Address::literal, "Address mode should be Address::literal");
relocate(dest.rspec(), [&] {
movptr(Rd, dest.target());
});
}

void mv(Register Rd, RegisterOrConstant src) {
if (src.is_register()) {
mv(Rd, src.as_register());
Expand Down
31 changes: 29 additions & 2 deletions src/hotspot/cpu/riscv/riscv.ad
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,12 @@ reg_class non_allocatable_reg(
R23, R23_H // java thread
);

// Class for all non-special integer registers
reg_class no_special_reg32 %{
return _NO_SPECIAL_REG32_mask;
%}

// Class for all non-special long integer registers
reg_class no_special_reg %{
return _NO_SPECIAL_REG_mask;
%}
Expand All @@ -661,10 +663,16 @@ reg_class ptr_reg %{
return _PTR_REG_mask;
%}

// Class for all non_special pointer registers
reg_class no_special_ptr_reg %{
return _NO_SPECIAL_PTR_REG_mask;
%}

// Class for all non_special pointer registers (excluding fp)
reg_class no_special_no_fp_ptr_reg %{
return _NO_SPECIAL_NO_FP_PTR_REG_mask;
%}

// Class for 64 bit register r10
reg_class r10_reg(
R10, R10_H
Expand Down Expand Up @@ -1037,6 +1045,7 @@ extern RegMask _PTR_REG_mask;
extern RegMask _NO_SPECIAL_REG32_mask;
extern RegMask _NO_SPECIAL_REG_mask;
extern RegMask _NO_SPECIAL_PTR_REG_mask;
extern RegMask _NO_SPECIAL_NO_FP_PTR_REG_mask;

class CallStubImpl {

Expand Down Expand Up @@ -1099,6 +1108,7 @@ RegMask _PTR_REG_mask;
RegMask _NO_SPECIAL_REG32_mask;
RegMask _NO_SPECIAL_REG_mask;
RegMask _NO_SPECIAL_PTR_REG_mask;
RegMask _NO_SPECIAL_NO_FP_PTR_REG_mask;

void reg_mask_init() {

Expand Down Expand Up @@ -1133,6 +1143,9 @@ void reg_mask_init() {
_NO_SPECIAL_REG_mask.Remove(OptoReg::as_OptoReg(x8->as_VMReg()));
_NO_SPECIAL_PTR_REG_mask.Remove(OptoReg::as_OptoReg(x8->as_VMReg()));
}

_NO_SPECIAL_NO_FP_PTR_REG_mask = _NO_SPECIAL_PTR_REG_mask;
_NO_SPECIAL_NO_FP_PTR_REG_mask.Remove(OptoReg::as_OptoReg(x8->as_VMReg()));
}

void PhaseOutput::pd_perform_mach_node_analysis() {
Expand Down Expand Up @@ -3175,6 +3188,18 @@ operand iRegPNoSp()
interface(REG_INTER);
%}

// This operand is not allowed to use fp even if
// fp is not used to hold the frame pointer.
operand iRegPNoSpNoFp()
%{
constraint(ALLOC_IN_RC(no_special_no_fp_ptr_reg));
match(RegP);
match(iRegPNoSp);
op_cost(0);
format %{ %}
interface(REG_INTER);
%}

operand iRegP_R10()
%{
constraint(ALLOC_IN_RC(r10_reg));
Expand Down Expand Up @@ -10506,7 +10531,9 @@ instruct cmpFastUnlockLightweight(rFlagsReg cr, iRegP object, iRegP_R10 box, iRe
// Also known as an 'interprocedural jump'.
// Target of jump will eventually return to caller.
// TailJump below removes the return address.
instruct TailCalljmpInd(iRegPNoSp jump_target, inline_cache_RegP method_oop)
// Don't use fp for 'jump_target' because a MachEpilogNode has already been
// emitted just above the TailCall which has reset fp to the caller state.
instruct TailCalljmpInd(iRegPNoSpNoFp jump_target, inline_cache_RegP method_oop)
%{
match(TailCall jump_target method_oop);

Expand All @@ -10519,7 +10546,7 @@ instruct TailCalljmpInd(iRegPNoSp jump_target, inline_cache_RegP method_oop)
ins_pipe(pipe_class_call);
%}

instruct TailjmpInd(iRegPNoSp jump_target, iRegP_R10 ex_oop)
instruct TailjmpInd(iRegPNoSpNoFp jump_target, iRegP_R10 ex_oop)
%{
match(TailJump jump_target ex_oop);

Expand Down
Loading

0 comments on commit b538080

Please sign in to comment.