8245289: Clean up offset code in JavaClasses

Make offset member names consistent and private, move static initializations near owning classes

Reviewed-by: fparain, lfoltan
This commit is contained in:
Coleen Phillimore 2020-05-29 15:00:19 -04:00
parent e639c9a840
commit 5314d28f84
36 changed files with 789 additions and 843 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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.
*
@ -47,7 +47,7 @@ void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_
if (VerifyMethodHandles)
verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
"MH argument is a Class");
__ ldr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes()));
__ ldr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset()));
}
#ifdef ASSERT
@ -135,13 +135,13 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
// Load the invoker, as MH -> MH.form -> LF.vmentry
__ verify_oop(recv);
__ load_heap_oop(method_temp, Address(recv, NONZERO(java_lang_invoke_MethodHandle::form_offset_in_bytes())), temp2);
__ load_heap_oop(method_temp, Address(recv, NONZERO(java_lang_invoke_MethodHandle::form_offset())), temp2);
__ verify_oop(method_temp);
__ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes())), temp2);
__ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset())), temp2);
__ verify_oop(method_temp);
__ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes())), temp2);
__ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_MemberName::method_offset())), temp2);
__ verify_oop(method_temp);
__ access_load_at(T_ADDRESS, IN_HEAP, method_temp, Address(method_temp, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes())), noreg, noreg);
__ access_load_at(T_ADDRESS, IN_HEAP, method_temp, Address(method_temp, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset())), noreg, noreg);
if (VerifyMethodHandles && !for_compiler_entry) {
// make sure recv is already on stack
@ -283,10 +283,10 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
"MemberName required for invokeVirtual etc.");
}
Address member_clazz( member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()));
Address member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset_in_bytes()));
Address member_vmtarget( member_reg, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes()));
Address vmtarget_method( rmethod, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes()));
Address member_clazz( member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset()));
Address member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset()));
Address member_vmtarget( member_reg, NONZERO(java_lang_invoke_MemberName::method_offset()));
Address vmtarget_method( rmethod, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset()));
Register temp1_recv_klass = temp1;
if (iid != vmIntrinsics::_linkToStatic) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2019, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -939,8 +939,7 @@ address TemplateInterpreterGenerator::generate_Reference_get_entry(void) {
address entry = __ pc();
const int referent_offset = java_lang_ref_Reference::referent_offset;
guarantee(referent_offset > 0, "referent offset not initialized");
const int referent_offset = java_lang_ref_Reference::referent_offset();
Label slow_path;
const Register local_0 = c_rarg0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2020, 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
@ -311,7 +311,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
assert(_obj != noreg, "must be a valid register");
// Rtemp should be OK in C1
__ ldr(Rtemp, Address(_obj, java_lang_Class::klass_offset_in_bytes()));
__ ldr(Rtemp, Address(_obj, java_lang_Class::klass_offset()));
__ ldr(Rtemp, Address(Rtemp, InstanceKlass::init_thread_offset()));
__ cmp(Rtemp, Rthread);
__ b(call_patch, ne);

View File

@ -53,7 +53,7 @@ void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_
verify_klass(_masm, klass_reg, temp1, temp2, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
"MH argument is a Class");
}
__ ldr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes()));
__ ldr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset()));
}
#ifdef ASSERT
@ -95,7 +95,7 @@ void MethodHandles::verify_klass(MacroAssembler* _masm,
void MethodHandles::verify_ref_kind(MacroAssembler* _masm, int ref_kind, Register member_reg, Register temp) {
Label L;
BLOCK_COMMENT("verify_ref_kind {");
__ ldr_u32(temp, Address(member_reg, NONZERO(java_lang_invoke_MemberName::flags_offset_in_bytes())));
__ ldr_u32(temp, Address(member_reg, NONZERO(java_lang_invoke_MemberName::flags_offset())));
__ logical_shift_right(temp, temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_SHIFT);
__ andr(temp, temp, (unsigned)java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK);
__ cmp(temp, ref_kind);
@ -148,15 +148,15 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
assert_different_registers(recv, tmp, Rmethod);
// Load the invoker, as MH -> MH.form -> LF.vmentry
__ load_heap_oop(tmp, Address(recv, NONZERO(java_lang_invoke_MethodHandle::form_offset_in_bytes())));
__ load_heap_oop(tmp, Address(recv, NONZERO(java_lang_invoke_MethodHandle::form_offset())));
__ verify_oop(tmp);
__ load_heap_oop(tmp, Address(tmp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes())));
__ load_heap_oop(tmp, Address(tmp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset())));
__ verify_oop(tmp);
__ load_heap_oop(Rmethod, Address(tmp, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes())));
__ load_heap_oop(Rmethod, Address(tmp, NONZERO(java_lang_invoke_MemberName::method_offset())));
__ verify_oop(Rmethod);
__ access_load_at(T_ADDRESS, IN_HEAP, Address(Rmethod, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes())), Rmethod, noreg, noreg, noreg);
__ access_load_at(T_ADDRESS, IN_HEAP, Address(Rmethod, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset())), Rmethod, noreg, noreg, noreg);
if (VerifyMethodHandles && !for_compiler_entry) {
// make sure recv is already on stack
@ -305,10 +305,10 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
"MemberName required for invokeVirtual etc.");
}
Address member_clazz( member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()));
Address member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset_in_bytes()));
Address member_vmtarget(member_reg, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes()));
Address vmtarget_method(Rmethod, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes()));
Address member_clazz( member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset()));
Address member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset()));
Address member_vmtarget(member_reg, NONZERO(java_lang_invoke_MemberName::method_offset()));
Address vmtarget_method(Rmethod, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset()));
Register temp1_recv_klass = temp1;
if (iid != vmIntrinsics::_linkToStatic) {
@ -532,9 +532,7 @@ void trace_method_handle_stub(const char* adaptername,
if (has_mh && oopDesc::is_oop(mh)) {
mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) {
java_lang_invoke_MethodHandle::form(mh)->print();
}
java_lang_invoke_MethodHandle::form(mh)->print();
}
}
}

View File

@ -708,8 +708,7 @@ address TemplateInterpreterGenerator::generate_Reference_get_entry(void) {
const Register Rret_addr = Rtmp_save1;
assert_different_registers(Rthis, Rret_addr, Rsender_sp);
const int referent_offset = java_lang_ref_Reference::referent_offset;
guarantee(referent_offset > 0, "referent offset not initialized");
const int referent_offset = java_lang_ref_Reference::referent_offset();
// Check if local 0 != NULL
// If the receiver is null then it is OK to jump to the slow path.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -361,7 +361,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
assert(_obj != noreg, "must be a valid register");
assert(_index >= 0, "must have oop index");
__ mr(R0, _obj); // spill
__ ld(_obj, java_lang_Class::klass_offset_in_bytes(), _obj);
__ ld(_obj, java_lang_Class::klass_offset(), _obj);
__ ld(_obj, in_bytes(InstanceKlass::init_thread_offset()), _obj);
__ cmpd(CCR0, _obj, R16_thread);
__ mr(_obj, R0); // restore

View File

@ -56,7 +56,7 @@ void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_
verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
temp_reg, temp2_reg, "MH argument is a Class");
}
__ ld(klass_reg, java_lang_Class::klass_offset_in_bytes(), klass_reg);
__ ld(klass_reg, java_lang_Class::klass_offset(), klass_reg);
}
#ifdef ASSERT
@ -98,7 +98,7 @@ void MethodHandles::verify_klass(MacroAssembler* _masm,
void MethodHandles::verify_ref_kind(MacroAssembler* _masm, int ref_kind, Register member_reg, Register temp) {
Label L;
BLOCK_COMMENT("verify_ref_kind {");
__ load_sized_value(temp, NONZERO(java_lang_invoke_MemberName::flags_offset_in_bytes()), member_reg,
__ load_sized_value(temp, NONZERO(java_lang_invoke_MemberName::flags_offset()), member_reg,
sizeof(u4), /*is_signed*/ false);
// assert(sizeof(u4) == sizeof(java.lang.invoke.MemberName.flags), "");
__ srwi( temp, temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_SHIFT);
@ -174,16 +174,16 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
// Load the invoker, as MH -> MH.form -> LF.vmentry
__ verify_oop(recv, FILE_AND_LINE);
__ load_heap_oop(method_temp, NONZERO(java_lang_invoke_MethodHandle::form_offset_in_bytes()), recv,
__ load_heap_oop(method_temp, NONZERO(java_lang_invoke_MethodHandle::form_offset()), recv,
temp2, noreg, false, IS_NOT_NULL);
__ verify_oop(method_temp, FILE_AND_LINE);
__ load_heap_oop(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes()), method_temp,
__ load_heap_oop(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset()), method_temp,
temp2, noreg, false, IS_NOT_NULL);
__ verify_oop(method_temp, FILE_AND_LINE);
__ load_heap_oop(method_temp, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes()), method_temp,
__ load_heap_oop(method_temp, NONZERO(java_lang_invoke_MemberName::method_offset()), method_temp,
temp2, noreg, false, IS_NOT_NULL);
__ verify_oop(method_temp, FILE_AND_LINE);
__ ld(method_temp, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes()), method_temp);
__ ld(method_temp, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset()), method_temp);
if (VerifyMethodHandles && !for_compiler_entry) {
// Make sure recv is already on stack.
@ -342,7 +342,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
if (VerifyMethodHandles && iid != vmIntrinsics::_linkToInterface) {
Label L_ok;
Register temp2_defc = temp2;
__ load_heap_oop(temp2_defc, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()), member_reg,
__ load_heap_oop(temp2_defc, NONZERO(java_lang_invoke_MemberName::clazz_offset()), member_reg,
temp3, noreg, false, IS_NOT_NULL);
load_klass_from_Class(_masm, temp2_defc, temp3, temp4);
__ verify_klass_ptr(temp2_defc);
@ -370,18 +370,18 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
if (VerifyMethodHandles) {
verify_ref_kind(_masm, JVM_REF_invokeSpecial, member_reg, temp2);
}
__ load_heap_oop(R19_method, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes()), member_reg,
__ load_heap_oop(R19_method, NONZERO(java_lang_invoke_MemberName::method_offset()), member_reg,
temp3, noreg, false, IS_NOT_NULL);
__ ld(R19_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes()), R19_method);
__ ld(R19_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset()), R19_method);
break;
case vmIntrinsics::_linkToStatic:
if (VerifyMethodHandles) {
verify_ref_kind(_masm, JVM_REF_invokeStatic, member_reg, temp2);
}
__ load_heap_oop(R19_method, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes()), member_reg,
__ load_heap_oop(R19_method, NONZERO(java_lang_invoke_MemberName::method_offset()), member_reg,
temp3, noreg, false, IS_NOT_NULL);
__ ld(R19_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes()), R19_method);
__ ld(R19_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset()), R19_method);
break;
case vmIntrinsics::_linkToVirtual:
@ -395,7 +395,7 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
// pick out the vtable index from the MemberName, and then we can discard it:
Register temp2_index = temp2;
__ ld(temp2_index, NONZERO(java_lang_invoke_MemberName::vmindex_offset_in_bytes()), member_reg);
__ ld(temp2_index, NONZERO(java_lang_invoke_MemberName::vmindex_offset()), member_reg);
if (VerifyMethodHandles) {
Label L_index_ok;
@ -422,13 +422,13 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
}
Register temp2_intf = temp2;
__ load_heap_oop(temp2_intf, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()), member_reg,
__ load_heap_oop(temp2_intf, NONZERO(java_lang_invoke_MemberName::clazz_offset()), member_reg,
temp3, noreg, false, IS_NOT_NULL);
load_klass_from_Class(_masm, temp2_intf, temp3, temp4);
__ verify_klass_ptr(temp2_intf);
Register vtable_index = R19_method;
__ ld(vtable_index, NONZERO(java_lang_invoke_MemberName::vmindex_offset_in_bytes()), member_reg);
__ ld(vtable_index, NONZERO(java_lang_invoke_MemberName::vmindex_offset()), member_reg);
if (VerifyMethodHandles) {
Label L_index_ok;
__ cmpdi(CCR1, vtable_index, 0);
@ -538,9 +538,7 @@ void trace_method_handle_stub(const char* adaptername,
if (has_mh && oopDesc::is_oop(mh)) {
mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) {
java_lang_invoke_MethodHandle::form(mh)->print();
}
java_lang_invoke_MethodHandle::form(mh)->print();
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019, SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -507,8 +507,7 @@ address TemplateInterpreterGenerator::generate_Reference_get_entry(void) {
address entry = __ pc();
const int referent_offset = java_lang_ref_Reference::referent_offset;
guarantee(referent_offset > 0, "referent offset not initialized");
const int referent_offset = java_lang_ref_Reference::referent_offset();
Label slow_path;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -353,7 +353,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
// thread.
assert(_obj != noreg, "must be a valid register");
assert(_index >= 0, "must have oop index");
__ z_lg(Z_R1_scratch, java_lang_Class::klass_offset_in_bytes(), _obj);
__ z_lg(Z_R1_scratch, java_lang_Class::klass_offset(), _obj);
__ z_cg(Z_thread, Address(Z_R1_scratch, InstanceKlass::init_thread_offset()));
__ branch_optimized(Assembler::bcondNotEqual, call_patch);

View File

@ -56,7 +56,7 @@ void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_
verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
temp_reg, temp2_reg, "MH argument is a Class");
}
__ z_lg(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes()));
__ z_lg(klass_reg, Address(klass_reg, java_lang_Class::klass_offset()));
}
@ -111,7 +111,7 @@ void MethodHandles::verify_ref_kind(MacroAssembler* _masm, int ref_kind,
__ z_llgf(temp,
Address(member_reg,
NONZERO(java_lang_invoke_MemberName::flags_offset_in_bytes())));
NONZERO(java_lang_invoke_MemberName::flags_offset())));
__ z_srl(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_SHIFT);
__ z_nilf(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK);
__ compare32_and_branch(temp, constant(ref_kind), Assembler::bcondEqual, L);
@ -198,22 +198,22 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
__ verify_oop(recv, FILE_AND_LINE);
__ load_heap_oop(method_temp,
Address(recv,
NONZERO(java_lang_invoke_MethodHandle::form_offset_in_bytes())),
NONZERO(java_lang_invoke_MethodHandle::form_offset())),
noreg, noreg, IS_NOT_NULL);
__ verify_oop(method_temp, FILE_AND_LINE);
__ load_heap_oop(method_temp,
Address(method_temp,
NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes())),
NONZERO(java_lang_invoke_LambdaForm::vmentry_offset())),
noreg, noreg, IS_NOT_NULL);
__ verify_oop(method_temp, FILE_AND_LINE);
__ load_heap_oop(method_temp,
Address(method_temp,
NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes())),
NONZERO(java_lang_invoke_MemberName::method_offset())),
noreg, noreg, IS_NOT_NULL);
__ verify_oop(method_temp, FILE_AND_LINE);
__ z_lg(method_temp,
Address(method_temp,
NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes())));
NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset())));
if (VerifyMethodHandles && !for_compiler_entry) {
// Make sure recv is already on stack.
@ -379,10 +379,10 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
"MemberName required for invokeVirtual etc.");
}
Address member_clazz( member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()));
Address member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset_in_bytes()));
Address member_vmtarget(member_reg, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes()));
Address vmtarget_method(Z_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes()));
Address member_clazz( member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset()));
Address member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset()));
Address member_vmtarget(member_reg, NONZERO(java_lang_invoke_MemberName::method_offset()));
Address vmtarget_method(Z_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset()));
Register temp1_recv_klass = temp1;
if (iid != vmIntrinsics::_linkToStatic) {
@ -608,9 +608,7 @@ void trace_method_handle_stub(const char* adaptername,
if (has_mh && oopDesc::is_oop(mh)) {
mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) {
java_lang_invoke_MethodHandle::form(mh)->print();
}
java_lang_invoke_MethodHandle::form(mh)->print();
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -502,8 +502,7 @@ address TemplateInterpreterGenerator::generate_Reference_get_entry(void) {
Label slow_path;
address entry = __ pc();
const int referent_offset = java_lang_ref_Reference::referent_offset;
guarantee(referent_offset > 0, "referent offset not initialized");
const int referent_offset = java_lang_ref_Reference::referent_offset();
BLOCK_COMMENT("Reference_get {");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -361,7 +361,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
__ push(tmp2);
// Load without verification to keep code size small. We need it because
// begin_initialized_entry_offset has to fit in a byte. Also, we know it's not null.
__ movptr(tmp2, Address(_obj, java_lang_Class::klass_offset_in_bytes()));
__ movptr(tmp2, Address(_obj, java_lang_Class::klass_offset()));
__ get_thread(tmp);
__ cmpptr(tmp, Address(tmp2, InstanceKlass::init_thread_offset()));
__ pop(tmp2);

View File

@ -53,7 +53,7 @@ void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_
if (VerifyMethodHandles)
verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
"MH argument is a Class");
__ movptr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes()));
__ movptr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset()));
}
#ifdef ASSERT
@ -100,7 +100,7 @@ void MethodHandles::verify_klass(MacroAssembler* _masm,
void MethodHandles::verify_ref_kind(MacroAssembler* _masm, int ref_kind, Register member_reg, Register temp) {
Label L;
BLOCK_COMMENT("verify_ref_kind {");
__ movl(temp, Address(member_reg, NONZERO(java_lang_invoke_MemberName::flags_offset_in_bytes())));
__ movl(temp, Address(member_reg, NONZERO(java_lang_invoke_MemberName::flags_offset())));
__ shrl(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_SHIFT);
__ andl(temp, java_lang_invoke_MemberName::MN_REFERENCE_KIND_MASK);
__ cmpl(temp, ref_kind);
@ -171,14 +171,14 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
// Load the invoker, as MH -> MH.form -> LF.vmentry
__ verify_oop(recv);
__ load_heap_oop(method_temp, Address(recv, NONZERO(java_lang_invoke_MethodHandle::form_offset_in_bytes())), temp2);
__ load_heap_oop(method_temp, Address(recv, NONZERO(java_lang_invoke_MethodHandle::form_offset())), temp2);
__ verify_oop(method_temp);
__ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes())), temp2);
__ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset())), temp2);
__ verify_oop(method_temp);
__ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes())), temp2);
__ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_MemberName::method_offset())), temp2);
__ verify_oop(method_temp);
__ access_load_at(T_ADDRESS, IN_HEAP, method_temp,
Address(method_temp, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes())),
Address(method_temp, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset())),
noreg, noreg);
if (VerifyMethodHandles && !for_compiler_entry) {
@ -338,10 +338,10 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
"MemberName required for invokeVirtual etc.");
}
Address member_clazz( member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()));
Address member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset_in_bytes()));
Address member_vmtarget( member_reg, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes()));
Address vmtarget_method( rbx_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes()));
Address member_clazz( member_reg, NONZERO(java_lang_invoke_MemberName::clazz_offset()));
Address member_vmindex( member_reg, NONZERO(java_lang_invoke_MemberName::vmindex_offset()));
Address member_vmtarget( member_reg, NONZERO(java_lang_invoke_MemberName::method_offset()));
Address vmtarget_method( rbx_method, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset()));
Register temp1_recv_klass = temp1;
if (iid != vmIntrinsics::_linkToStatic) {
@ -581,9 +581,7 @@ void trace_method_handle_stub(const char* adaptername,
if (has_mh && oopDesc::is_oop(mh)) {
mh->print();
if (java_lang_invoke_MethodHandle::is_instance(mh)) {
if (java_lang_invoke_MethodHandle::form_offset_in_bytes() != 0) {
java_lang_invoke_MethodHandle::form(mh)->print();
}
java_lang_invoke_MethodHandle::form(mh)->print();
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@ -718,8 +718,7 @@ address TemplateInterpreterGenerator::generate_Reference_get_entry(void) {
address entry = __ pc();
const int referent_offset = java_lang_ref_Reference::referent_offset;
guarantee(referent_offset > 0, "referent offset not initialized");
const int referent_offset = java_lang_ref_Reference::referent_offset();
Label slow_path;
// rbx: method

View File

@ -1220,8 +1220,7 @@ void LIRGenerator::do_Return(Return* x) {
// Combination of LoadField and g1 pre-write barrier
void LIRGenerator::do_Reference_get(Intrinsic* x) {
const int referent_offset = java_lang_ref_Reference::referent_offset;
guarantee(referent_offset > 0, "referent offset not initialized");
const int referent_offset = java_lang_ref_Reference::referent_offset();
assert(x->number_of_arguments() == 1, "wrong type");
@ -1307,7 +1306,7 @@ void LIRGenerator::do_isPrimitive(Intrinsic* x) {
info = state_for(x);
}
__ move(new LIR_Address(rcvr.result(), java_lang_Class::klass_offset_in_bytes(), T_ADDRESS), temp, info);
__ move(new LIR_Address(rcvr.result(), java_lang_Class::klass_offset(), T_ADDRESS), temp, info);
__ cmp(lir_cond_notEqual, temp, LIR_OprFact::metadataConst(0));
__ cmove(lir_cond_notEqual, LIR_OprFact::intConst(0), LIR_OprFact::intConst(1), result, T_BOOLEAN);
}
@ -2954,7 +2953,7 @@ void LIRGenerator::do_ClassIDIntrinsic(Intrinsic* x) {
arg.load_item();
LIR_Opr klass = new_register(T_METADATA);
__ move(new LIR_Address(arg.result(), java_lang_Class::klass_offset_in_bytes(), T_ADDRESS), klass, info);
__ move(new LIR_Address(arg.result(), java_lang_Class::klass_offset(), T_ADDRESS), klass, info);
LIR_Opr id = new_register(T_LONG);
ByteSize offset = KLASS_TRACE_ID_OFFSET;
LIR_Address* trace_id_addr = new LIR_Address(klass, in_bytes(offset), T_LONG);

View File

@ -265,9 +265,9 @@ void ciField::initialize_from(fieldDescriptor* fd) {
assert(SystemDictionary::System_klass() != NULL, "Check once per vm");
if (k == SystemDictionary::System_klass()) {
// Check offsets for case 2: System.in, System.out, or System.err
if( _offset == java_lang_System::in_offset_in_bytes() ||
_offset == java_lang_System::out_offset_in_bytes() ||
_offset == java_lang_System::err_offset_in_bytes() ) {
if (_offset == java_lang_System::in_offset() ||
_offset == java_lang_System::out_offset() ||
_offset == java_lang_System::err_offset()) {
_is_constant = false;
return;
}
@ -283,7 +283,7 @@ void ciField::initialize_from(fieldDescriptor* fd) {
// For CallSite objects treat the target field as a compile time constant.
assert(SystemDictionary::CallSite_klass() != NULL, "should be already initialized");
if (k == SystemDictionary::CallSite_klass() &&
_offset == java_lang_invoke_CallSite::target_offset_in_bytes()) {
_offset == java_lang_invoke_CallSite::target_offset()) {
assert(!has_initialized_final_update(), "CallSite is not supposed to have writes to final fields outside initializers");
_is_constant = true;
} else {

View File

@ -274,7 +274,7 @@ bool ciInstanceKlass::is_box_klass() const {
bool ciInstanceKlass::is_boxed_value_offset(int offset) const {
BasicType bt = box_klass_type();
return is_java_primitive(bt) &&
(offset == java_lang_boxing_object::value_offset_in_bytes(bt));
(offset == java_lang_boxing_object::value_offset(bt));
}
// ------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -80,6 +80,8 @@ class RecordComponent;
BASIC_JAVA_CLASSES_DO_PART1(f) \
BASIC_JAVA_CLASSES_DO_PART2(f)
#define CHECK_INIT(offset) assert(offset != 0, "should be initialized"); return offset;
// Interface to java.lang.Object objects
class java_lang_Object : AllStatic {
@ -91,12 +93,12 @@ class java_lang_Object : AllStatic {
class java_lang_String : AllStatic {
private:
static int value_offset;
static int hash_offset;
static int hashIsZero_offset;
static int coder_offset;
static int _value_offset;
static int _hash_offset;
static int _hashIsZero_offset;
static int _coder_offset;
static bool initialized;
static bool _initialized;
static Handle basic_create(int length, bool byte_arr, TRAPS);
@ -124,22 +126,8 @@ class java_lang_String : AllStatic {
static void set_compact_strings(bool value);
static int value_offset_in_bytes() {
assert(initialized && (value_offset > 0), "Must be initialized");
return value_offset;
}
static int hash_offset_in_bytes() {
assert(initialized && (hash_offset > 0), "Must be initialized");
return hash_offset;
}
static int hashIsZero_offset_in_bytes() {
assert(initialized && (hashIsZero_offset > 0), "Must be initialized");
return hashIsZero_offset;
}
static int coder_offset_in_bytes() {
assert(initialized && (coder_offset > 0), "Must be initialized");
return coder_offset;
}
static int value_offset() { CHECK_INIT(_value_offset); }
static int coder_offset() { CHECK_INIT(_coder_offset); }
static inline void set_value_raw(oop string, typeArrayOop buffer);
static inline void set_value(oop string, typeArrayOop buffer);
@ -237,6 +225,7 @@ class java_lang_Class : AllStatic {
friend class JVMCIVMStructs;
private:
// The fake offsets are added by the class loader when java.lang.Class is loaded
static int _klass_offset;
@ -254,9 +243,9 @@ class java_lang_Class : AllStatic {
static int _name_offset;
static int _source_file_offset;
static int _classData_offset;
static int _classRedefinedCount_offset;
static bool offsets_computed;
static int classRedefinedCount_offset;
static bool _offsets_computed;
static GrowableArray<Klass*>* _fixup_mirror_list;
static GrowableArray<Klass*>* _fixup_module_field_list;
@ -310,8 +299,8 @@ class java_lang_Class : AllStatic {
static Klass* array_klass_acquire(oop java_class);
static void release_set_array_klass(oop java_class, Klass* klass);
// compiler support for class operations
static int klass_offset_in_bytes() { return _klass_offset; }
static int array_klass_offset_in_bytes() { return _array_klass_offset; }
static int klass_offset() { CHECK_INIT(_klass_offset); }
static int array_klass_offset() { CHECK_INIT(_array_klass_offset); }
// Support for classRedefinedCount field
static int classRedefinedCount(oop the_class_mirror);
static void set_classRedefinedCount(oop the_class_mirror, int value);
@ -319,6 +308,9 @@ class java_lang_Class : AllStatic {
// Support for embedded per-class oops
static oop protection_domain(oop java_class);
static oop init_lock(oop java_class);
static void clear_init_lock(oop java_class) {
set_init_lock(java_class, NULL);
}
static oop component_mirror(oop java_class);
static objArrayOop signers(oop java_class);
static void set_signers(oop java_class, objArrayOop signers);
@ -357,8 +349,6 @@ class java_lang_Class : AllStatic {
// Debugging
friend class JavaClasses;
friend class InstanceKlass; // verification code accesses offsets
friend class ClassFileParser; // access to number_of_fake_fields
};
// Interface to java.lang.Thread objects
@ -529,11 +519,11 @@ class java_lang_Throwable: AllStatic {
trace_chunk_size = 32
};
static int backtrace_offset;
static int detailMessage_offset;
static int stackTrace_offset;
static int depth_offset;
static int static_unassigned_stacktrace_offset;
static int _backtrace_offset;
static int _detailMessage_offset;
static int _stackTrace_offset;
static int _depth_offset;
static int _static_unassigned_stacktrace_offset;
// StackTrace (programmatic access, new since 1.4)
static void clear_stacktrace(oop throwable);
@ -547,9 +537,7 @@ class java_lang_Throwable: AllStatic {
static void set_backtrace(oop throwable, oop value);
static int depth(oop throwable);
static void set_depth(oop throwable, int value);
// Needed by JVMTI to filter out this internal field.
static int get_backtrace_offset() { return backtrace_offset;}
static int get_detailMessage_offset() { return detailMessage_offset;}
static int get_detailMessage_offset() { CHECK_INIT(_detailMessage_offset); }
// Message
static oop message(oop throwable);
static void set_message(oop throwable, oop value);
@ -586,7 +574,7 @@ class java_lang_reflect_AccessibleObject: AllStatic {
private:
// Note that to reduce dependencies on the JDK we compute these
// offsets at run-time.
static int override_offset;
static int _override_offset;
static void compute_offsets();
@ -608,17 +596,17 @@ class java_lang_reflect_Method : public java_lang_reflect_AccessibleObject {
private:
// Note that to reduce dependencies on the JDK we compute these
// offsets at run-time.
static int clazz_offset;
static int name_offset;
static int returnType_offset;
static int parameterTypes_offset;
static int exceptionTypes_offset;
static int slot_offset;
static int modifiers_offset;
static int signature_offset;
static int annotations_offset;
static int parameter_annotations_offset;
static int annotation_default_offset;
static int _clazz_offset;
static int _name_offset;
static int _returnType_offset;
static int _parameterTypes_offset;
static int _exceptionTypes_offset;
static int _slot_offset;
static int _modifiers_offset;
static int _signature_offset;
static int _annotations_offset;
static int _parameter_annotations_offset;
static int _annotation_default_offset;
static void compute_offsets();
public:
@ -660,14 +648,14 @@ class java_lang_reflect_Constructor : public java_lang_reflect_AccessibleObject
private:
// Note that to reduce dependencies on the JDK we compute these
// offsets at run-time.
static int clazz_offset;
static int parameterTypes_offset;
static int exceptionTypes_offset;
static int slot_offset;
static int modifiers_offset;
static int signature_offset;
static int annotations_offset;
static int parameter_annotations_offset;
static int _clazz_offset;
static int _parameterTypes_offset;
static int _exceptionTypes_offset;
static int _slot_offset;
static int _modifiers_offset;
static int _signature_offset;
static int _annotations_offset;
static int _parameter_annotations_offset;
static void compute_offsets();
public:
@ -703,13 +691,13 @@ class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
private:
// Note that to reduce dependencies on the JDK we compute these
// offsets at run-time.
static int clazz_offset;
static int name_offset;
static int type_offset;
static int slot_offset;
static int modifiers_offset;
static int signature_offset;
static int annotations_offset;
static int _clazz_offset;
static int _name_offset;
static int _type_offset;
static int _slot_offset;
static int _modifiers_offset;
static int _signature_offset;
static int _annotations_offset;
static void compute_offsets();
@ -748,10 +736,10 @@ class java_lang_reflect_Parameter {
private:
// Note that to reduce dependencies on the JDK we compute these
// offsets at run-time.
static int name_offset;
static int modifiers_offset;
static int index_offset;
static int executable_offset;
static int _name_offset;
static int _modifiers_offset;
static int _index_offset;
static int _executable_offset;
static void compute_offsets();
@ -782,9 +770,10 @@ class java_lang_reflect_Parameter {
class java_lang_Module {
private:
static int loader_offset;
static int name_offset;
static int _loader_offset;
static int _name_offset;
static int _module_entry_offset;
static void compute_offsets();
public:
@ -826,9 +815,7 @@ class reflect_ConstantPool {
// Accessors
static void set_cp(oop reflect, ConstantPool* value);
static int oop_offset() {
return _oop_offset;
}
static int oop_offset() { CHECK_INIT(_oop_offset); }
static ConstantPool* get_cp(oop reflect);
@ -845,9 +832,7 @@ class reflect_UnsafeStaticFieldAccessorImpl {
public:
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
static int base_offset() {
return _base_offset;
}
static int base_offset() { CHECK_INIT(_base_offset); }
// Debugging
friend class JavaClasses;
@ -867,9 +852,10 @@ class reflect_UnsafeStaticFieldAccessorImpl {
class java_lang_boxing_object: AllStatic {
private:
static int value_offset;
static int long_value_offset;
static int _value_offset;
static int _long_value_offset;
static void compute_offsets();
static oop initialize_and_allocate(BasicType type, TRAPS);
public:
// Allocation. Returns a boxed value, or NULL for invalid type.
@ -883,13 +869,11 @@ class java_lang_boxing_object: AllStatic {
static void print(oop box, outputStream* st) { jvalue value; print(get_value(box, &value), &value, st); }
static void print(BasicType type, jvalue* value, outputStream* st);
static int value_offset_in_bytes(BasicType type) {
return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset :
value_offset;
static int value_offset(BasicType type) {
return is_double_word_type(type) ? _long_value_offset : _value_offset;
}
static void compute_offsets();
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
static void serialize_offsets(SerializeClosure* f);
// Debugging
friend class JavaClasses;
@ -900,14 +884,14 @@ class java_lang_boxing_object: AllStatic {
// Interface to java.lang.ref.Reference objects
class java_lang_ref_Reference: AllStatic {
static int _referent_offset;
static int _queue_offset;
static int _next_offset;
static int _discovered_offset;
static bool _offsets_initialized;
public:
static int referent_offset;
static int queue_offset;
static int next_offset;
static int discovered_offset;
// Accessors
static inline oop referent(oop ref);
static inline void set_referent(oop ref, oop value);
@ -927,6 +911,11 @@ class java_lang_ref_Reference: AllStatic {
static inline bool is_final(oop ref);
static inline bool is_phantom(oop ref);
static int referent_offset() { CHECK_INIT(_referent_offset); }
static int queue_offset() { CHECK_INIT(_queue_offset); }
static int next_offset() { CHECK_INIT(_next_offset); }
static int discovered_offset() { CHECK_INIT(_discovered_offset); }
static void compute_offsets();
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
};
@ -935,10 +924,10 @@ class java_lang_ref_Reference: AllStatic {
// Interface to java.lang.ref.SoftReference objects
class java_lang_ref_SoftReference: public java_lang_ref_Reference {
public:
static int timestamp_offset;
static int static_clock_offset;
static int _timestamp_offset;
static int _static_clock_offset;
public:
// Accessors
static jlong timestamp(oop ref);
@ -980,8 +969,8 @@ class java_lang_invoke_MethodHandle: AllStatic {
static bool is_instance(oop obj);
// Accessors for code generation:
static int type_offset_in_bytes() { return _type_offset; }
static int form_offset_in_bytes() { return _form_offset; }
static int type_offset() { CHECK_INIT(_type_offset); }
static int form_offset() { CHECK_INIT(_form_offset); }
};
// Interface to java.lang.invoke.DirectMethodHandle objects
@ -1007,7 +996,7 @@ class java_lang_invoke_DirectMethodHandle: AllStatic {
static bool is_instance(oop obj);
// Accessors for code generation:
static int member_offset_in_bytes() { return _member_offset; }
static int member_offset() { CHECK_INIT(_member_offset); }
};
// Interface to java.lang.invoke.LambdaForm objects
@ -1036,7 +1025,7 @@ class java_lang_invoke_LambdaForm: AllStatic {
static bool is_instance(oop obj);
// Accessors for code generation:
static int vmentry_offset_in_bytes() { return _vmentry_offset; }
static int vmentry_offset() { CHECK_INIT(_vmentry_offset); }
};
@ -1057,7 +1046,7 @@ class java_lang_invoke_ResolvedMethodName : AllStatic {
public:
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
static int vmtarget_offset_in_bytes() { return _vmtarget_offset; }
static int vmtarget_offset() { CHECK_INIT(_vmtarget_offset); }
static Method* vmtarget(oop resolved_method);
static void set_vmtarget(oop resolved_method, Method* method);
@ -1144,12 +1133,11 @@ class java_lang_invoke_MemberName: AllStatic {
};
// Accessors for code generation:
static int clazz_offset_in_bytes() { return _clazz_offset; }
static int type_offset_in_bytes() { return _type_offset; }
static int name_offset_in_bytes() { return _name_offset; }
static int flags_offset_in_bytes() { return _flags_offset; }
static int method_offset_in_bytes() { return _method_offset; }
static int vmindex_offset_in_bytes() { return _vmindex_offset; }
static int clazz_offset() { CHECK_INIT(_clazz_offset); }
static int type_offset() { CHECK_INIT(_type_offset); }
static int flags_offset() { CHECK_INIT(_flags_offset); }
static int method_offset() { CHECK_INIT(_method_offset); }
static int vmindex_offset() { CHECK_INIT(_vmindex_offset); }
};
@ -1184,8 +1172,8 @@ class java_lang_invoke_MethodType: AllStatic {
static bool equals(oop mt1, oop mt2);
// Accessors for code generation:
static int rtype_offset_in_bytes() { return _rtype_offset; }
static int ptypes_offset_in_bytes() { return _ptypes_offset; }
static int rtype_offset() { CHECK_INIT(_rtype_offset); }
static int ptypes_offset() { CHECK_INIT(_ptypes_offset); }
};
@ -1216,7 +1204,8 @@ public:
static bool is_instance(oop obj);
// Accessors for code generation:
static int target_offset_in_bytes() { return _target_offset; }
static int target_offset() { CHECK_INIT(_target_offset); }
static int context_offset() { CHECK_INIT(_context_offset); }
};
// Interface to java.lang.invoke.ConstantCallSite objects
@ -1299,15 +1288,15 @@ class java_security_AccessControlContext: AllStatic {
class java_lang_ClassLoader : AllStatic {
private:
static int _loader_data_offset;
static bool offsets_computed;
static int parent_offset;
static int parallelCapable_offset;
static int name_offset;
static int nameAndId_offset;
static int unnamedModule_offset;
static int _parent_offset;
static int _parallelCapable_offset;
static int _name_offset;
static int _nameAndId_offset;
static int _unnamedModule_offset;
static void compute_offsets();
public:
static void compute_offsets();
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
static ClassLoaderData* loader_data_acquire(oop loader);
@ -1341,7 +1330,6 @@ class java_lang_ClassLoader : AllStatic {
// Debugging
friend class JavaClasses;
friend class ClassFileParser; // access to number_of_fake_fields
};
@ -1349,15 +1337,15 @@ class java_lang_ClassLoader : AllStatic {
class java_lang_System : AllStatic {
private:
static int static_in_offset;
static int static_out_offset;
static int static_err_offset;
static int static_security_offset;
static int _static_in_offset;
static int _static_out_offset;
static int _static_err_offset;
static int _static_security_offset;
public:
static int in_offset_in_bytes();
static int out_offset_in_bytes();
static int err_offset_in_bytes();
static int in_offset() { CHECK_INIT(_static_in_offset); }
static int out_offset() { CHECK_INIT(_static_out_offset); }
static int err_offset() { CHECK_INIT(_static_err_offset); }
static void compute_offsets();
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
@ -1371,14 +1359,14 @@ class java_lang_System : AllStatic {
class java_lang_StackTraceElement: AllStatic {
private:
static int declaringClassObject_offset;
static int classLoaderName_offset;
static int moduleName_offset;
static int moduleVersion_offset;
static int declaringClass_offset;
static int methodName_offset;
static int fileName_offset;
static int lineNumber_offset;
static int _declaringClassObject_offset;
static int _classLoaderName_offset;
static int _moduleName_offset;
static int _moduleVersion_offset;
static int _declaringClass_offset;
static int _methodName_offset;
static int _fileName_offset;
static int _lineNumber_offset;
// Setters
static void set_classLoaderName(oop element, oop value);
@ -1482,13 +1470,13 @@ class java_lang_LiveStackFrameInfo: AllStatic {
class java_lang_reflect_RecordComponent: AllStatic {
private:
static int clazz_offset;
static int name_offset;
static int type_offset;
static int accessor_offset;
static int signature_offset;
static int annotations_offset;
static int typeAnnotations_offset;
static int _clazz_offset;
static int _name_offset;
static int _type_offset;
static int _accessor_offset;
static int _signature_offset;
static int _annotations_offset;
static int _typeAnnotations_offset;
// Setters
static void set_clazz(oop element, oop value);
@ -1515,11 +1503,11 @@ class java_lang_reflect_RecordComponent: AllStatic {
class java_lang_AssertionStatusDirectives: AllStatic {
private:
static int classes_offset;
static int classEnabled_offset;
static int packages_offset;
static int packageEnabled_offset;
static int deflt_offset;
static int _classes_offset;
static int _classEnabled_offset;
static int _packages_offset;
static int _packageEnabled_offset;
static int _deflt_offset;
public:
// Setters
@ -1542,7 +1530,7 @@ class java_nio_Buffer: AllStatic {
static int _limit_offset;
public:
static int limit_offset();
static int limit_offset() { CHECK_INIT(_limit_offset); }
static void compute_offsets();
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
};
@ -1719,4 +1707,5 @@ class JavaClasses : AllStatic {
#undef DECLARE_INJECTED_FIELD_ENUM
#undef CHECK_INIT
#endif // SHARE_CLASSFILE_JAVACLASSES_HPP

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -31,23 +31,19 @@
#include "oops/oopsHierarchy.hpp"
void java_lang_String::set_coder(oop string, jbyte coder) {
assert(initialized && (coder_offset > 0), "Must be initialized");
string->byte_field_put(coder_offset, coder);
string->byte_field_put(_coder_offset, coder);
}
void java_lang_String::set_value_raw(oop string, typeArrayOop buffer) {
assert(initialized, "Must be initialized");
string->obj_field_put_raw(value_offset, buffer);
string->obj_field_put_raw(_value_offset, buffer);
}
void java_lang_String::set_value(oop string, typeArrayOop buffer) {
assert(initialized && (value_offset > 0), "Must be initialized");
string->obj_field_put(value_offset, (oop)buffer);
string->obj_field_put(_value_offset, (oop)buffer);
}
bool java_lang_String::hash_is_set(oop java_string) {
assert(initialized && (hash_offset > 0) && (hashIsZero_offset > 0), "Must be initialized");
return java_string->int_field(hash_offset) != 0 || java_string->bool_field(hashIsZero_offset) != 0;
return java_string->int_field(_hash_offset) != 0 || java_string->bool_field(_hashIsZero_offset) != 0;
}
// Accessors
@ -60,27 +56,24 @@ bool java_lang_String::value_equals(typeArrayOop str_value1, typeArrayOop str_va
}
typeArrayOop java_lang_String::value(oop java_string) {
assert(initialized && (value_offset > 0), "Must be initialized");
assert(is_instance(java_string), "must be java_string");
return (typeArrayOop) java_string->obj_field(value_offset);
return (typeArrayOop) java_string->obj_field(_value_offset);
}
typeArrayOop java_lang_String::value_no_keepalive(oop java_string) {
assert(initialized && (value_offset > 0), "Must be initialized");
assert(is_instance(java_string), "must be java_string");
return (typeArrayOop) java_string->obj_field_access<AS_NO_KEEPALIVE>(value_offset);
return (typeArrayOop) java_string->obj_field_access<AS_NO_KEEPALIVE>(_value_offset);
}
bool java_lang_String::is_latin1(oop java_string) {
assert(initialized && (coder_offset > 0), "Must be initialized");
assert(is_instance(java_string), "must be java_string");
jbyte coder = java_string->byte_field(coder_offset);
jbyte coder = java_string->byte_field(_coder_offset);
assert(CompactStrings || coder == CODER_UTF16, "Must be UTF16 without CompactStrings");
return coder == CODER_LATIN1;
}
int java_lang_String::length(oop java_string, typeArrayOop value) {
assert(initialized, "Must be initialized");
assert(_initialized, "Must be initialized");
assert(is_instance(java_string), "must be java_string");
assert(value_equals(value, java_lang_String::value(java_string)),
"value must be equal to java_lang_String::value(java_string)");
@ -96,7 +89,7 @@ int java_lang_String::length(oop java_string, typeArrayOop value) {
}
int java_lang_String::length(oop java_string) {
assert(initialized, "Must be initialized");
assert(_initialized, "Must be initialized");
assert(is_instance(java_string), "must be java_string");
typeArrayOop value = java_lang_String::value_no_keepalive(java_string);
return length(java_string, value);
@ -108,51 +101,51 @@ bool java_lang_String::is_instance_inlined(oop obj) {
// Accessors
oop java_lang_ref_Reference::referent(oop ref) {
return ref->obj_field(referent_offset);
return ref->obj_field(_referent_offset);
}
void java_lang_ref_Reference::set_referent(oop ref, oop value) {
ref->obj_field_put(referent_offset, value);
ref->obj_field_put(_referent_offset, value);
}
void java_lang_ref_Reference::set_referent_raw(oop ref, oop value) {
ref->obj_field_put_raw(referent_offset, value);
ref->obj_field_put_raw(_referent_offset, value);
}
HeapWord* java_lang_ref_Reference::referent_addr_raw(oop ref) {
return ref->obj_field_addr_raw<HeapWord>(referent_offset);
return ref->obj_field_addr_raw<HeapWord>(_referent_offset);
}
oop java_lang_ref_Reference::next(oop ref) {
return ref->obj_field(next_offset);
return ref->obj_field(_next_offset);
}
void java_lang_ref_Reference::set_next(oop ref, oop value) {
ref->obj_field_put(next_offset, value);
ref->obj_field_put(_next_offset, value);
}
void java_lang_ref_Reference::set_next_raw(oop ref, oop value) {
ref->obj_field_put_raw(next_offset, value);
ref->obj_field_put_raw(_next_offset, value);
}
HeapWord* java_lang_ref_Reference::next_addr_raw(oop ref) {
return ref->obj_field_addr_raw<HeapWord>(next_offset);
return ref->obj_field_addr_raw<HeapWord>(_next_offset);
}
oop java_lang_ref_Reference::discovered(oop ref) {
return ref->obj_field(discovered_offset);
return ref->obj_field(_discovered_offset);
}
void java_lang_ref_Reference::set_discovered(oop ref, oop value) {
ref->obj_field_put(discovered_offset, value);
ref->obj_field_put(_discovered_offset, value);
}
void java_lang_ref_Reference::set_discovered_raw(oop ref, oop value) {
ref->obj_field_put_raw(discovered_offset, value);
ref->obj_field_put_raw(_discovered_offset, value);
}
HeapWord* java_lang_ref_Reference::discovered_addr_raw(oop ref) {
return ref->obj_field_addr_raw<HeapWord>(discovered_offset);
return ref->obj_field_addr_raw<HeapWord>(_discovered_offset);
}
bool java_lang_ref_Reference::is_final(oop ref) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, 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
@ -510,7 +510,7 @@ void G1BarrierSetC2::insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* off
// If offset is a constant, is it java_lang_ref_Reference::_reference_offset?
const TypeX* otype = offset->find_intptr_t_type();
if (otype != NULL && otype->is_con() &&
otype->get_con() != java_lang_ref_Reference::referent_offset) {
otype->get_con() != java_lang_ref_Reference::referent_offset()) {
// Constant offset but not the reference_offset so just return
return;
}
@ -550,7 +550,7 @@ void G1BarrierSetC2::insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* off
IdealKit ideal(kit);
Node* referent_off = __ ConX(java_lang_ref_Reference::referent_offset);
Node* referent_off = __ ConX(java_lang_ref_Reference::referent_offset());
__ if_then(offset, BoolTest::eq, referent_off, unlikely); {
// Update graphKit memory and control from IdealKit.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, 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
@ -222,7 +222,7 @@ void BarrierSetC1::generate_referent_check(LIRAccess& access, LabelObj* cont) {
//
// We need to generate code similar to the following...
//
// if (offset == java_lang_ref_Reference::referent_offset) {
// if (offset == java_lang_ref_Reference::referent_offset()) {
// if (src != NULL) {
// if (klass(src)->reference_type() != REF_NONE) {
// pre_barrier(..., value, ...);
@ -247,7 +247,7 @@ void BarrierSetC1::generate_referent_check(LIRAccess& access, LabelObj* cont) {
constant->as_jlong());
if (off_con != (jlong) java_lang_ref_Reference::referent_offset) {
if (off_con != (jlong) java_lang_ref_Reference::referent_offset()) {
// The constant offset is something other than referent_offset.
// We can skip generating/checking the remaining guards and
// skip generation of the code stub.
@ -314,11 +314,11 @@ void BarrierSetC1::generate_referent_check(LIRAccess& access, LabelObj* cont) {
LIR_Opr referent_off;
if (offset->type() == T_INT) {
referent_off = LIR_OprFact::intConst(java_lang_ref_Reference::referent_offset);
referent_off = LIR_OprFact::intConst(java_lang_ref_Reference::referent_offset());
} else {
assert(offset->type() == T_LONG, "what else?");
referent_off = gen->new_register(T_LONG);
__ move(LIR_OprFact::longConst(java_lang_ref_Reference::referent_offset), referent_off);
__ move(LIR_OprFact::longConst(java_lang_ref_Reference::referent_offset()), referent_off);
}
__ cmp(lir_cond_notEqual, offset, referent_off);
__ branch(lir_cond_notEqual, offset->type(), cont->label());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -301,7 +301,7 @@ void DiscoveredListIterator::clear_referent() {
void DiscoveredListIterator::enqueue() {
HeapAccess<AS_NO_KEEPALIVE>::oop_store_at(_current_discovered,
java_lang_ref_Reference::discovered_offset,
java_lang_ref_Reference::discovered_offset(),
_next_discovered);
}
@ -311,7 +311,7 @@ void DiscoveredListIterator::complete_enqueue() {
// Swap refs_list into pending list and set obj's
// discovered to what we read from the pending list.
oop old = Universe::swap_reference_pending_list(_refs_list.head());
HeapAccess<AS_NO_KEEPALIVE>::oop_store_at(_prev_discovered, java_lang_ref_Reference::discovered_offset, old);
HeapAccess<AS_NO_KEEPALIVE>::oop_store_at(_prev_discovered, java_lang_ref_Reference::discovered_offset(), old);
}
}

View File

@ -375,7 +375,7 @@ void ShenandoahBarrierSetC2::insert_pre_barrier(GraphKit* kit, Node* base_oop, N
// If offset is a constant, is it java_lang_ref_Reference::_reference_offset?
const TypeX* otype = offset->find_intptr_t_type();
if (otype != NULL && otype->is_con() &&
otype->get_con() != java_lang_ref_Reference::referent_offset) {
otype->get_con() != java_lang_ref_Reference::referent_offset()) {
// Constant offset but not the reference_offset so just return
return;
}
@ -415,7 +415,7 @@ void ShenandoahBarrierSetC2::insert_pre_barrier(GraphKit* kit, Node* base_oop, N
IdealKit ideal(kit);
Node* referent_off = __ ConX(java_lang_ref_Reference::referent_offset);
Node* referent_off = __ ConX(java_lang_ref_Reference::referent_offset());
__ if_then(offset, BoolTest::eq, referent_off, unlikely); {
// Update graphKit memory and control from IdealKit.

View File

@ -298,7 +298,7 @@ void ShenandoahBarrierC2Support::verify(RootNode* root) {
if (trace) {tty->print_cr("Mark load");}
} else if (adr_type->isa_instptr() &&
adr_type->is_instptr()->klass()->is_subtype_of(Compile::current()->env()->Reference_klass()) &&
adr_type->is_instptr()->offset() == java_lang_ref_Reference::referent_offset) {
adr_type->is_instptr()->offset() == java_lang_ref_Reference::referent_offset()) {
if (trace) {tty->print_cr("Reference.get()");}
} else if (!verify_helper(n->in(MemNode::Address), phis, visited, ShenandoahLoad, trace, barriers_used)) {
report_verify_failure("Shenandoah verification: Load should have barriers", n);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -246,10 +246,10 @@ inline void ZBarrier::load_barrier_on_oop_array(volatile oop* p, size_t length)
inline void verify_on_weak(volatile oop* referent_addr) {
#ifdef ASSERT
if (referent_addr != NULL) {
uintptr_t base = (uintptr_t)referent_addr - java_lang_ref_Reference::referent_offset;
uintptr_t base = (uintptr_t)referent_addr - java_lang_ref_Reference::referent_offset();
oop obj = cast_to_oop(base);
assert(oopDesc::is_oop(obj), "Verification failed for: ref " PTR_FORMAT " obj: " PTR_FORMAT, (uintptr_t)referent_addr, base);
assert(java_lang_ref_Reference::is_referent_field(obj, java_lang_ref_Reference::referent_offset), "Sanity");
assert(java_lang_ref_Reference::is_referent_field(obj, java_lang_ref_Reference::referent_offset()), "Sanity");
}
#endif
}

View File

@ -214,7 +214,7 @@ JRT_ENTRY(void, InterpreterRuntime::resolve_ldc(JavaThread* thread, Bytecodes::C
if (!is_fast_aldc) {
// Tell the interpreter how to unbox the primitive.
guarantee(java_lang_boxing_object::is_instance(result, type), "");
int offset = java_lang_boxing_object::value_offset_in_bytes(type);
int offset = java_lang_boxing_object::value_offset(type);
intptr_t flags = ((as_TosState(type) << ConstantPoolCacheEntry::tos_state_shift)
| (offset & ConstantPoolCacheEntry::field_index_mask));
thread->set_vm_result_2((Metadata*)flags);

View File

@ -157,7 +157,7 @@ class JavaArgumentUnboxer : public SignatureIterator {
return;
}
Handle arg = next_arg(type);
int box_offset = java_lang_boxing_object::value_offset_in_bytes(type);
int box_offset = java_lang_boxing_object::value_offset(type);
switch (type) {
case T_BOOLEAN: _jca->push_int(arg->bool_field(box_offset)); break;
case T_CHAR: _jca->push_int(arg->char_field(box_offset)); break;

View File

@ -734,7 +734,7 @@ oop InstanceKlass::init_lock() const {
void InstanceKlass::fence_and_clear_init_lock() {
// make sure previous stores are all done, notably the init_state.
OrderAccess::storestore();
java_lang_Class::set_init_lock(java_mirror(), NULL);
java_lang_Class::clear_init_lock(java_mirror());
assert(!is_not_initialized(), "class must be initialized now");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -45,10 +45,10 @@ void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) {
#ifdef ASSERT
// Verify fields are in the expected places.
int referent_offset = java_lang_ref_Reference::referent_offset;
int queue_offset = java_lang_ref_Reference::queue_offset;
int next_offset = java_lang_ref_Reference::next_offset;
int discovered_offset = java_lang_ref_Reference::discovered_offset;
int referent_offset = java_lang_ref_Reference::referent_offset();
int queue_offset = java_lang_ref_Reference::queue_offset();
int next_offset = java_lang_ref_Reference::next_offset();
int discovered_offset = java_lang_ref_Reference::discovered_offset();
assert(referent_offset < queue_offset, "just checking");
assert(queue_offset < next_offset, "just checking");
assert(next_offset < discovered_offset, "just checking");
@ -58,7 +58,7 @@ void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) {
#endif // ASSERT
// Updated map starts at "queue", covers "queue" and "next".
const int new_offset = java_lang_ref_Reference::queue_offset;
const int new_offset = java_lang_ref_Reference::queue_offset();
const unsigned int new_count = 2; // queue and next
// Verify existing map is as expected, and update if needed.

View File

@ -1585,7 +1585,7 @@ Compile::AliasType* Compile::find_alias_type(const TypePtr* adr_type, bool no_cr
if (flat == TypeInstPtr::KLASS) alias_type(idx)->set_rewritable(false);
if (flat == TypeAryPtr::RANGE) alias_type(idx)->set_rewritable(false);
if (flat->isa_instptr()) {
if (flat->offset() == java_lang_Class::klass_offset_in_bytes()
if (flat->offset() == java_lang_Class::klass_offset()
&& flat->is_instptr()->klass() == env()->Class_klass())
alias_type(idx)->set_rewritable(false);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -3986,7 +3986,7 @@ Node* GraphKit::load_String_length(Node* str, bool set_ctrl) {
}
Node* GraphKit::load_String_value(Node* str, bool set_ctrl) {
int value_offset = java_lang_String::value_offset_in_bytes();
int value_offset = java_lang_String::value_offset();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* value_field_type = string_type->add_offset(value_offset);
@ -4003,7 +4003,7 @@ Node* GraphKit::load_String_coder(Node* str, bool set_ctrl) {
if (!CompactStrings) {
return intcon(java_lang_String::CODER_UTF16);
}
int coder_offset = java_lang_String::coder_offset_in_bytes();
int coder_offset = java_lang_String::coder_offset();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* coder_field_type = string_type->add_offset(coder_offset);
@ -4015,7 +4015,7 @@ Node* GraphKit::load_String_coder(Node* str, bool set_ctrl) {
}
void GraphKit::store_String_value(Node* str, Node* value) {
int value_offset = java_lang_String::value_offset_in_bytes();
int value_offset = java_lang_String::value_offset();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* value_field_type = string_type->add_offset(value_offset);
@ -4025,7 +4025,7 @@ void GraphKit::store_String_value(Node* str, Node* value) {
}
void GraphKit::store_String_coder(Node* str, Node* value) {
int coder_offset = java_lang_String::coder_offset_in_bytes();
int coder_offset = java_lang_String::coder_offset();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0);
const TypePtr* coder_field_type = string_type->add_offset(coder_offset);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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,14 +170,14 @@ class LibraryCallKit : public GraphKit {
int offset);
Node* load_klass_from_mirror(Node* mirror, bool never_see_null,
RegionNode* region, int null_path) {
int offset = java_lang_Class::klass_offset_in_bytes();
int offset = java_lang_Class::klass_offset();
return load_klass_from_mirror_common(mirror, never_see_null,
region, null_path,
offset);
}
Node* load_array_klass_from_mirror(Node* mirror, bool never_see_null,
RegionNode* region, int null_path) {
int offset = java_lang_Class::array_klass_offset_in_bytes();
int offset = java_lang_Class::array_klass_offset();
return load_klass_from_mirror_common(mirror, never_see_null,
region, null_path,
offset);
@ -3387,7 +3387,7 @@ bool LibraryCallKit::inline_native_subtype_check() {
const TypePtr* adr_type = TypeRawPtr::BOTTOM; // memory type of loads
const TypeKlassPtr* kls_type = TypeKlassPtr::OBJECT_OR_NULL;
int class_klass_offset = java_lang_Class::klass_offset_in_bytes();
int class_klass_offset = java_lang_Class::klass_offset();
// First null-check both mirrors and load each mirror's klass metaobject.
int which_arg;
@ -5680,8 +5680,7 @@ bool LibraryCallKit::inline_updateByteBufferAdler32() {
//----------------------------inline_reference_get----------------------------
// public T java.lang.ref.Reference.get();
bool LibraryCallKit::inline_reference_get() {
const int referent_offset = java_lang_ref_Reference::referent_offset;
guarantee(referent_offset > 0, "should have already been set");
const int referent_offset = java_lang_ref_Reference::referent_offset();
// Get the argument:
Node* reference_obj = null_check_receiver();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -2153,15 +2153,15 @@ const Type* LoadNode::klass_value_common(PhaseGVN* phase) const {
ciInstanceKlass* ik = tinst->klass()->as_instance_klass();
int offset = tinst->offset();
if (ik == phase->C->env()->Class_klass()
&& (offset == java_lang_Class::klass_offset_in_bytes() ||
offset == java_lang_Class::array_klass_offset_in_bytes())) {
&& (offset == java_lang_Class::klass_offset() ||
offset == java_lang_Class::array_klass_offset())) {
// We are loading a special hidden field from a Class mirror object,
// the field which points to the VM's Klass metaobject.
ciType* t = tinst->java_mirror_type();
// java_mirror_type returns non-null for compile-time Class constants.
if (t != NULL) {
// constant oop => constant klass
if (offset == java_lang_Class::array_klass_offset_in_bytes()) {
if (offset == java_lang_Class::array_klass_offset()) {
if (t->is_void()) {
// We cannot create a void array. Since void is a primitive type return null
// klass. Users of this result need to do a null check on the returned klass.
@ -2314,7 +2314,7 @@ Node* LoadNode::klass_identity_common(PhaseGVN* phase) {
// introducing a new debug info operator for Klass.java_mirror).
if (toop->isa_instptr() && toop->klass() == phase->C->env()->Class_klass()
&& offset == java_lang_Class::klass_offset_in_bytes()) {
&& offset == java_lang_Class::klass_offset()) {
if (base->is_Load()) {
Node* base2 = base->in(MemNode::Address);
if (base2->is_Load()) { /* direct load of a load which is the OopHandle */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2020, 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
@ -1666,7 +1666,7 @@ jbyte PhaseStringOpts::get_constant_coder(GraphKit& kit, Node* str) {
assert(str->is_Con(), "String must be constant");
const TypeOopPtr* str_type = kit.gvn().type(str)->isa_oopptr();
ciInstance* str_instance = str_type->const_oop()->as_instance();
jbyte coder = str_instance->field_value_by_offset(java_lang_String::coder_offset_in_bytes()).as_byte();
jbyte coder = str_instance->field_value_by_offset(java_lang_String::coder_offset()).as_byte();
assert(CompactStrings || (coder == java_lang_String::CODER_UTF16), "Strings must be UTF16 encoded");
return coder;
}
@ -1680,7 +1680,7 @@ ciTypeArray* PhaseStringOpts::get_constant_value(GraphKit& kit, Node* str) {
assert(str->is_Con(), "String must be constant");
const TypeOopPtr* str_type = kit.gvn().type(str)->isa_oopptr();
ciInstance* str_instance = str_type->const_oop()->as_instance();
ciObject* src_array = str_instance->field_value_by_offset(java_lang_String::value_offset_in_bytes()).as_object();
ciObject* src_array = str_instance->field_value_by_offset(java_lang_String::value_offset()).as_object();
return src_array->as_type_array();
}

View File

@ -3010,8 +3010,8 @@ TypeOopPtr::TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int o
assert(this->isa_instptr(), "must be an instance ptr.");
if (klass() == ciEnv::current()->Class_klass() &&
(_offset == java_lang_Class::klass_offset_in_bytes() ||
_offset == java_lang_Class::array_klass_offset_in_bytes())) {
(_offset == java_lang_Class::klass_offset() ||
_offset == java_lang_Class::array_klass_offset())) {
// Special hidden fields from the Class.
assert(this->isa_instptr(), "must be an instance ptr.");
_is_ptr_to_narrowoop = false;