< prev index next >

src/cpu/x86/vm/vtableStubs_x86_32.cpp

Print this page




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


 181 #ifdef ASSERT
 182   if (DebugVtables) {
 183       Label L1;
 184       __ cmpptr(method, (int32_t)NULL_WORD);
 185       __ jcc(Assembler::equal, L1);
 186       __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
 187       __ jcc(Assembler::notZero, L1);
 188       __ stop("Method* is null");
 189       __ bind(L1);
 190     }
 191 #endif // ASSERT
 192 
 193   address ame_addr = __ pc();
 194   __ jmp(Address(method, Method::from_compiled_offset()));
 195 
 196   __ bind(throw_icce);
 197   __ jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
 198   masm->flush();
 199 
 200   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 201     tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
 202                   itable_index, p2i(s->entry_point()),
 203                   (int)(s->code_end() - s->entry_point()),
 204                   (int)(s->code_end() - __ pc()));
 205   }
 206   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 207   // shut the door on sizing bugs
 208   int slop = 3;  // 32-bit offset is this much larger than an 8-bit one
 209   assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
 210 
 211   s->set_exception_points(npe_addr, ame_addr);
 212   return s;
 213 }
 214 
 215 
 216 
 217 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
 218   if (is_vtable_stub) {
 219     // Vtable stub size
 220     return (DebugVtables ? 210 : 16) + (CountCompiledCalls ? 6 : 0);
 221   } else {




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


 181 #ifdef ASSERT
 182   if (DebugVtables) {
 183       Label L1;
 184       __ cmpptr(method, (int32_t)NULL_WORD);
 185       __ jcc(Assembler::equal, L1);
 186       __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
 187       __ jcc(Assembler::notZero, L1);
 188       __ stop("Method* is null");
 189       __ bind(L1);
 190     }
 191 #endif // ASSERT
 192 
 193   address ame_addr = __ pc();
 194   __ jmp(Address(method, Method::from_compiled_offset()));
 195 
 196   __ bind(throw_icce);
 197   __ jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
 198   masm->flush();
 199 
 200   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 201     tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d",
 202                   itable_index, p2i(s->entry_point()),
 203                   (int)(s->code_end() - s->entry_point()),
 204                   (int)(s->code_end() - __ pc()));
 205   }
 206   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 207   // shut the door on sizing bugs
 208   int slop = 3;  // 32-bit offset is this much larger than an 8-bit one
 209   assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
 210 
 211   s->set_exception_points(npe_addr, ame_addr);
 212   return s;
 213 }
 214 
 215 
 216 
 217 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
 218   if (is_vtable_stub) {
 219     // Vtable stub size
 220     return (DebugVtables ? 210 : 16) + (CountCompiledCalls ? 6 : 0);
 221   } else {


< prev index next >