33 34 // Release the CompiledICHolder* associated with this call site is there is one. 35 void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { 36 // This call site might have become stale so inspect it carefully. 37 NativeCall* call = nativeCall_at(call_site->addr()); 38 if (is_icholder_entry(call->destination())) { 39 NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); 40 InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); 41 } 42 } 43 44 bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { 45 // This call site might have become stale so inspect it carefully. 46 NativeCall* call = nativeCall_at(call_site->addr()); 47 return is_icholder_entry(call->destination()); 48 } 49 50 // ---------------------------------------------------------------------------- 51 52 #define __ _masm. 53 void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) { 54 // Stub is fixed up when the corresponding call is converted from 55 // calling compiled code to calling interpreted code. 56 // movq rbx, 0 57 // jmp -5 # to self 58 59 address mark = cbuf.insts_mark(); // Get mark within main instrs section. 60 61 // Note that the code buffer's insts_mark is always relative to insts. 62 // That's why we must use the macroassembler to generate a stub. 63 MacroAssembler _masm(&cbuf); 64 65 address base = 66 __ start_a_stub(to_interp_stub_size()*2); 67 if (base == NULL) return; // CodeBuffer::expand failed. 68 // Static stub relocation stores the instruction address of the call. 69 __ relocate(static_stub_Relocation::spec(mark), Assembler::imm_operand); 70 // Static stub relocation also tags the Method* in the code-stream. 71 __ mov_metadata(rbx, (Metadata*) NULL); // Method is zapped till fixup time. 72 // This is recognized as unresolved by relocs/nativeinst/ic code. 73 __ jump(RuntimeAddress(__ pc())); 74 75 // Update current stubs pointer and restore insts_end. 76 __ end_a_stub(); 77 } 78 #undef __ 79 80 int CompiledStaticCall::to_interp_stub_size() { 81 return NOT_LP64(10) // movl; jmp 82 LP64_ONLY(15); // movq (1+1+8); jmp (1+4) 83 } 84 85 // Relocation entries for call stub, compiled java to interpreter. 86 int CompiledStaticCall::reloc_to_interp_stub() { 87 return 4; // 3 in emit_to_interp_stub + 1 in emit_call 88 } 89 90 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) { 91 address stub = find_stub(); 92 guarantee(stub != NULL, "stub not found"); 93 94 if (TraceICs) { 95 ResourceMark rm; 96 tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", | 33 34 // Release the CompiledICHolder* associated with this call site is there is one. 35 void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { 36 // This call site might have become stale so inspect it carefully. 37 NativeCall* call = nativeCall_at(call_site->addr()); 38 if (is_icholder_entry(call->destination())) { 39 NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); 40 InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); 41 } 42 } 43 44 bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { 45 // This call site might have become stale so inspect it carefully. 46 NativeCall* call = nativeCall_at(call_site->addr()); 47 return is_icholder_entry(call->destination()); 48 } 49 50 // ---------------------------------------------------------------------------- 51 52 #define __ _masm. 53 address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) { 54 // Stub is fixed up when the corresponding call is converted from 55 // calling compiled code to calling interpreted code. 56 // movq rbx, 0 57 // jmp -5 # to self 58 59 address mark = cbuf.insts_mark(); // Get mark within main instrs section. 60 61 // Note that the code buffer's insts_mark is always relative to insts. 62 // That's why we must use the macroassembler to generate a stub. 63 MacroAssembler _masm(&cbuf); 64 65 address base = __ start_a_stub(to_interp_stub_size()); 66 if (base == NULL) { 67 return NULL; // CodeBuffer::expand failed. 68 } 69 // Static stub relocation stores the instruction address of the call. 70 __ relocate(static_stub_Relocation::spec(mark), Assembler::imm_operand); 71 // Static stub relocation also tags the Method* in the code-stream. 72 __ mov_metadata(rbx, (Metadata*) NULL); // Method is zapped till fixup time. 73 // This is recognized as unresolved by relocs/nativeinst/ic code. 74 __ jump(RuntimeAddress(__ pc())); 75 76 // Update current stubs pointer and restore insts_end. 77 __ end_a_stub(); 78 return base; 79 } 80 #undef __ 81 82 int CompiledStaticCall::to_interp_stub_size() { 83 return NOT_LP64(10) // movl; jmp 84 LP64_ONLY(15); // movq (1+1+8); jmp (1+4) 85 } 86 87 // Relocation entries for call stub, compiled java to interpreter. 88 int CompiledStaticCall::reloc_to_interp_stub() { 89 return 4; // 3 in emit_to_interp_stub + 1 in emit_call 90 } 91 92 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) { 93 address stub = find_stub(); 94 guarantee(stub != NULL, "stub not found"); 95 96 if (TraceICs) { 97 ResourceMark rm; 98 tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", |