< prev index next >

src/cpu/x86/vm/methodHandles_x86.cpp

Print this page




  48     verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
  49                  "MH argument is a Class");
  50   __ movptr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes()));
  51 }
  52 
  53 #ifdef ASSERT
  54 static int check_nonzero(const char* xname, int x) {
  55   assert(x != 0, "%s should be nonzero", xname);
  56   return x;
  57 }
  58 #define NONZERO(x) check_nonzero(#x, x)
  59 #else //ASSERT
  60 #define NONZERO(x) (x)
  61 #endif //ASSERT
  62 
  63 #ifdef ASSERT
  64 void MethodHandles::verify_klass(MacroAssembler* _masm,
  65                                  Register obj, SystemDictionary::WKID klass_id,
  66                                  const char* error_message) {
  67   InstanceKlass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
  68   KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
  69   Register temp = rdi;
  70   Register temp2 = noreg;
  71   LP64_ONLY(temp2 = rscratch1);  // used by MacroAssembler::cmpptr
  72   Label L_ok, L_bad;
  73   BLOCK_COMMENT("verify_klass {");
  74   __ verify_oop(obj);
  75   __ testptr(obj, obj);
  76   __ jcc(Assembler::zero, L_bad);
  77   __ push(temp); if (temp2 != noreg)  __ push(temp2);
  78 #define UNPUSH { if (temp2 != noreg)  __ pop(temp2);  __ pop(temp); }
  79   __ load_klass(temp, obj);
  80   __ cmpptr(temp, ExternalAddress((address) klass_addr));
  81   __ jcc(Assembler::equal, L_ok);
  82   intptr_t super_check_offset = klass->super_check_offset();
  83   __ movptr(temp, Address(temp, super_check_offset));
  84   __ cmpptr(temp, ExternalAddress((address) klass_addr));
  85   __ jcc(Assembler::equal, L_ok);
  86   UNPUSH;
  87   __ bind(L_bad);
  88   __ STOP(error_message);




  48     verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
  49                  "MH argument is a Class");
  50   __ movptr(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes()));
  51 }
  52 
  53 #ifdef ASSERT
  54 static int check_nonzero(const char* xname, int x) {
  55   assert(x != 0, "%s should be nonzero", xname);
  56   return x;
  57 }
  58 #define NONZERO(x) check_nonzero(#x, x)
  59 #else //ASSERT
  60 #define NONZERO(x) (x)
  61 #endif //ASSERT
  62 
  63 #ifdef ASSERT
  64 void MethodHandles::verify_klass(MacroAssembler* _masm,
  65                                  Register obj, SystemDictionary::WKID klass_id,
  66                                  const char* error_message) {
  67   InstanceKlass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
  68   Klass* klass = SystemDictionary::well_known_klass(klass_id);
  69   Register temp = rdi;
  70   Register temp2 = noreg;
  71   LP64_ONLY(temp2 = rscratch1);  // used by MacroAssembler::cmpptr
  72   Label L_ok, L_bad;
  73   BLOCK_COMMENT("verify_klass {");
  74   __ verify_oop(obj);
  75   __ testptr(obj, obj);
  76   __ jcc(Assembler::zero, L_bad);
  77   __ push(temp); if (temp2 != noreg)  __ push(temp2);
  78 #define UNPUSH { if (temp2 != noreg)  __ pop(temp2);  __ pop(temp); }
  79   __ load_klass(temp, obj);
  80   __ cmpptr(temp, ExternalAddress((address) klass_addr));
  81   __ jcc(Assembler::equal, L_ok);
  82   intptr_t super_check_offset = klass->super_check_offset();
  83   __ movptr(temp, Address(temp, super_check_offset));
  84   __ cmpptr(temp, ExternalAddress((address) klass_addr));
  85   __ jcc(Assembler::equal, L_ok);
  86   UNPUSH;
  87   __ bind(L_bad);
  88   __ STOP(error_message);


< prev index next >