36 37 // Release the CompiledICHolder* associated with this call site is there is one. 38 void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { 39 // This call site might have become stale so inspect it carefully. 40 NativeCall* call = nativeCall_at(call_site->addr()); 41 if (is_icholder_entry(call->destination())) { 42 NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); 43 InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); 44 } 45 } 46 47 bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { 48 // This call site might have become stale so inspect it carefully. 49 NativeCall* call = nativeCall_at(call_site->addr()); 50 return is_icholder_entry(call->destination()); 51 } 52 53 // ---------------------------------------------------------------------------- 54 55 #define __ _masm. 56 address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) { 57 #ifdef COMPILER2 58 // Stub is fixed up when the corresponding call is converted from calling 59 // compiled code to calling interpreted code. 60 // set (empty), G5 61 // jmp -1 62 63 address mark = cbuf.insts_mark(); // Get mark within main instrs section. 64 65 MacroAssembler _masm(&cbuf); 66 67 address base = __ start_a_stub(to_interp_stub_size()); 68 if (base == NULL) { 69 return NULL; // CodeBuffer::expand failed. 70 } 71 72 // Static stub relocation stores the instruction address of the call. 73 __ relocate(static_stub_Relocation::spec(mark)); 74 75 __ set_metadata(NULL, as_Register(Matcher::inline_cache_reg_encode())); 76 77 __ set_inst_mark(); 78 AddressLiteral addrlit(-1); 79 __ JUMP(addrlit, G3, 0); 80 81 __ delayed()->nop(); 82 83 // Update current stubs pointer and restore code_end. 84 __ end_a_stub(); 85 return base; 86 #else 87 ShouldNotReachHere(); 88 #endif 89 } 90 #undef __ 91 92 int CompiledStaticCall::to_interp_stub_size() { 93 // This doesn't need to be accurate but it must be larger or equal to 94 // the real size of the stub. 95 return (NativeMovConstReg::instruction_size + // sethi/setlo; 96 NativeJump::instruction_size + // sethi; jmp; nop 97 (TraceJumps ? 20 * BytesPerInstWord : 0) ); 98 } 99 100 // Relocation entries for call stub, compiled java to interpreter. 101 int CompiledStaticCall::reloc_to_interp_stub() { 102 return 10; // 4 in emit_java_to_interp + 1 in Java_Static_Call 103 } 104 105 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) { 106 address stub = find_stub(); 107 guarantee(stub != NULL, "stub not found"); 108 | 36 37 // Release the CompiledICHolder* associated with this call site is there is one. 38 void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { 39 // This call site might have become stale so inspect it carefully. 40 NativeCall* call = nativeCall_at(call_site->addr()); 41 if (is_icholder_entry(call->destination())) { 42 NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); 43 InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); 44 } 45 } 46 47 bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { 48 // This call site might have become stale so inspect it carefully. 49 NativeCall* call = nativeCall_at(call_site->addr()); 50 return is_icholder_entry(call->destination()); 51 } 52 53 // ---------------------------------------------------------------------------- 54 55 #define __ _masm. 56 address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf, address mark) { 57 // Stub is fixed up when the corresponding call is converted from calling 58 // compiled code to calling interpreted code. 59 // set (empty), G5 60 // jmp -1 61 62 if (mark == NULL) { 63 mark = cbuf.insts_mark(); // Get mark within main instrs section. 64 } 65 66 MacroAssembler _masm(&cbuf); 67 68 address base = __ start_a_stub(to_interp_stub_size()); 69 if (base == NULL) { 70 return NULL; // CodeBuffer::expand failed. 71 } 72 73 // Static stub relocation stores the instruction address of the call. 74 __ relocate(static_stub_Relocation::spec(mark)); 75 76 __ set_metadata(NULL, as_Register(Matcher::inline_cache_reg_encode())); 77 78 __ set_inst_mark(); 79 AddressLiteral addrlit(-1); 80 __ JUMP(addrlit, G3, 0); 81 82 __ delayed()->nop(); 83 84 assert(__ pc() - base <= to_interp_stub_size(), "wrong stub size"); 85 86 // Update current stubs pointer and restore code_end. 87 __ end_a_stub(); 88 return base; 89 } 90 #undef __ 91 92 int CompiledStaticCall::to_interp_stub_size() { 93 // This doesn't need to be accurate but it must be larger or equal to 94 // the real size of the stub. 95 return (NativeMovConstReg::instruction_size + // sethi/setlo; 96 NativeJump::instruction_size + // sethi; jmp; nop 97 (TraceJumps ? 20 * BytesPerInstWord : 0) ); 98 } 99 100 // Relocation entries for call stub, compiled java to interpreter. 101 int CompiledStaticCall::reloc_to_interp_stub() { 102 return 10; // 4 in emit_java_to_interp + 1 in Java_Static_Call 103 } 104 105 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) { 106 address stub = find_stub(); 107 guarantee(stub != NULL, "stub not found"); 108 |