mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-12 11:28:35 +00:00
8339112: Move JVM Klass flags out of AccessFlags
Reviewed-by: matsaave, cjplummer, dlong, thartmann, yzheng
This commit is contained in:
parent
6f8714ee19
commit
0cfd08f55a
@ -75,8 +75,8 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(hdr, obj);
|
||||
ldrw(hdr, Address(hdr, Klass::access_flags_offset()));
|
||||
tstw(hdr, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
ldrb(hdr, Address(hdr, Klass::misc_flags_offset()));
|
||||
tst(hdr, KlassFlags::_misc_is_value_based_class);
|
||||
br(Assembler::NE, slow_case);
|
||||
}
|
||||
|
||||
|
||||
@ -783,8 +783,8 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
|
||||
Label register_finalizer;
|
||||
Register t = r5;
|
||||
__ load_klass(t, r0);
|
||||
__ ldrw(t, Address(t, Klass::access_flags_offset()));
|
||||
__ tbnz(t, exact_log2(JVM_ACC_HAS_FINALIZER), register_finalizer);
|
||||
__ ldrb(t, Address(t, Klass::misc_flags_offset()));
|
||||
__ tbnz(t, exact_log2(KlassFlags::_misc_has_finalizer), register_finalizer);
|
||||
__ ret(lr);
|
||||
|
||||
__ bind(register_finalizer);
|
||||
|
||||
@ -64,8 +64,8 @@ void C2_MacroAssembler::fast_lock(Register objectReg, Register boxReg, Register
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp, oop);
|
||||
ldrw(tmp, Address(tmp, Klass::access_flags_offset()));
|
||||
tstw(tmp, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
ldrb(tmp, Address(tmp, Klass::misc_flags_offset()));
|
||||
tst(tmp, KlassFlags::_misc_is_value_based_class);
|
||||
br(Assembler::NE, cont);
|
||||
}
|
||||
|
||||
@ -243,8 +243,8 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register box, Regist
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(t1, obj);
|
||||
ldrw(t1, Address(t1, Klass::access_flags_offset()));
|
||||
tstw(t1, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
ldrb(t1, Address(t1, Klass::misc_flags_offset()));
|
||||
tst(t1, KlassFlags::_misc_is_value_based_class);
|
||||
br(Assembler::NE, slow_path);
|
||||
}
|
||||
|
||||
|
||||
@ -690,8 +690,8 @@ void InterpreterMacroAssembler::lock_object(Register lock_reg)
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp, obj_reg);
|
||||
ldrw(tmp, Address(tmp, Klass::access_flags_offset()));
|
||||
tstw(tmp, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
ldrb(tmp, Address(tmp, Klass::misc_flags_offset()));
|
||||
tst(tmp, KlassFlags::_misc_is_value_based_class);
|
||||
br(Assembler::NE, slow_case);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -2191,9 +2191,9 @@ void TemplateTable::_return(TosState state)
|
||||
|
||||
__ ldr(c_rarg1, aaddress(0));
|
||||
__ load_klass(r3, c_rarg1);
|
||||
__ ldrw(r3, Address(r3, Klass::access_flags_offset()));
|
||||
__ ldrb(r3, Address(r3, Klass::misc_flags_offset()));
|
||||
Label skip_register_finalizer;
|
||||
__ tbz(r3, exact_log2(JVM_ACC_HAS_FINALIZER), skip_register_finalizer);
|
||||
__ tbz(r3, exact_log2(KlassFlags::_misc_has_finalizer), skip_register_finalizer);
|
||||
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), c_rarg1);
|
||||
|
||||
|
||||
@ -195,8 +195,8 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp2, obj);
|
||||
ldr_u32(tmp2, Address(tmp2, Klass::access_flags_offset()));
|
||||
tst(tmp2, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
ldrb(tmp2, Address(tmp2, Klass::misc_flags_offset()));
|
||||
tst(tmp2, KlassFlags::_misc_is_value_based_class);
|
||||
b(slow_case, ne);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 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
|
||||
@ -504,11 +504,11 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
|
||||
{
|
||||
__ set_info("register_finalizer", dont_gc_arguments);
|
||||
|
||||
// Do not call runtime if JVM_ACC_HAS_FINALIZER flag is not set
|
||||
// Do not call runtime if has_finalizer flag is not set
|
||||
__ load_klass(Rtemp, R0);
|
||||
__ ldr_u32(Rtemp, Address(Rtemp, Klass::access_flags_offset()));
|
||||
__ ldrb(Rtemp, Address(Rtemp, Klass::misc_flags_offset()));
|
||||
|
||||
__ tst(Rtemp, JVM_ACC_HAS_FINALIZER);
|
||||
__ tst(Rtemp, KlassFlags::_misc_has_finalizer);
|
||||
__ bx(LR, eq);
|
||||
|
||||
// Call VM
|
||||
|
||||
@ -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.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -86,8 +86,8 @@ void C2_MacroAssembler::fast_lock(Register Roop, Register Rbox, Register Rscratc
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(Rscratch, Roop);
|
||||
ldr_u32(Rscratch, Address(Rscratch, Klass::access_flags_offset()));
|
||||
tst(Rscratch, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
ldrb(Rscratch, Address(Rscratch, Klass::misc_flags_offset()));
|
||||
tst(Rscratch, KlassFlags::_misc_is_value_based_class);
|
||||
b(done, ne);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 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
|
||||
@ -909,8 +909,8 @@ void InterpreterMacroAssembler::lock_object(Register Rlock) {
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(R0, Robj);
|
||||
ldr_u32(R0, Address(R0, Klass::access_flags_offset()));
|
||||
tst(R0, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
ldrb(R0, Address(R0, Klass::misc_flags_offset()));
|
||||
tst(R0, KlassFlags::_misc_is_value_based_class);
|
||||
b(slow_case, ne);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 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
|
||||
@ -2494,8 +2494,8 @@ void TemplateTable::_return(TosState state) {
|
||||
assert(state == vtos, "only valid state");
|
||||
__ ldr(R1, aaddress(0));
|
||||
__ load_klass(Rtemp, R1);
|
||||
__ ldr_u32(Rtemp, Address(Rtemp, Klass::access_flags_offset()));
|
||||
__ tbz(Rtemp, exact_log2(JVM_ACC_HAS_FINALIZER), skip_register_finalizer);
|
||||
__ ldrb(Rtemp, Address(Rtemp, Klass::misc_flags_offset()));
|
||||
__ tbz(Rtemp, exact_log2(KlassFlags::_misc_has_finalizer), skip_register_finalizer);
|
||||
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), R1);
|
||||
|
||||
|
||||
@ -86,8 +86,8 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(Rscratch, Roop);
|
||||
lwz(Rscratch, in_bytes(Klass::access_flags_offset()), Rscratch);
|
||||
testbitdi(CCR0, R0, Rscratch, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
lbz(Rscratch, in_bytes(Klass::misc_flags_offset()), Rscratch);
|
||||
testbitdi(CCR0, R0, Rscratch, exact_log2(KlassFlags::_misc_is_value_based_class));
|
||||
bne(CCR0, slow_int);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -479,8 +479,8 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
|
||||
|
||||
// Load the klass and check the has finalizer flag.
|
||||
__ load_klass(t, R3_ARG1);
|
||||
__ lwz(t, in_bytes(Klass::access_flags_offset()), t);
|
||||
__ testbitdi(CCR0, R0, t, exact_log2(JVM_ACC_HAS_FINALIZER));
|
||||
__ lbz(t, in_bytes(Klass::misc_flags_offset()), t);
|
||||
__ testbitdi(CCR0, R0, t, exact_log2(KlassFlags::_misc_has_finalizer));
|
||||
// Return if has_finalizer bit == 0 (CR0.eq).
|
||||
__ bclr(Assembler::bcondCRbiIs1, Assembler::bi0(CCR0, Assembler::equal), Assembler::bhintbhBCLRisReturn);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -970,8 +970,8 @@ void InterpreterMacroAssembler::lock_object(Register monitor, Register object) {
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp, object);
|
||||
lwz(tmp, in_bytes(Klass::access_flags_offset()), tmp);
|
||||
testbitdi(CCR0, R0, tmp, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
lbz(tmp, in_bytes(Klass::misc_flags_offset()), tmp);
|
||||
testbitdi(CCR0, R0, tmp, exact_log2(KlassFlags::_misc_is_value_based_class));
|
||||
bne(CCR0, slow_case);
|
||||
}
|
||||
|
||||
|
||||
@ -2561,8 +2561,8 @@ void MacroAssembler::compiler_fast_lock_object(ConditionRegister flag, Register
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(temp, oop);
|
||||
lwz(temp, in_bytes(Klass::access_flags_offset()), temp);
|
||||
testbitdi(flag, R0, temp, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
lbz(temp, in_bytes(Klass::misc_flags_offset()), temp);
|
||||
testbitdi(flag, R0, temp, exact_log2(KlassFlags::_misc_is_value_based_class));
|
||||
bne(flag, failure);
|
||||
}
|
||||
|
||||
@ -2752,8 +2752,8 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(ConditionRegister fla
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp1, obj);
|
||||
lwz(tmp1, in_bytes(Klass::access_flags_offset()), tmp1);
|
||||
testbitdi(flag, R0, tmp1, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
lbz(tmp1, in_bytes(Klass::misc_flags_offset()), tmp1);
|
||||
testbitdi(flag, R0, tmp1, exact_log2(KlassFlags::_misc_is_value_based_class));
|
||||
bne(flag, slow_path);
|
||||
}
|
||||
|
||||
|
||||
@ -2130,8 +2130,8 @@ void TemplateTable::_return(TosState state) {
|
||||
|
||||
// Load klass of this obj.
|
||||
__ load_klass(Rklass, R17_tos);
|
||||
__ lwz(Rklass_flags, in_bytes(Klass::access_flags_offset()), Rklass);
|
||||
__ testbitdi(CCR0, R0, Rklass_flags, exact_log2(JVM_ACC_HAS_FINALIZER));
|
||||
__ lbz(Rklass_flags, in_bytes(Klass::misc_flags_offset()), Rklass);
|
||||
__ testbitdi(CCR0, R0, Rklass_flags, exact_log2(KlassFlags::_misc_has_finalizer));
|
||||
__ bfalse(CCR0, Lskip_register_finalizer);
|
||||
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), R17_tos /* obj */);
|
||||
|
||||
@ -64,8 +64,8 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(hdr, obj);
|
||||
lwu(hdr, Address(hdr, Klass::access_flags_offset()));
|
||||
test_bit(temp, hdr, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
lbu(hdr, Address(hdr, Klass::misc_flags_offset()));
|
||||
test_bit(temp, hdr, exact_log2(KlassFlags::_misc_is_value_based_class));
|
||||
bnez(temp, slow_case, true /* is_far */);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
@ -797,8 +797,8 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
|
||||
Label register_finalizer;
|
||||
Register t = x15;
|
||||
__ load_klass(t, x10);
|
||||
__ lwu(t, Address(t, Klass::access_flags_offset()));
|
||||
__ test_bit(t0, t, exact_log2(JVM_ACC_HAS_FINALIZER));
|
||||
__ lbu(t, Address(t, Klass::misc_flags_offset()));
|
||||
__ test_bit(t0, t, exact_log2(KlassFlags::_misc_has_finalizer));
|
||||
__ bnez(t0, register_finalizer);
|
||||
__ ret();
|
||||
|
||||
|
||||
@ -68,8 +68,8 @@ void C2_MacroAssembler::fast_lock(Register objectReg, Register boxReg,
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp, oop);
|
||||
lwu(tmp, Address(tmp, Klass::access_flags_offset()));
|
||||
test_bit(tmp, tmp, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
lbu(tmp, Address(tmp, Klass::misc_flags_offset()));
|
||||
test_bit(tmp, tmp, exact_log2(KlassFlags::_misc_is_value_based_class));
|
||||
bnez(tmp, slow_path);
|
||||
}
|
||||
|
||||
@ -277,8 +277,8 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register box,
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp1, obj);
|
||||
lwu(tmp1, Address(tmp1, Klass::access_flags_offset()));
|
||||
test_bit(tmp1, tmp1, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
lbu(tmp1, Address(tmp1, Klass::misc_flags_offset()));
|
||||
test_bit(tmp1, tmp1, exact_log2(KlassFlags::_misc_is_value_based_class));
|
||||
bnez(tmp1, slow_path);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
|
||||
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
@ -750,8 +750,8 @@ void InterpreterMacroAssembler::lock_object(Register lock_reg)
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp, obj_reg);
|
||||
lwu(tmp, Address(tmp, Klass::access_flags_offset()));
|
||||
test_bit(tmp, tmp, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
lbu(tmp, Address(tmp, Klass::misc_flags_offset()));
|
||||
test_bit(tmp, tmp, exact_log2(KlassFlags::_misc_is_value_based_class));
|
||||
bnez(tmp, slow_case);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
@ -2098,9 +2098,9 @@ void TemplateTable::_return(TosState state) {
|
||||
|
||||
__ ld(c_rarg1, aaddress(0));
|
||||
__ load_klass(x13, c_rarg1);
|
||||
__ lwu(x13, Address(x13, Klass::access_flags_offset()));
|
||||
__ lbu(x13, Address(x13, Klass::misc_flags_offset()));
|
||||
Label skip_register_finalizer;
|
||||
__ test_bit(t0, x13, exact_log2(JVM_ACC_HAS_FINALIZER));
|
||||
__ test_bit(t0, x13, exact_log2(KlassFlags::_misc_has_finalizer));
|
||||
__ beqz(t0, skip_register_finalizer);
|
||||
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), c_rarg1);
|
||||
|
||||
@ -72,7 +72,7 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp, Roop);
|
||||
testbit(Address(tmp, Klass::access_flags_offset()), exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
z_tm(Address(tmp, Klass::misc_flags_offset()), KlassFlags::_misc_is_value_based_class);
|
||||
branch_optimized(Assembler::bcondAllOne, slow_case);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -443,7 +443,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
|
||||
// Load the klass and check the has finalizer flag.
|
||||
Register klass = Z_ARG2;
|
||||
__ load_klass(klass, Z_ARG1);
|
||||
__ testbit(Address(klass, Klass::access_flags_offset()), exact_log2(JVM_ACC_HAS_FINALIZER));
|
||||
__ z_tm(Address(klass, Klass::misc_flags_offset()), KlassFlags::_misc_has_finalizer);
|
||||
__ z_bcr(Assembler::bcondAllZero, Z_R14); // Return if bit is not set.
|
||||
|
||||
OopMap* oop_map = save_live_registers(sasm);
|
||||
|
||||
@ -1007,7 +1007,7 @@ void InterpreterMacroAssembler::lock_object(Register monitor, Register object) {
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp, object);
|
||||
testbit(Address(tmp, Klass::access_flags_offset()), exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
|
||||
z_tm(Address(tmp, Klass::misc_flags_offset()), KlassFlags::_misc_is_value_based_class);
|
||||
z_btrue(slow_case);
|
||||
}
|
||||
|
||||
|
||||
@ -3507,9 +3507,7 @@ void MacroAssembler::compiler_fast_lock_object(Register oop, Register box, Regis
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(temp, oop);
|
||||
z_l(temp, Address(temp, Klass::access_flags_offset()));
|
||||
assert((JVM_ACC_IS_VALUE_BASED_CLASS & 0xFFFF) == 0, "or change following instruction");
|
||||
z_nilh(temp, JVM_ACC_IS_VALUE_BASED_CLASS >> 16);
|
||||
z_tm(Address(temp, Klass::misc_flags_offset()), KlassFlags::_misc_is_value_based_class);
|
||||
z_brne(done);
|
||||
}
|
||||
|
||||
@ -6154,9 +6152,7 @@ void MacroAssembler::compiler_fast_lock_lightweight_object(Register obj, Registe
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp1, obj);
|
||||
z_l(tmp1, Address(tmp1, Klass::access_flags_offset()));
|
||||
assert((JVM_ACC_IS_VALUE_BASED_CLASS & 0xFFFF) == 0, "or change following instruction");
|
||||
z_nilh(tmp1, JVM_ACC_IS_VALUE_BASED_CLASS >> 16);
|
||||
z_tm(Address(tmp1, Klass::misc_flags_offset()), KlassFlags::_misc_is_value_based_class);
|
||||
z_brne(slow_path);
|
||||
}
|
||||
|
||||
|
||||
@ -2321,7 +2321,7 @@ void TemplateTable::_return(TosState state) {
|
||||
assert(state == vtos, "only valid state");
|
||||
__ z_lg(Rthis, aaddress(0));
|
||||
__ load_klass(Rklass, Rthis);
|
||||
__ testbit(Address(Rklass, Klass::access_flags_offset()), exact_log2(JVM_ACC_HAS_FINALIZER));
|
||||
__ z_tm(Address(Rklass, Klass::misc_flags_offset()), KlassFlags::_misc_has_finalizer);
|
||||
__ z_bfalse(skip_register_finalizer);
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), Rthis);
|
||||
__ bind(skip_register_finalizer);
|
||||
|
||||
@ -58,8 +58,7 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(hdr, obj, rscratch1);
|
||||
movl(hdr, Address(hdr, Klass::access_flags_offset()));
|
||||
testl(hdr, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
testb(Address(hdr, Klass::misc_flags_offset()), KlassFlags::_misc_is_value_based_class);
|
||||
jcc(Assembler::notZero, slow_case);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -1166,8 +1166,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
|
||||
Label register_finalizer;
|
||||
Register t = rsi;
|
||||
__ load_klass(t, rax, rscratch1);
|
||||
__ movl(t, Address(t, Klass::access_flags_offset()));
|
||||
__ testl(t, JVM_ACC_HAS_FINALIZER);
|
||||
__ testb(Address(t, Klass::misc_flags_offset()), KlassFlags::_misc_has_finalizer);
|
||||
__ jcc(Assembler::notZero, register_finalizer);
|
||||
__ ret(0);
|
||||
|
||||
|
||||
@ -277,8 +277,7 @@ void C2_MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmp
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmpReg, objReg, scrReg);
|
||||
movl(tmpReg, Address(tmpReg, Klass::access_flags_offset()));
|
||||
testl(tmpReg, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
testb(Address(tmpReg, Klass::misc_flags_offset()), KlassFlags::_misc_is_value_based_class);
|
||||
jcc(Assembler::notZero, DONE_LABEL);
|
||||
}
|
||||
|
||||
@ -597,8 +596,7 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register box, Regist
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(rax_reg, obj, t);
|
||||
movl(rax_reg, Address(rax_reg, Klass::access_flags_offset()));
|
||||
testl(rax_reg, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
testb(Address(rax_reg, Klass::misc_flags_offset()), KlassFlags::_misc_is_value_based_class);
|
||||
jcc(Assembler::notZero, slow_path);
|
||||
}
|
||||
|
||||
|
||||
@ -1175,8 +1175,7 @@ void InterpreterMacroAssembler::lock_object(Register lock_reg) {
|
||||
|
||||
if (DiagnoseSyncOnValueBasedClasses != 0) {
|
||||
load_klass(tmp_reg, obj_reg, rklass_decode_tmp);
|
||||
movl(tmp_reg, Address(tmp_reg, Klass::access_flags_offset()));
|
||||
testl(tmp_reg, JVM_ACC_IS_VALUE_BASED_CLASS);
|
||||
testb(Address(tmp_reg, Klass::misc_flags_offset()), KlassFlags::_misc_is_value_based_class);
|
||||
jcc(Assembler::notZero, slow_case);
|
||||
}
|
||||
|
||||
|
||||
@ -2579,8 +2579,7 @@ void TemplateTable::_return(TosState state) {
|
||||
Register robj = LP64_ONLY(c_rarg1) NOT_LP64(rax);
|
||||
__ movptr(robj, aaddress(0));
|
||||
__ load_klass(rdi, robj, rscratch1);
|
||||
__ movl(rdi, Address(rdi, Klass::access_flags_offset()));
|
||||
__ testl(rdi, JVM_ACC_HAS_FINALIZER);
|
||||
__ testb(Address(rdi, Klass::misc_flags_offset()), KlassFlags::_misc_has_finalizer);
|
||||
Label skip_register_finalizer;
|
||||
__ jcc(Assembler::zero, skip_register_finalizer);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -59,7 +59,7 @@ ciInstanceKlass::ciInstanceKlass(Klass* k) :
|
||||
|
||||
AccessFlags access_flags = ik->access_flags();
|
||||
_flags = ciFlags(access_flags);
|
||||
_has_finalizer = access_flags.has_finalizer();
|
||||
_has_finalizer = ik->has_finalizer();
|
||||
_has_subklass = flags().is_final() ? subklass_false : subklass_unknown;
|
||||
_init_state = ik->init_state();
|
||||
_has_nonstatic_fields = ik->has_nonstatic_fields();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -226,6 +226,15 @@ jint ciKlass::access_flags() {
|
||||
)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciKlass::misc_flags
|
||||
klass_flags_t ciKlass::misc_flags() {
|
||||
assert(is_loaded(), "not loaded");
|
||||
GUARDED_VM_ENTRY(
|
||||
return get_Klass()->misc_flags();
|
||||
)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciKlass::print_impl
|
||||
//
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -121,6 +121,9 @@ public:
|
||||
// Fetch Klass::access_flags.
|
||||
jint access_flags();
|
||||
|
||||
// Fetch Klass::misc_flags.
|
||||
klass_flags_t misc_flags();
|
||||
|
||||
// What kind of ciObject is this?
|
||||
bool is_klass() const { return true; }
|
||||
|
||||
|
||||
@ -5173,9 +5173,7 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik,
|
||||
ik->set_has_nonstatic_concrete_methods(_has_nonstatic_concrete_methods);
|
||||
ik->set_declares_nonstatic_concrete_methods(_declares_nonstatic_concrete_methods);
|
||||
|
||||
if (_is_hidden) {
|
||||
ik->set_is_hidden();
|
||||
}
|
||||
assert(!_is_hidden || ik->is_hidden(), "must be set already");
|
||||
|
||||
// Set PackageEntry for this_klass
|
||||
oop cl = ik->class_loader();
|
||||
|
||||
@ -274,6 +274,7 @@
|
||||
nonstatic_field(Klass, _class_loader_data, ClassLoaderData*) \
|
||||
nonstatic_field(Klass, _bitmap, uintx) \
|
||||
nonstatic_field(Klass, _hash_slot, uint8_t) \
|
||||
nonstatic_field(Klass, _misc_flags._flags, u1) \
|
||||
\
|
||||
nonstatic_field(LocalVariableTableElement, start_bci, u2) \
|
||||
nonstatic_field(LocalVariableTableElement, length, u2) \
|
||||
@ -482,10 +483,6 @@
|
||||
declare_constant(JVMCINMethodData::SPECULATION_LENGTH_BITS) \
|
||||
\
|
||||
declare_constant(JVM_ACC_WRITTEN_FLAGS) \
|
||||
declare_constant(JVM_ACC_HAS_FINALIZER) \
|
||||
declare_constant(JVM_ACC_IS_CLONEABLE_FAST) \
|
||||
declare_constant(JVM_ACC_IS_HIDDEN_CLASS) \
|
||||
declare_constant(JVM_ACC_IS_VALUE_BASED_CLASS) \
|
||||
declare_constant(FieldInfo::FieldFlags::_ff_injected) \
|
||||
declare_constant(FieldInfo::FieldFlags::_ff_stable) \
|
||||
declare_preprocessor_constant("JVM_ACC_VARARGS", JVM_ACC_VARARGS) \
|
||||
@ -733,6 +730,10 @@
|
||||
\
|
||||
declare_constant(InstanceKlassFlags::_misc_has_nonstatic_concrete_methods) \
|
||||
declare_constant(InstanceKlassFlags::_misc_declares_nonstatic_concrete_methods) \
|
||||
declare_constant(KlassFlags::_misc_is_hidden_class) \
|
||||
declare_constant(KlassFlags::_misc_is_value_based_class) \
|
||||
declare_constant(KlassFlags::_misc_has_finalizer) \
|
||||
declare_constant(KlassFlags::_misc_is_cloneable_fast) \
|
||||
\
|
||||
declare_constant(JumpData::taken_off_set) \
|
||||
declare_constant(JumpData::displacement_off_set) \
|
||||
|
||||
@ -2659,8 +2659,8 @@ void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handl
|
||||
array_klasses()->restore_unshareable_info(class_loader_data(), Handle(), CHECK);
|
||||
}
|
||||
|
||||
// Initialize @ValueBased class annotation
|
||||
if (DiagnoseSyncOnValueBasedClasses && has_value_based_class_annotation()) {
|
||||
// Initialize @ValueBased class annotation if not already set in the archived klass.
|
||||
if (DiagnoseSyncOnValueBasedClasses && has_value_based_class_annotation() && !is_value_based()) {
|
||||
set_is_value_based();
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ void Klass::set_java_mirror(Handle m) {
|
||||
}
|
||||
|
||||
bool Klass::is_cloneable() const {
|
||||
return _access_flags.is_cloneable_fast() ||
|
||||
return _misc_flags.is_cloneable_fast() ||
|
||||
is_subtype_of(vmClasses::Cloneable_klass());
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ void Klass::set_is_cloneable() {
|
||||
} else if (is_instance_klass() && InstanceKlass::cast(this)->reference_type() != REF_NONE) {
|
||||
// Reference cloning should not be intrinsified and always happen in JVM_Clone.
|
||||
} else {
|
||||
_access_flags.set_is_cloneable_fast();
|
||||
_misc_flags.set_is_cloneable_fast(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -975,6 +975,7 @@ void Klass::oop_print_on(oop obj, outputStream* st) {
|
||||
// print class
|
||||
st->print(BULLET"klass: ");
|
||||
obj->klass()->print_value_on(st);
|
||||
st->print(BULLET"flags: "); _misc_flags.print_on(st); st->cr();
|
||||
st->cr();
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
#include "memory/iterator.hpp"
|
||||
#include "memory/memRegion.hpp"
|
||||
#include "oops/klassFlags.hpp"
|
||||
#include "oops/markWord.hpp"
|
||||
#include "oops/metadata.hpp"
|
||||
#include "oops/oop.hpp"
|
||||
@ -165,6 +166,8 @@ class Klass : public Metadata {
|
||||
// Keep it away from the beginning of a Klass to avoid cacheline
|
||||
// contention that may happen when a nearby object is modified.
|
||||
AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here.
|
||||
// Some flags created by the JVM, not in the class file itself,
|
||||
// are in _misc_flags below.
|
||||
|
||||
JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
|
||||
|
||||
@ -194,6 +197,8 @@ private:
|
||||
};
|
||||
#endif
|
||||
|
||||
KlassFlags _misc_flags;
|
||||
|
||||
CDS_JAVA_HEAP_ONLY(int _archived_mirror_index;)
|
||||
|
||||
protected:
|
||||
@ -428,6 +433,7 @@ protected:
|
||||
static ByteSize next_sibling_offset() { return byte_offset_of(Klass, _next_sibling); }
|
||||
#endif
|
||||
static ByteSize bitmap_offset() { return byte_offset_of(Klass, _bitmap); }
|
||||
static ByteSize misc_flags_offset() { return byte_offset_of(Klass, _misc_flags._flags); }
|
||||
|
||||
// Unpacking layout_helper:
|
||||
static const int _lh_neutral_value = 0; // neutral non-array non-instance value
|
||||
@ -692,12 +698,14 @@ protected:
|
||||
bool is_super() const { return _access_flags.is_super(); }
|
||||
bool is_synthetic() const { return _access_flags.is_synthetic(); }
|
||||
void set_is_synthetic() { _access_flags.set_is_synthetic(); }
|
||||
bool has_finalizer() const { return _access_flags.has_finalizer(); }
|
||||
void set_has_finalizer() { _access_flags.set_has_finalizer(); }
|
||||
bool is_hidden() const { return access_flags().is_hidden_class(); }
|
||||
void set_is_hidden() { _access_flags.set_is_hidden_class(); }
|
||||
bool is_value_based() { return _access_flags.is_value_based_class(); }
|
||||
void set_is_value_based() { _access_flags.set_is_value_based_class(); }
|
||||
bool has_finalizer() const { return _misc_flags.has_finalizer(); }
|
||||
void set_has_finalizer() { _misc_flags.set_has_finalizer(true); }
|
||||
bool is_hidden() const { return _misc_flags.is_hidden_class(); }
|
||||
void set_is_hidden() { _misc_flags.set_is_hidden_class(true); }
|
||||
bool is_value_based() const { return _misc_flags.is_value_based_class(); }
|
||||
void set_is_value_based() { _misc_flags.set_is_value_based_class(true); }
|
||||
|
||||
klass_flags_t misc_flags() const { return _misc_flags.value(); }
|
||||
|
||||
inline bool is_non_strong_hidden() const;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
@ -37,8 +37,7 @@ inline oop Klass::klass_holder() const {
|
||||
}
|
||||
|
||||
inline bool Klass::is_non_strong_hidden() const {
|
||||
return access_flags().is_hidden_class() &&
|
||||
class_loader_data()->has_class_mirror_holder();
|
||||
return is_hidden() && class_loader_data()->has_class_mirror_holder();
|
||||
}
|
||||
|
||||
// Iff the class loader (or mirror for non-strong hidden classes) is alive the
|
||||
|
||||
34
src/hotspot/share/oops/klassFlags.cpp
Normal file
34
src/hotspot/share/oops/klassFlags.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "oops/klassFlags.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
|
||||
void KlassFlags::print_on(outputStream* st) const {
|
||||
#define KLASS_FLAGS_PRINT(name, ignore) \
|
||||
if (name()) st->print(#name " ");
|
||||
KLASS_FLAGS_DO(KLASS_FLAGS_PRINT)
|
||||
#undef KLASS_FLAGS_PRINT
|
||||
}
|
||||
78
src/hotspot/share/oops/klassFlags.hpp
Normal file
78
src/hotspot/share/oops/klassFlags.hpp
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHARE_OOPS_KLASSFLAGS_HPP
|
||||
#define SHARE_OOPS_KLASSFLAGS_HPP
|
||||
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
class outputStream;
|
||||
|
||||
// The Klass class contains only parse-time flags and are used by generated code, even though
|
||||
// most apply to InstanceKlass, access is more straightforward through Klass pointers.
|
||||
// These flags are JVM internal and not part of the AccessFlags classfile specification.
|
||||
|
||||
using klass_flags_t = u1;
|
||||
|
||||
class KlassFlags {
|
||||
friend class VMStructs;
|
||||
friend class JVMCIVMStructs;
|
||||
|
||||
public:
|
||||
#define KLASS_FLAGS_DO(flag) \
|
||||
flag(is_hidden_class , 1 << 0) \
|
||||
flag(is_value_based_class , 1 << 1) \
|
||||
flag(has_finalizer , 1 << 2) \
|
||||
flag(is_cloneable_fast , 1 << 3) \
|
||||
/* end of list */
|
||||
|
||||
#define KLASS_FLAGS_ENUM_NAME(name, value) _misc_##name = value,
|
||||
enum {
|
||||
KLASS_FLAGS_DO(KLASS_FLAGS_ENUM_NAME)
|
||||
};
|
||||
#undef KLASS_FLAGS_ENUM_NAME
|
||||
|
||||
// These flags are write-once before the class is published and then read-only
|
||||
// so don't require atomic updates.
|
||||
klass_flags_t _flags;
|
||||
|
||||
public:
|
||||
KlassFlags() : _flags(0) {}
|
||||
|
||||
klass_flags_t value() const { return _flags; }
|
||||
|
||||
// Create getters and setters for the flag values.
|
||||
#define KLASS_FLAGS_GET_SET(name, ignore) \
|
||||
bool name() const { return (_flags & _misc_##name) != 0; } \
|
||||
void set_##name(bool b) { \
|
||||
assert(!name(), "set once"); \
|
||||
if (b) _flags |= _misc_##name; \
|
||||
}
|
||||
KLASS_FLAGS_DO(KLASS_FLAGS_GET_SET)
|
||||
#undef KLASS_FLAGS_GET_SET
|
||||
|
||||
void print_on(outputStream* st) const;
|
||||
};
|
||||
|
||||
#endif // SHARE_OOPS_KLASSFLAGS_HPP
|
||||
@ -1701,6 +1701,8 @@ Compile::AliasType* Compile::find_alias_type(const TypePtr* adr_type, bool no_cr
|
||||
alias_type(idx)->set_rewritable(false);
|
||||
if (flat->offset() == in_bytes(Klass::access_flags_offset()))
|
||||
alias_type(idx)->set_rewritable(false);
|
||||
if (flat->offset() == in_bytes(Klass::misc_flags_offset()))
|
||||
alias_type(idx)->set_rewritable(false);
|
||||
if (flat->offset() == in_bytes(Klass::java_mirror_offset()))
|
||||
alias_type(idx)->set_rewritable(false);
|
||||
if (flat->offset() == in_bytes(Klass::secondary_super_cache_offset()))
|
||||
|
||||
@ -3860,13 +3860,14 @@ Node* LibraryCallKit::load_klass_from_mirror_common(Node* mirror,
|
||||
}
|
||||
|
||||
//--------------------(inline_native_Class_query helpers)---------------------
|
||||
// Use this for JVM_ACC_INTERFACE, JVM_ACC_IS_CLONEABLE_FAST, JVM_ACC_HAS_FINALIZER.
|
||||
// Use this for JVM_ACC_INTERFACE.
|
||||
// Fall through if (mods & mask) == bits, take the guard otherwise.
|
||||
Node* LibraryCallKit::generate_access_flags_guard(Node* kls, int modifier_mask, int modifier_bits, RegionNode* region) {
|
||||
Node* LibraryCallKit::generate_klass_flags_guard(Node* kls, int modifier_mask, int modifier_bits, RegionNode* region,
|
||||
ByteSize offset, const Type* type, BasicType bt) {
|
||||
// Branch around if the given klass has the given modifier bit set.
|
||||
// Like generate_guard, adds a new path onto the region.
|
||||
Node* modp = basic_plus_adr(kls, in_bytes(Klass::access_flags_offset()));
|
||||
Node* mods = make_load(nullptr, modp, TypeInt::INT, T_INT, MemNode::unordered);
|
||||
Node* modp = basic_plus_adr(kls, in_bytes(offset));
|
||||
Node* mods = make_load(nullptr, modp, type, bt, MemNode::unordered);
|
||||
Node* mask = intcon(modifier_mask);
|
||||
Node* bits = intcon(modifier_bits);
|
||||
Node* mbit = _gvn.transform(new AndINode(mods, mask));
|
||||
@ -3875,10 +3876,18 @@ Node* LibraryCallKit::generate_access_flags_guard(Node* kls, int modifier_mask,
|
||||
return generate_fair_guard(bol, region);
|
||||
}
|
||||
Node* LibraryCallKit::generate_interface_guard(Node* kls, RegionNode* region) {
|
||||
return generate_access_flags_guard(kls, JVM_ACC_INTERFACE, 0, region);
|
||||
return generate_klass_flags_guard(kls, JVM_ACC_INTERFACE, 0, region,
|
||||
Klass::access_flags_offset(), TypeInt::INT, T_INT);
|
||||
}
|
||||
|
||||
// Use this for testing if Klass is_hidden, has_finalizer, and is_cloneable_fast.
|
||||
Node* LibraryCallKit::generate_misc_flags_guard(Node* kls, int modifier_mask, int modifier_bits, RegionNode* region) {
|
||||
return generate_klass_flags_guard(kls, modifier_mask, modifier_bits, region,
|
||||
Klass::misc_flags_offset(), TypeInt::UBYTE, T_BOOLEAN);
|
||||
}
|
||||
|
||||
Node* LibraryCallKit::generate_hidden_class_guard(Node* kls, RegionNode* region) {
|
||||
return generate_access_flags_guard(kls, JVM_ACC_IS_HIDDEN_CLASS, 0, region);
|
||||
return generate_misc_flags_guard(kls, KlassFlags::_misc_is_hidden_class, 0, region);
|
||||
}
|
||||
|
||||
//-------------------------inline_native_Class_query-------------------
|
||||
@ -5320,12 +5329,12 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) {
|
||||
// The object must be easily cloneable and must not have a finalizer.
|
||||
// Both of these conditions may be checked in a single test.
|
||||
// We could optimize the test further, but we don't care.
|
||||
generate_access_flags_guard(obj_klass,
|
||||
// Test both conditions:
|
||||
JVM_ACC_IS_CLONEABLE_FAST | JVM_ACC_HAS_FINALIZER,
|
||||
// Must be cloneable but not finalizer:
|
||||
JVM_ACC_IS_CLONEABLE_FAST,
|
||||
slow_region);
|
||||
generate_misc_flags_guard(obj_klass,
|
||||
// Test both conditions:
|
||||
KlassFlags::_misc_is_cloneable_fast | KlassFlags::_misc_has_finalizer,
|
||||
// Must be cloneable but not finalizer:
|
||||
KlassFlags::_misc_is_cloneable_fast,
|
||||
slow_region);
|
||||
}
|
||||
|
||||
if (!stopped()) {
|
||||
|
||||
@ -156,9 +156,11 @@ class LibraryCallKit : public GraphKit {
|
||||
region, null_path,
|
||||
offset);
|
||||
}
|
||||
Node* generate_access_flags_guard(Node* kls,
|
||||
int modifier_mask, int modifier_bits,
|
||||
RegionNode* region);
|
||||
Node* generate_klass_flags_guard(Node* kls, int modifier_mask, int modifier_bits, RegionNode* region,
|
||||
ByteSize offset, const Type* type, BasicType bt);
|
||||
Node* generate_misc_flags_guard(Node* kls,
|
||||
int modifier_mask, int modifier_bits,
|
||||
RegionNode* region);
|
||||
Node* generate_interface_guard(Node* kls, RegionNode* region);
|
||||
Node* generate_hidden_class_guard(Node* kls, RegionNode* region);
|
||||
Node* generate_array_guard(Node* kls, RegionNode* region) {
|
||||
|
||||
@ -1981,6 +1981,12 @@ LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
|
||||
assert(this->Opcode() == Op_LoadI, "must load an int from _access_flags");
|
||||
return TypeInt::make(klass->access_flags());
|
||||
}
|
||||
if (tkls->offset() == in_bytes(Klass::misc_flags_offset())) {
|
||||
// The field is Klass::_misc_flags. Return its (constant) value.
|
||||
// (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).)
|
||||
assert(this->Opcode() == Op_LoadUB, "must load an unsigned byte from _misc_flags");
|
||||
return TypeInt::make(klass->misc_flags());
|
||||
}
|
||||
if (tkls->offset() == in_bytes(Klass::layout_helper_offset())) {
|
||||
// The field is Klass::_layout_helper. Return its constant value if known.
|
||||
assert(this->Opcode() == Op_LoadI, "must load an int from _layout_helper");
|
||||
|
||||
@ -2123,10 +2123,10 @@ void Parse::call_register_finalizer() {
|
||||
Node* klass_addr = basic_plus_adr( receiver, receiver, oopDesc::klass_offset_in_bytes() );
|
||||
Node* klass = _gvn.transform(LoadKlassNode::make(_gvn, nullptr, immutable_memory(), klass_addr, TypeInstPtr::KLASS));
|
||||
|
||||
Node* access_flags_addr = basic_plus_adr(klass, klass, in_bytes(Klass::access_flags_offset()));
|
||||
Node* access_flags = make_load(nullptr, access_flags_addr, TypeInt::INT, T_INT, MemNode::unordered);
|
||||
Node* access_flags_addr = basic_plus_adr(klass, klass, in_bytes(Klass::misc_flags_offset()));
|
||||
Node* access_flags = make_load(nullptr, access_flags_addr, TypeInt::UBYTE, T_BOOLEAN, MemNode::unordered);
|
||||
|
||||
Node* mask = _gvn.transform(new AndINode(access_flags, intcon(JVM_ACC_HAS_FINALIZER)));
|
||||
Node* mask = _gvn.transform(new AndINode(access_flags, intcon(KlassFlags::_misc_has_finalizer)));
|
||||
Node* check = _gvn.transform(new CmpINode(mask, intcon(0)));
|
||||
Node* test = _gvn.transform(new BoolNode(check, BoolTest::ne));
|
||||
|
||||
|
||||
@ -2015,8 +2015,6 @@
|
||||
/************************************************************/ \
|
||||
\
|
||||
declare_constant(JVM_ACC_WRITTEN_FLAGS) \
|
||||
declare_constant(JVM_ACC_HAS_FINALIZER) \
|
||||
declare_constant(JVM_ACC_IS_CLONEABLE_FAST) \
|
||||
\
|
||||
declare_constant(JVM_CONSTANT_Utf8) \
|
||||
declare_constant(JVM_CONSTANT_Unicode) \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -40,14 +40,7 @@ enum {
|
||||
// flags actually put in .class file
|
||||
JVM_ACC_WRITTEN_FLAGS = 0x00007FFF,
|
||||
|
||||
// HotSpot-specific access flags
|
||||
// These Klass flags should be migrated, to a field such as InstanceKlass::_misc_flags,
|
||||
// or to a similar flags field in Klass itself.
|
||||
// Do not add new ACC flags here.
|
||||
JVM_ACC_HAS_FINALIZER = 0x40000000, // True if klass has a non-empty finalize() method
|
||||
JVM_ACC_IS_CLONEABLE_FAST = (int)0x80000000,// True if klass implements the Cloneable interface and can be optimized in generated code
|
||||
JVM_ACC_IS_HIDDEN_CLASS = 0x04000000, // True if klass is hidden
|
||||
JVM_ACC_IS_VALUE_BASED_CLASS = 0x08000000, // True if klass is marked as a ValueBased class
|
||||
};
|
||||
|
||||
|
||||
@ -77,12 +70,6 @@ class AccessFlags {
|
||||
// Attribute flags
|
||||
bool is_synthetic () const { return (_flags & JVM_ACC_SYNTHETIC ) != 0; }
|
||||
|
||||
// Klass* flags
|
||||
bool has_finalizer () const { return (_flags & JVM_ACC_HAS_FINALIZER ) != 0; }
|
||||
bool is_cloneable_fast () const { return (_flags & JVM_ACC_IS_CLONEABLE_FAST ) != 0; }
|
||||
bool is_hidden_class () const { return (_flags & JVM_ACC_IS_HIDDEN_CLASS ) != 0; }
|
||||
bool is_value_based_class () const { return (_flags & JVM_ACC_IS_VALUE_BASED_CLASS ) != 0; }
|
||||
|
||||
// get .class file flags
|
||||
jint get_flags () const { return (_flags & JVM_ACC_WRITTEN_FLAGS); }
|
||||
|
||||
@ -102,13 +89,6 @@ class AccessFlags {
|
||||
// attribute flags
|
||||
void set_is_synthetic() { _flags |= JVM_ACC_SYNTHETIC; }
|
||||
|
||||
// Klass* flags
|
||||
// These are set at classfile parsing time so do not require atomic access.
|
||||
void set_has_finalizer() { _flags |= JVM_ACC_HAS_FINALIZER; }
|
||||
void set_is_cloneable_fast() { _flags |= JVM_ACC_IS_CLONEABLE_FAST; }
|
||||
void set_is_hidden_class() { _flags |= JVM_ACC_IS_HIDDEN_CLASS; }
|
||||
void set_is_value_based_class() { _flags |= JVM_ACC_IS_VALUE_BASED_CLASS; }
|
||||
|
||||
public:
|
||||
// Conversion
|
||||
jshort as_short() const { return (jshort)_flags; }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -56,10 +56,6 @@ public class AccessFlags implements /* imports */ ClassConstants {
|
||||
|
||||
public long getValue () { return flags; }
|
||||
|
||||
// Klass* flags
|
||||
public boolean hasFinalizer () { return (flags & JVM_ACC_HAS_FINALIZER ) != 0; }
|
||||
public boolean isCloneable () { return (flags & JVM_ACC_IS_CLONEABLE ) != 0; }
|
||||
|
||||
public void printOn(PrintStream tty) {
|
||||
// prints only .class flags and not the hotspot internal flags
|
||||
if (isPublic ()) tty.print("public " );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -230,6 +230,4 @@ public class Klass extends Metadata implements ClassConstants {
|
||||
public boolean isAbstract() { return getAccessFlagsObj().isAbstract(); }
|
||||
public boolean isSuper() { return getAccessFlagsObj().isSuper(); }
|
||||
public boolean isSynthetic() { return getAccessFlagsObj().isSynthetic(); }
|
||||
public boolean hasFinalizer() { return getAccessFlagsObj().hasFinalizer(); }
|
||||
public boolean isCloneable() { return getAccessFlagsObj().isCloneable(); }
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -103,12 +103,6 @@ public interface ClassConstants
|
||||
// flags actually put in .class file
|
||||
public static final long JVM_ACC_WRITTEN_FLAGS = 0x00007FFF;
|
||||
|
||||
// Klass* flags
|
||||
// True if klass has a non-empty finalize() method
|
||||
public static final long JVM_ACC_HAS_FINALIZER = 0x40000000;
|
||||
// True if klass supports the Clonable interface
|
||||
public static final long JVM_ACC_IS_CLONEABLE = 0x80000000;
|
||||
|
||||
// flags accepted by set_field_flags
|
||||
public static final long JVM_ACC_FIELD_FLAGS = 0x00008000 | JVM_ACC_WRITTEN_FLAGS;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
@ -170,6 +170,11 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem
|
||||
return UNSAFE.getInt(getKlassPointer() + config.klassAccessFlagsOffset);
|
||||
}
|
||||
|
||||
public int getMiscFlags() {
|
||||
HotSpotVMConfig config = config();
|
||||
return UNSAFE.getInt(getKlassPointer() + config.klassMiscFlagsOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResolvedJavaType getComponentType() {
|
||||
if (componentType == null) {
|
||||
@ -373,7 +378,7 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem
|
||||
|
||||
@Override
|
||||
public boolean hasFinalizer() {
|
||||
return (getAccessFlags() & config().jvmAccHasFinalizer) != 0;
|
||||
return (getMiscFlags() & config().jvmAccHasFinalizer) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1110,7 +1115,7 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem
|
||||
|
||||
@Override
|
||||
public boolean isCloneableWithAllocation() {
|
||||
return (getAccessFlags() & config().jvmAccIsCloneableFast) != 0;
|
||||
return (getMiscFlags() & config().jvmAccIsCloneableFast) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -98,6 +98,7 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess {
|
||||
final int instanceKlassFieldInfoStreamOffset = getFieldOffset("InstanceKlass::_fieldinfo_stream", Integer.class, "Array<u1>*");
|
||||
final int instanceKlassAnnotationsOffset = getFieldOffset("InstanceKlass::_annotations", Integer.class, "Annotations*");
|
||||
final int instanceKlassMiscFlagsOffset = getFieldOffset("InstanceKlass::_misc_flags._flags", Integer.class, "u2");
|
||||
final int klassMiscFlagsOffset = getFieldOffset("Klass::_misc_flags._flags", Integer.class, "u1");
|
||||
final int klassVtableStartOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_start_offset", Integer.class, "int");
|
||||
final int klassVtableLengthOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_length_offset", Integer.class, "int");
|
||||
|
||||
@ -113,10 +114,10 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess {
|
||||
final int arrayU1DataOffset = getFieldOffset("Array<u1>::_data", Integer.class);
|
||||
final int arrayU2DataOffset = getFieldOffset("Array<u2>::_data", Integer.class);
|
||||
|
||||
final int jvmAccHasFinalizer = getConstant("JVM_ACC_HAS_FINALIZER", Integer.class);
|
||||
final int jvmAccHasFinalizer = getConstant("KlassFlags::_misc_has_finalizer", Integer.class);
|
||||
final int jvmFieldFlagInternalShift = getConstant("FieldInfo::FieldFlags::_ff_injected", Integer.class);
|
||||
final int jvmFieldFlagStableShift = getConstant("FieldInfo::FieldFlags::_ff_stable", Integer.class);
|
||||
final int jvmAccIsCloneableFast = getConstant("JVM_ACC_IS_CLONEABLE_FAST", Integer.class);
|
||||
final int jvmAccIsCloneableFast = getConstant("KlassFlags::_misc_is_cloneable_fast", Integer.class);
|
||||
|
||||
// These modifiers are not public in Modifier so we get them via vmStructs.
|
||||
final int jvmAccSynthetic = getConstant("JVM_ACC_SYNTHETIC", Integer.class);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user