< prev index next >

src/cpu/sparc/vm/vtableStubs_sparc.cpp

Print this page




  93     Label L;
  94     __ br_notnull_short(G5_method, Assembler::pt, L);
  95     __ stop("Vtable entry is ZERO");
  96     __ bind(L);
  97   }
  98 #endif
  99 
 100   address ame_addr = __ pc();  // if the vtable entry is null, the method is abstract
 101                                // NOTE: for vtable dispatches, the vtable entry will never be null.
 102 
 103   __ ld_ptr(G5_method, in_bytes(Method::from_compiled_offset()), G3_scratch);
 104 
 105   // jump to target (either compiled code or c2iadapter)
 106   __ JMP(G3_scratch, 0);
 107   // load Method* (in case we call c2iadapter)
 108   __ delayed()->nop();
 109 
 110   masm->flush();
 111 
 112   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 113     tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d",
 114                   vtable_index, p2i(s->entry_point()),
 115                   (int)(s->code_end() - s->entry_point()),
 116                   (int)(s->code_end() - __ pc()));
 117   }
 118   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 119   // shut the door on sizing bugs
 120   int slop = 2*BytesPerInstWord;  // 32-bit offset is this much larger than a 13-bit one
 121   assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add");
 122 
 123   s->set_exception_points(npe_addr, ame_addr);
 124   return s;
 125 }
 126 
 127 
 128 // NOTE:  %%%% if any change is made to this stub make sure that the function
 129 //             pd_code_size_limit is changed to ensure the correct size for VtableStub
 130 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
 131   const int sparc_code_length = VtableStub::pd_code_size_limit(false);
 132   VtableStub* s = new(sparc_code_length) VtableStub(false, itable_index);
 133   // Can be NULL if there is no free space in the code cache.


 188   __ restore(L5_method, 0, G5_method);
 189   // Restore registers *before* the AME point.
 190 
 191   address ame_addr = __ pc();   // if the vtable entry is null, the method is abstract
 192   __ ld_ptr(G5_method, in_bytes(Method::from_compiled_offset()), G3_scratch);
 193 
 194   // G5_method:  Method*
 195   // O0:         Receiver
 196   // G3_scratch: entry point
 197   __ JMP(G3_scratch, 0);
 198   __ delayed()->nop();
 199 
 200   __ bind(throw_icce);
 201   AddressLiteral icce(StubRoutines::throw_IncompatibleClassChangeError_entry());
 202   __ jump_to(icce, G3_scratch);
 203   __ delayed()->restore();
 204 
 205   masm->flush();
 206 
 207   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 208     tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
 209                   itable_index, p2i(s->entry_point()),
 210                   (int)(s->code_end() - s->entry_point()),
 211                   (int)(s->code_end() - __ pc()));
 212   }
 213   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 214   // shut the door on sizing bugs
 215   int slop = 2*BytesPerInstWord;  // 32-bit offset is this much larger than a 13-bit one
 216   assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add");
 217 
 218   s->set_exception_points(npe_addr, ame_addr);
 219   return s;
 220 }
 221 
 222 
 223 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
 224   if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
 225   else {
 226     const int slop = 2*BytesPerInstWord; // sethi;add  (needed for long offsets)
 227     if (is_vtable_stub) {
 228       // ld;ld;ld,jmp,nop




  93     Label L;
  94     __ br_notnull_short(G5_method, Assembler::pt, L);
  95     __ stop("Vtable entry is ZERO");
  96     __ bind(L);
  97   }
  98 #endif
  99 
 100   address ame_addr = __ pc();  // if the vtable entry is null, the method is abstract
 101                                // NOTE: for vtable dispatches, the vtable entry will never be null.
 102 
 103   __ ld_ptr(G5_method, in_bytes(Method::from_compiled_offset()), G3_scratch);
 104 
 105   // jump to target (either compiled code or c2iadapter)
 106   __ JMP(G3_scratch, 0);
 107   // load Method* (in case we call c2iadapter)
 108   __ delayed()->nop();
 109 
 110   masm->flush();
 111 
 112   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 113     tty->print_cr("vtable #%d at " PTR_FORMAT "[%d] left over: %d",
 114                   vtable_index, p2i(s->entry_point()),
 115                   (int)(s->code_end() - s->entry_point()),
 116                   (int)(s->code_end() - __ pc()));
 117   }
 118   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 119   // shut the door on sizing bugs
 120   int slop = 2*BytesPerInstWord;  // 32-bit offset is this much larger than a 13-bit one
 121   assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add");
 122 
 123   s->set_exception_points(npe_addr, ame_addr);
 124   return s;
 125 }
 126 
 127 
 128 // NOTE:  %%%% if any change is made to this stub make sure that the function
 129 //             pd_code_size_limit is changed to ensure the correct size for VtableStub
 130 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
 131   const int sparc_code_length = VtableStub::pd_code_size_limit(false);
 132   VtableStub* s = new(sparc_code_length) VtableStub(false, itable_index);
 133   // Can be NULL if there is no free space in the code cache.


 188   __ restore(L5_method, 0, G5_method);
 189   // Restore registers *before* the AME point.
 190 
 191   address ame_addr = __ pc();   // if the vtable entry is null, the method is abstract
 192   __ ld_ptr(G5_method, in_bytes(Method::from_compiled_offset()), G3_scratch);
 193 
 194   // G5_method:  Method*
 195   // O0:         Receiver
 196   // G3_scratch: entry point
 197   __ JMP(G3_scratch, 0);
 198   __ delayed()->nop();
 199 
 200   __ bind(throw_icce);
 201   AddressLiteral icce(StubRoutines::throw_IncompatibleClassChangeError_entry());
 202   __ jump_to(icce, G3_scratch);
 203   __ delayed()->restore();
 204 
 205   masm->flush();
 206 
 207   if (PrintMiscellaneous && (WizardMode || Verbose)) {
 208     tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d",
 209                   itable_index, p2i(s->entry_point()),
 210                   (int)(s->code_end() - s->entry_point()),
 211                   (int)(s->code_end() - __ pc()));
 212   }
 213   guarantee(__ pc() <= s->code_end(), "overflowed buffer");
 214   // shut the door on sizing bugs
 215   int slop = 2*BytesPerInstWord;  // 32-bit offset is this much larger than a 13-bit one
 216   assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add");
 217 
 218   s->set_exception_points(npe_addr, ame_addr);
 219   return s;
 220 }
 221 
 222 
 223 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
 224   if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
 225   else {
 226     const int slop = 2*BytesPerInstWord; // sethi;add  (needed for long offsets)
 227     if (is_vtable_stub) {
 228       // ld;ld;ld,jmp,nop


< prev index next >