< prev index next >

src/cpu/aarch64/vm/methodHandles_aarch64.cpp

Print this page




  33 
  34 #define __ _masm->
  35 
  36 #ifdef PRODUCT
  37 #define BLOCK_COMMENT(str) /* nothing */
  38 #else
  39 #define BLOCK_COMMENT(str) __ block_comment(str)
  40 #endif
  41 
  42 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
  43 
  44 void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg) {
  45   if (VerifyMethodHandles)
  46     verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
  47                  "MH argument is a Class");
  48   __ ldr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes()));
  49 }
  50 
  51 #ifdef ASSERT
  52 static int check_nonzero(const char* xname, int x) {
  53   assert(x != 0, err_msg("%s should be nonzero", xname));
  54   return x;
  55 }
  56 #define NONZERO(x) check_nonzero(#x, x)
  57 #else //ASSERT
  58 #define NONZERO(x) (x)
  59 #endif //PRODUCT
  60 
  61 #ifdef ASSERT
  62 void MethodHandles::verify_klass(MacroAssembler* _masm,
  63                                  Register obj, SystemDictionary::WKID klass_id,
  64                                  const char* error_message) {
  65   Klass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
  66   KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
  67   Register temp = rscratch2;
  68   Register temp2 = rscratch1; // used by MacroAssembler::cmpptr
  69   Label L_ok, L_bad;
  70   BLOCK_COMMENT("verify_klass {");
  71   __ verify_oop(obj);
  72   __ cbz(obj, L_bad);
  73   __ push(RegSet::of(temp, temp2), sp);


 390       Register rindex = rmethod;
 391       __ ldr(rindex, member_vmindex);
 392       if (VerifyMethodHandles) {
 393         Label L;
 394         __ cmpw(rindex, 0U);
 395         __ br(Assembler::GE, L);
 396         __ hlt(0);
 397         __ bind(L);
 398       }
 399 
 400       // given intf, index, and recv klass, dispatch to the implementation method
 401       __ lookup_interface_method(temp1_recv_klass, temp3_intf,
 402                                  // note: next two args must be the same:
 403                                  rindex, rmethod,
 404                                  temp2,
 405                                  L_incompatible_class_change_error);
 406       break;
 407     }
 408 
 409     default:
 410       fatal(err_msg_res("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid)));
 411       break;
 412     }
 413 
 414     // live at this point:  rmethod, r13 (if interpreted)
 415 
 416     // After figuring out which concrete method to call, jump into it.
 417     // Note that this works in the interpreter with no data motion.
 418     // But the compiled version will require that r2_recv be shifted out.
 419     __ verify_method_ptr(rmethod);
 420     jump_from_method_handle(_masm, rmethod, temp1, for_compiler_entry);
 421     if (iid == vmIntrinsics::_linkToInterface) {
 422       __ bind(L_incompatible_class_change_error);
 423       __ far_jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
 424     }
 425   }
 426 }
 427 
 428 #ifndef PRODUCT
 429 void trace_method_handle_stub(const char* adaptername,
 430                               oop mh,


  33 
  34 #define __ _masm->
  35 
  36 #ifdef PRODUCT
  37 #define BLOCK_COMMENT(str) /* nothing */
  38 #else
  39 #define BLOCK_COMMENT(str) __ block_comment(str)
  40 #endif
  41 
  42 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
  43 
  44 void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg) {
  45   if (VerifyMethodHandles)
  46     verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
  47                  "MH argument is a Class");
  48   __ ldr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes()));
  49 }
  50 
  51 #ifdef ASSERT
  52 static int check_nonzero(const char* xname, int x) {
  53   assert(x != 0, "%s should be nonzero", xname);
  54   return x;
  55 }
  56 #define NONZERO(x) check_nonzero(#x, x)
  57 #else //ASSERT
  58 #define NONZERO(x) (x)
  59 #endif //PRODUCT
  60 
  61 #ifdef ASSERT
  62 void MethodHandles::verify_klass(MacroAssembler* _masm,
  63                                  Register obj, SystemDictionary::WKID klass_id,
  64                                  const char* error_message) {
  65   Klass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
  66   KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
  67   Register temp = rscratch2;
  68   Register temp2 = rscratch1; // used by MacroAssembler::cmpptr
  69   Label L_ok, L_bad;
  70   BLOCK_COMMENT("verify_klass {");
  71   __ verify_oop(obj);
  72   __ cbz(obj, L_bad);
  73   __ push(RegSet::of(temp, temp2), sp);


 390       Register rindex = rmethod;
 391       __ ldr(rindex, member_vmindex);
 392       if (VerifyMethodHandles) {
 393         Label L;
 394         __ cmpw(rindex, 0U);
 395         __ br(Assembler::GE, L);
 396         __ hlt(0);
 397         __ bind(L);
 398       }
 399 
 400       // given intf, index, and recv klass, dispatch to the implementation method
 401       __ lookup_interface_method(temp1_recv_klass, temp3_intf,
 402                                  // note: next two args must be the same:
 403                                  rindex, rmethod,
 404                                  temp2,
 405                                  L_incompatible_class_change_error);
 406       break;
 407     }
 408 
 409     default:
 410       fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
 411       break;
 412     }
 413 
 414     // live at this point:  rmethod, r13 (if interpreted)
 415 
 416     // After figuring out which concrete method to call, jump into it.
 417     // Note that this works in the interpreter with no data motion.
 418     // But the compiled version will require that r2_recv be shifted out.
 419     __ verify_method_ptr(rmethod);
 420     jump_from_method_handle(_masm, rmethod, temp1, for_compiler_entry);
 421     if (iid == vmIntrinsics::_linkToInterface) {
 422       __ bind(L_incompatible_class_change_error);
 423       __ far_jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
 424     }
 425   }
 426 }
 427 
 428 #ifndef PRODUCT
 429 void trace_method_handle_stub(const char* adaptername,
 430                               oop mh,
< prev index next >