Mercurial > hg > truffle
diff src/cpu/x86/vm/methodHandles_x86.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | 1d7922586cf6 |
children | 75f33eecc1b3 |
line wrap: on
line diff
--- a/src/cpu/x86/vm/methodHandles_x86.cpp Fri Aug 31 16:39:35 2012 -0700 +++ b/src/cpu/x86/vm/methodHandles_x86.cpp Sat Sep 01 13:25:18 2012 -0400 @@ -47,9 +47,9 @@ void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg) { if (VerifyMethodHandles) - verify_klass(_masm, klass_reg, SystemDictionaryHandles::Class_klass(), + verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class), "MH argument is a Class"); - __ load_heap_oop(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes())); + __ movptr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes())); } #ifdef ASSERT @@ -64,12 +64,10 @@ #ifdef ASSERT void MethodHandles::verify_klass(MacroAssembler* _masm, - Register obj, KlassHandle klass, + Register obj, SystemDictionary::WKID klass_id, const char* error_message) { - oop* klass_addr = klass.raw_value(); - assert(klass_addr >= SystemDictionaryHandles::Object_klass().raw_value() && - klass_addr <= SystemDictionaryHandles::Long_klass().raw_value(), - "must be one of the SystemDictionaryHandles"); + Klass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id); + KlassHandle klass = SystemDictionary::well_known_klass(klass_id); Register temp = rdi; Register temp2 = noreg; LP64_ONLY(temp2 = rscratch1); // used by MacroAssembler::cmpptr @@ -137,12 +135,12 @@ // Is a cmpl faster? __ cmpb(Address(rthread, JavaThread::interp_only_mode_offset()), 0); __ jccb(Assembler::zero, run_compiled_code); - __ jmp(Address(method, methodOopDesc::interpreter_entry_offset())); + __ jmp(Address(method, Method::interpreter_entry_offset())); __ BIND(run_compiled_code); } - const ByteSize entry_offset = for_compiler_entry ? methodOopDesc::from_compiled_offset() : - methodOopDesc::from_interpreted_offset(); + const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() : + Method::from_interpreted_offset(); __ jmp(Address(method, entry_offset)); } @@ -165,16 +163,15 @@ __ verify_oop(method_temp); __ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes()))); __ verify_oop(method_temp); - // the following assumes that a methodOop is normally compressed in the vmtarget field: - __ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_MemberName::vmtarget_offset_in_bytes()))); - __ verify_oop(method_temp); + // the following assumes that a Method* is normally compressed in the vmtarget field: + __ movptr(method_temp, Address(method_temp, NONZERO(java_lang_invoke_MemberName::vmtarget_offset_in_bytes()))); if (VerifyMethodHandles && !for_compiler_entry) { // make sure recv is already on stack __ load_sized_value(temp2, - Address(method_temp, methodOopDesc::size_of_parameters_offset()), + Address(method_temp, Method::size_of_parameters_offset()), sizeof(u2), /*is_signed*/ false); - // assert(sizeof(u2) == sizeof(methodOopDesc::_size_of_parameters), ""); + // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), ""); Label L; __ cmpptr(recv, __ argument_address(temp2, -1)); __ jcc(Assembler::equal, L); @@ -203,7 +200,7 @@ } // rsi/r13: sender SP (must preserve; see prepare_to_jump_from_interpreted) - // rbx: methodOop + // rbx: Method* // rdx: argument locator (parameter slot count, added to rsp) // rcx: used as temp to hold mh or receiver // rax, rdi: garbage temps, blown away @@ -221,14 +218,14 @@ if (VerifyMethodHandles) { Label L; BLOCK_COMMENT("verify_intrinsic_id {"); - __ cmpb(Address(rbx_method, methodOopDesc::intrinsic_id_offset_in_bytes()), (int) iid); + __ cmpb(Address(rbx_method, Method::intrinsic_id_offset_in_bytes()), (int) iid); __ jcc(Assembler::equal, L); if (iid == vmIntrinsics::_linkToVirtual || iid == vmIntrinsics::_linkToSpecial) { // could do this for all kinds, but would explode assembly code size - trace_method_handle(_masm, "bad methodOop::intrinsic_id"); + trace_method_handle(_masm, "bad Method*::intrinsic_id"); } - __ STOP("bad methodOop::intrinsic_id"); + __ STOP("bad Method*::intrinsic_id"); __ bind(L); BLOCK_COMMENT("} verify_intrinsic_id"); } @@ -239,9 +236,9 @@ assert(ref_kind != 0 || iid == vmIntrinsics::_invokeBasic, "must be _invokeBasic or a linkTo intrinsic"); if (ref_kind == 0 || MethodHandles::ref_kind_has_receiver(ref_kind)) { __ load_sized_value(rdx_argp, - Address(rbx_method, methodOopDesc::size_of_parameters_offset()), + Address(rbx_method, Method::size_of_parameters_offset()), sizeof(u2), /*is_signed*/ false); - // assert(sizeof(u2) == sizeof(methodOopDesc::_size_of_parameters), ""); + // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), ""); rdx_first_arg_addr = __ argument_address(rdx_argp, -1); } else { DEBUG_ONLY(rdx_argp = noreg); @@ -343,7 +340,7 @@ // The method is a member invoker used by direct method handles. if (VerifyMethodHandles) { // make sure the trailing argument really is a MemberName (caller responsibility) - verify_klass(_masm, member_reg, SystemDictionaryHandles::MemberName_klass(), + verify_klass(_masm, member_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_invoke_MemberName), "MemberName required for invokeVirtual etc."); } @@ -401,7 +398,7 @@ if (VerifyMethodHandles) { verify_ref_kind(_masm, JVM_REF_invokeSpecial, member_reg, temp3); } - __ load_heap_oop(rbx_method, member_vmtarget); + __ movptr(rbx_method, member_vmtarget); method_is_live = true; break; @@ -409,7 +406,7 @@ if (VerifyMethodHandles) { verify_ref_kind(_masm, JVM_REF_invokeStatic, member_reg, temp3); } - __ load_heap_oop(rbx_method, member_vmtarget); + __ movptr(rbx_method, member_vmtarget); method_is_live = true; break; @@ -437,7 +434,7 @@ // Note: The verifier invariants allow us to ignore MemberName.clazz and vmtarget // at this point. And VerifyMethodHandles has already checked clazz, if needed. - // get target methodOop & entry point + // get target Method* & entry point __ lookup_virtual_method(temp1_recv_klass, temp2_index, rbx_method); method_is_live = true; break; @@ -653,4 +650,3 @@ BLOCK_COMMENT("} trace_method_handle"); } #endif //PRODUCT -