< prev index next >

src/cpu/x86/vm/vtableStubs_x86_64.cpp

Print this page




  96   __ lookup_virtual_method(rax, vtable_index, method);
  97 
  98   if (DebugVtables) {
  99     Label L;
 100     __ cmpptr(method, (int32_t)NULL_WORD);
 101     __ jcc(Assembler::equal, L);
 102     __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
 103     __ jcc(Assembler::notZero, L);
 104     __ stop("Vtable entry is NULL");
 105     __ bind(L);
 106   }
 107   // rax: receiver klass
 108   // rbx: Method*
 109   // rcx: receiver
 110   address ame_addr = __ pc();
 111   __ jmp( Address(rbx, Method::from_compiled_offset()));
 112 
 113   __ flush();
 114 
 115   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 116     tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d",
 117                   vtable_index, s->entry_point(),
 118                   (int)(s->code_end() - s->entry_point()),
 119                   (int)(s->code_end() - __ pc()));
 120   }
 121   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 122   // shut the door on sizing bugs
 123   int slop = 3;  // 32-bit offset is this much larger than an 8-bit one
 124   assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
 125 
 126   s->set_exception_points(npe_addr, ame_addr);
 127   return s;
 128 }
 129 
 130 
 131 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
 132   // Note well: pd_code_size_limit is the absolute minimum we can get
 133   // away with.  If you add code here, bump the code stub size
 134   // returned by pd_code_size_limit!
 135   const int amd64_code_length = VtableStub::pd_code_size_limit(false);
 136   VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index);


 203     __ cmpptr(method, (int32_t)NULL_WORD);
 204     __ jcc(Assembler::equal, L2);
 205     __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
 206     __ jcc(Assembler::notZero, L2);
 207     __ stop("compiler entrypoint is null");
 208     __ bind(L2);
 209   }
 210 #endif // ASSERT
 211 
 212   // rbx: Method*
 213   // j_rarg0: receiver
 214   address ame_addr = __ pc();
 215   __ jmp(Address(method, Method::from_compiled_offset()));
 216 
 217   __ bind(L_no_such_interface);
 218   __ jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
 219 
 220   __ flush();
 221 
 222   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 223     tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
 224                   itable_index, s->entry_point(),
 225                   (int)(s->code_end() - s->entry_point()),
 226                   (int)(s->code_end() - __ pc()));
 227   }
 228   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 229   // shut the door on sizing bugs
 230   int slop = 3;  // 32-bit offset is this much larger than an 8-bit one
 231   assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
 232 
 233   s->set_exception_points(npe_addr, ame_addr);
 234   return s;
 235 }
 236 
 237 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
 238   if (is_vtable_stub) {
 239     // Vtable stub size
 240     return (DebugVtables ? 512 : 24) + (CountCompiledCalls ? 13 : 0) +
 241            (UseCompressedClassPointers ?  MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
 242   } else {
 243     // Itable stub size




  96   __ lookup_virtual_method(rax, vtable_index, method);
  97 
  98   if (DebugVtables) {
  99     Label L;
 100     __ cmpptr(method, (int32_t)NULL_WORD);
 101     __ jcc(Assembler::equal, L);
 102     __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
 103     __ jcc(Assembler::notZero, L);
 104     __ stop("Vtable entry is NULL");
 105     __ bind(L);
 106   }
 107   // rax: receiver klass
 108   // rbx: Method*
 109   // rcx: receiver
 110   address ame_addr = __ pc();
 111   __ jmp( Address(rbx, Method::from_compiled_offset()));
 112 
 113   __ flush();
 114 
 115   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 116     tty->print_cr("vtable #%d at " PTR_FORMAT "[%d] left over: %d",
 117                   vtable_index, s->entry_point(),
 118                   (int)(s->code_end() - s->entry_point()),
 119                   (int)(s->code_end() - __ pc()));
 120   }
 121   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 122   // shut the door on sizing bugs
 123   int slop = 3;  // 32-bit offset is this much larger than an 8-bit one
 124   assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
 125 
 126   s->set_exception_points(npe_addr, ame_addr);
 127   return s;
 128 }
 129 
 130 
 131 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
 132   // Note well: pd_code_size_limit is the absolute minimum we can get
 133   // away with.  If you add code here, bump the code stub size
 134   // returned by pd_code_size_limit!
 135   const int amd64_code_length = VtableStub::pd_code_size_limit(false);
 136   VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index);


 203     __ cmpptr(method, (int32_t)NULL_WORD);
 204     __ jcc(Assembler::equal, L2);
 205     __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
 206     __ jcc(Assembler::notZero, L2);
 207     __ stop("compiler entrypoint is null");
 208     __ bind(L2);
 209   }
 210 #endif // ASSERT
 211 
 212   // rbx: Method*
 213   // j_rarg0: receiver
 214   address ame_addr = __ pc();
 215   __ jmp(Address(method, Method::from_compiled_offset()));
 216 
 217   __ bind(L_no_such_interface);
 218   __ jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
 219 
 220   __ flush();
 221 
 222   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 223     tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d",
 224                   itable_index, s->entry_point(),
 225                   (int)(s->code_end() - s->entry_point()),
 226                   (int)(s->code_end() - __ pc()));
 227   }
 228   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 229   // shut the door on sizing bugs
 230   int slop = 3;  // 32-bit offset is this much larger than an 8-bit one
 231   assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
 232 
 233   s->set_exception_points(npe_addr, ame_addr);
 234   return s;
 235 }
 236 
 237 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
 238   if (is_vtable_stub) {
 239     // Vtable stub size
 240     return (DebugVtables ? 512 : 24) + (CountCompiledCalls ? 13 : 0) +
 241            (UseCompressedClassPointers ?  MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
 242   } else {
 243     // Itable stub size


< prev index next >