Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8339113: AccessFlags can be u2 in metadata #22246

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void InterpreterMacroAssembler::remove_activation(

// get method access flags
ldr(r1, Address(rfp, frame::interpreter_frame_method_offset * wordSize));
ldr(r2, Address(r1, Method::access_flags_offset()));
load_unsigned_short(r2, Address(r1, Method::access_flags_offset()));
tbz(r2, exact_log2(JVM_ACC_SYNCHRONIZED), unlocked);

// Don't unlock anything if the _do_not_unlock_if_synchronized flag
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
Label L_skip_barrier;

{ // Bypass the barrier for non-static methods
__ ldrw(rscratch1, Address(rmethod, Method::access_flags_offset()));
__ load_unsigned_short(rscratch1, Address(rmethod, Method::access_flags_offset()));
__ andsw(zr, rscratch1, JVM_ACC_STATIC);
__ br(Assembler::EQ, L_skip_barrier); // non-static
}
Expand Down
16 changes: 8 additions & 8 deletions src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ void TemplateInterpreterGenerator::lock_method() {
#ifdef ASSERT
{
Label L;
__ ldrw(r0, access_flags);
__ load_unsigned_short(r0, access_flags);
__ tst(r0, JVM_ACC_SYNCHRONIZED);
__ br(Assembler::NE, L);
__ stop("method doesn't need synchronization");
Expand All @@ -820,7 +820,7 @@ void TemplateInterpreterGenerator::lock_method() {
// get synchronization object
{
Label done;
__ ldrw(r0, access_flags);
__ load_unsigned_short(r0, access_flags);
__ tst(r0, JVM_ACC_STATIC);
// get receiver (assume this is frequent case)
__ ldr(r0, Address(rlocals, Interpreter::local_offset_in_bytes(0)));
Expand Down Expand Up @@ -1225,7 +1225,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {

// make sure method is native & not abstract
#ifdef ASSERT
__ ldrw(r0, access_flags);
__ load_unsigned_short(r0, access_flags);
{
Label L;
__ tst(r0, JVM_ACC_NATIVE);
Expand Down Expand Up @@ -1277,7 +1277,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
#ifdef ASSERT
{
Label L;
__ ldrw(r0, access_flags);
__ load_unsigned_short(r0, access_flags);
__ tst(r0, JVM_ACC_SYNCHRONIZED);
__ br(Assembler::EQ, L);
__ stop("method needs synchronization");
Expand Down Expand Up @@ -1354,7 +1354,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// pass mirror handle if static call
{
Label L;
__ ldrw(t, Address(rmethod, Method::access_flags_offset()));
__ load_unsigned_short(t, Address(rmethod, Method::access_flags_offset()));
__ tbz(t, exact_log2(JVM_ACC_STATIC), L);
// get mirror
__ load_mirror(t, rmethod, r10, rscratch2);
Expand Down Expand Up @@ -1564,7 +1564,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// do unlocking if necessary
{
Label L;
__ ldrw(t, Address(rmethod, Method::access_flags_offset()));
__ load_unsigned_short(t, Address(rmethod, Method::access_flags_offset()));
__ tbz(t, exact_log2(JVM_ACC_SYNCHRONIZED), L);
// the code below should be shared with interpreter macro
// assembler implementation
Expand Down Expand Up @@ -1695,7 +1695,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {

// make sure method is not native & not abstract
#ifdef ASSERT
__ ldrw(r0, access_flags);
__ load_unsigned_short(r0, access_flags);
{
Label L;
__ tst(r0, JVM_ACC_NATIVE);
Expand Down Expand Up @@ -1751,7 +1751,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
#ifdef ASSERT
{
Label L;
__ ldrw(r0, access_flags);
__ load_unsigned_short(r0, access_flags);
__ tst(r0, JVM_ACC_SYNCHRONIZED);
__ br(Assembler::EQ, L);
__ stop("method needs synchronization");
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/arm/interp_masm_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ void InterpreterMacroAssembler::remove_activation(TosState state, Register ret_a
ldrb(Rflag, do_not_unlock_if_synchronized);

// get method access flags
ldr_u32(Raccess_flags, Address(Rmethod, Method::access_flags_offset()));
ldrh(Raccess_flags, Address(Rmethod, Method::access_flags_offset()));

strb(zero_register(Rtemp), do_not_unlock_if_synchronized); // reset the flag

Expand Down
14 changes: 7 additions & 7 deletions src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ void TemplateInterpreterGenerator::lock_method() {

#ifdef ASSERT
{ Label L;
__ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ tbnz(Rtemp, JVM_ACC_SYNCHRONIZED_BIT, L);
__ stop("method doesn't need synchronization");
__ bind(L);
Expand All @@ -588,7 +588,7 @@ void TemplateInterpreterGenerator::lock_method() {

// get synchronization object
{ Label done;
__ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ tst(Rtemp, JVM_ACC_STATIC);
__ ldr(R0, Address(Rlocals, Interpreter::local_offset_in_bytes(0)), eq); // get receiver (assume this is frequent case)
__ b(done, eq);
Expand Down Expand Up @@ -851,7 +851,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {

// make sure method is native & not abstract
#ifdef ASSERT
__ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
{
Label L;
__ tbnz(Rtemp, JVM_ACC_NATIVE_BIT, L);
Expand Down Expand Up @@ -893,7 +893,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// no synchronization necessary
#ifdef ASSERT
{ Label L;
__ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ tbz(Rtemp, JVM_ACC_SYNCHRONIZED_BIT, L);
__ stop("method needs synchronization");
__ bind(L);
Expand Down Expand Up @@ -975,7 +975,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// Pass JNIEnv and mirror for static methods
{
Label L;
__ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ add(R0, Rthread, in_bytes(JavaThread::jni_environment_offset()));
__ tbz(Rtemp, JVM_ACC_STATIC_BIT, L);
__ load_mirror(Rtemp, Rmethod, Rtemp);
Expand Down Expand Up @@ -1204,7 +1204,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {

// make sure method is not native & not abstract
#ifdef ASSERT
__ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
{
Label L;
__ tbz(Rtemp, JVM_ACC_NATIVE_BIT, L);
Expand Down Expand Up @@ -1249,7 +1249,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
// no synchronization necessary
#ifdef ASSERT
{ Label L;
__ ldr_u32(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ ldrh(Rtemp, Address(Rmethod, Method::access_flags_offset()));
__ tbz(Rtemp, JVM_ACC_SYNCHRONIZED_BIT, L);
__ stop("method needs synchronization");
__ bind(L);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,13 +681,13 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
// Check if synchronized method or unlocking prevented by
// JavaThread::do_not_unlock_if_synchronized flag.
lbz(Rdo_not_unlock_flag, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread);
lwz(Raccess_flags, in_bytes(Method::access_flags_offset()), R19_method);
lhz(Raccess_flags, in_bytes(Method::access_flags_offset()), R19_method);
li(R0, 0);
stb(R0, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); // reset flag

push(state);

// Skip if we don't have to unlock.
// Skip if we don't have to unlock. (???is this right???)
rldicl_(R0, Raccess_flags, 64-JVM_ACC_SYNCHRONIZED_BIT, 63); // Extract bit and compare to 0.
beq(CCR0, Lunlocked);

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
Label L_skip_barrier;

{ // Bypass the barrier for non-static methods
__ lwz(R0, in_bytes(Method::access_flags_offset()), R19_method);
__ lhz(R0, in_bytes(Method::access_flags_offset()), R19_method);
__ andi_(R0, R0, JVM_ACC_STATIC);
__ beq(CCR0, L_skip_barrier); // non-static
}
Expand Down
14 changes: 7 additions & 7 deletions src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ address TemplateInterpreterGenerator::generate_slow_signature_handler() {
// TODO PPC port: requires change in shared code.
//assert(in_bytes(AccessFlags::flags_offset()) == 0,
// "MethodDesc._access_flags == MethodDesc._access_flags._flags");
// _access_flags must be a 32 bit value.
assert(sizeof(AccessFlags) == 4, "wrong size");
__ lwa(R11_scratch1/*access_flags*/, method_(access_flags));
// _access_flags must be a 16 bit value.
assert(sizeof(AccessFlags) == 2, "wrong size");
__ lha(R11_scratch1/*access_flags*/, method_(access_flags));
// testbit with condition register.
__ testbitdi(CCR0, R0, R11_scratch1/*access_flags*/, JVM_ACC_STATIC_BIT);
__ btrue(CCR0, L);
Expand Down Expand Up @@ -823,7 +823,7 @@ void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratc

{
if (!flags_preloaded) {
__ lwz(Rflags, method_(access_flags));
__ lhz(Rflags, method_(access_flags));
}

#ifdef ASSERT
Expand Down Expand Up @@ -1301,8 +1301,8 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
assert(__ nonvolatile_accross_vthread_preemtion(access_flags),
"access_flags not preserved");
// Type check.
assert(4 == sizeof(AccessFlags), "unexpected field size");
__ lwz(access_flags, method_(access_flags));
assert(2 == sizeof(AccessFlags), "unexpected field size");
__ lhz(access_flags, method_(access_flags));

// We don't want to reload R19_method and access_flags after calls
// to some helper functions.
Expand Down Expand Up @@ -1769,7 +1769,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
#ifdef ASSERT
else {
Label Lok;
__ lwz(R0, in_bytes(Method::access_flags_offset()), R19_method);
__ lhz(R0, in_bytes(Method::access_flags_offset()), R19_method);
__ andi_(R0, R0, JVM_ACC_SYNCHRONIZED);
__ asm_assert_eq("method needs synchronization");
__ bind(Lok);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/interp_masm_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ void InterpreterMacroAssembler::remove_activation(

// get method access flags
ld(x11, Address(fp, frame::interpreter_frame_method_offset * wordSize));
ld(x12, Address(x11, Method::access_flags_offset()));
load_unsigned_short(x12, Address(x11, Method::access_flags_offset()));
test_bit(t0, x12, exact_log2(JVM_ACC_SYNCHRONIZED));
beqz(t0, unlocked);

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
Label L_skip_barrier;

{ // Bypass the barrier for non-static methods
__ lwu(t0, Address(xmethod, Method::access_flags_offset()));
__ load_unsigned_short(t0, Address(xmethod, Method::access_flags_offset()));
__ test_bit(t1, t0, exact_log2(JVM_ACC_STATIC));
__ beqz(t1, L_skip_barrier); // non-static
}
Expand Down
16 changes: 8 additions & 8 deletions src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,14 +714,14 @@ void TemplateInterpreterGenerator::lock_method() {
const int entry_size = frame::interpreter_frame_monitor_size_in_bytes();

#ifdef ASSERT
__ lwu(x10, access_flags);
__ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_SYNCHRONIZED, "method doesn't need synchronization", false);
#endif // ASSERT

// get synchronization object
{
Label done;
__ lwu(x10, access_flags);
__ load_unsigned_short(x10, access_flags);
__ andi(t0, x10, JVM_ACC_STATIC);
// get receiver (assume this is frequent case)
__ ld(x10, Address(xlocals, Interpreter::local_offset_in_bytes(0)));
Expand Down Expand Up @@ -1028,7 +1028,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {

// make sure method is native & not abstract
#ifdef ASSERT
__ lwu(x10, access_flags);
__ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_NATIVE, "tried to execute non-native method as native", false);
__ verify_access_flags(x10, JVM_ACC_ABSTRACT, "tried to execute abstract method in interpreter");
#endif
Expand Down Expand Up @@ -1066,7 +1066,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
} else {
// no synchronization necessary
#ifdef ASSERT
__ lwu(x10, access_flags);
__ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_SYNCHRONIZED, "method needs synchronization");
#endif
}
Expand Down Expand Up @@ -1130,7 +1130,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// pass mirror handle if static call
{
Label L;
__ lwu(t, Address(xmethod, Method::access_flags_offset()));
__ load_unsigned_short(t, Address(xmethod, Method::access_flags_offset()));
__ test_bit(t0, t, exact_log2(JVM_ACC_STATIC));
__ beqz(t0, L);
// get mirror
Expand Down Expand Up @@ -1346,7 +1346,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// do unlocking if necessary
{
Label L;
__ lwu(t, Address(xmethod, Method::access_flags_offset()));
__ load_unsigned_short(t, Address(xmethod, Method::access_flags_offset()));
__ test_bit(t0, t, exact_log2(JVM_ACC_SYNCHRONIZED));
__ beqz(t0, L);
// the code below should be shared with interpreter macro
Expand Down Expand Up @@ -1472,7 +1472,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {

// make sure method is not native & not abstract
#ifdef ASSERT
__ lwu(x10, access_flags);
__ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_NATIVE, "tried to execute native method as non-native");
__ verify_access_flags(x10, JVM_ACC_ABSTRACT, "tried to execute abstract method in interpreter");
#endif
Expand Down Expand Up @@ -1519,7 +1519,7 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
} else {
// no synchronization necessary
#ifdef ASSERT
__ lwu(x10, access_flags);
__ load_unsigned_short(x10, access_flags);
__ verify_access_flags(x10, JVM_ACC_SYNCHRONIZED, "method needs synchronization");
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/interp_masm_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ void InterpreterMacroAssembler::remove_activation(

// get method access flags
movptr(rcx, Address(rbp, frame::interpreter_frame_method_offset * wordSize));
movl(rcx, Address(rcx, Method::access_flags_offset()));
load_unsigned_short(rcx, Address(rcx, Method::access_flags_offset()));
testl(rcx, JVM_ACC_SYNCHRONIZED);
jcc(Assembler::zero, unlocked);

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm

{ // Bypass the barrier for non-static methods
Register flags = rscratch1;
__ movl(flags, Address(method, Method::access_flags_offset()));
__ load_unsigned_short(flags, Address(method, Method::access_flags_offset()));
__ testl(flags, JVM_ACC_STATIC);
__ jcc(Assembler::zero, L_skip_barrier); // non-static
}
Expand Down
Loading