59 // static stub relocation also tags the Method* in the code-stream. 60 __ mov_metadata(rmethod, (Metadata*)NULL); 61 __ movptr(rscratch1, 0); 62 __ br(rscratch1); 63 64 assert((__ offset() - offset) <= (int)to_interp_stub_size(), "stub too big"); 65 __ end_a_stub(); 66 return base; 67 } 68 #undef __ 69 70 int CompiledStaticCall::to_interp_stub_size() { 71 return 7 * NativeInstruction::instruction_size; 72 } 73 74 // Relocation entries for call stub, compiled java to interpreter. 75 int CompiledStaticCall::reloc_to_interp_stub() { 76 return 4; // 3 in emit_to_interp_stub + 1 in emit_call 77 } 78 79 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) { 80 address stub = find_stub(); 81 guarantee(stub != NULL, "stub not found"); 82 83 if (TraceICs) { 84 ResourceMark rm; 85 tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", 86 p2i(instruction_address()), 87 callee->name_and_sig_as_C_string()); 88 } 89 90 // Creation also verifies the object. 91 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub); 92 #ifndef PRODUCT 93 NativeGeneralJump* jump = nativeGeneralJump_at(method_holder->next_instruction_address()); 94 95 // read the value once 96 volatile intptr_t data = method_holder->data(); 97 assert(data == 0 || data == (intptr_t)callee(), 98 "a) MT-unsafe modification of inline cache"); 99 assert(data == 0 || jump->jump_destination() == entry, 100 "b) MT-unsafe modification of inline cache"); 101 #endif 102 // Update stub. 103 method_holder->set_data((intptr_t)callee()); 104 NativeGeneralJump::insert_unconditional(method_holder->next_instruction_address(), entry); 105 ICache::invalidate_range(stub, to_interp_stub_size()); 106 // Update jump to call. 107 set_destination_mt_safe(stub); 108 } 109 110 void CompiledStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) { 111 assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call"); 112 // Reset stub. 113 address stub = static_stub->addr(); 114 assert(stub != NULL, "stub not found"); 115 // Creation also verifies the object. 116 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub); 117 method_holder->set_data(0); 118 } 119 120 //----------------------------------------------------------------------------- 121 // Non-product mode code 122 #ifndef PRODUCT 123 124 void CompiledStaticCall::verify() { 125 // Verify call. 126 NativeCall::verify(); 127 if (os::is_MP()) { 128 verify_alignment(); 129 } 130 131 // Verify stub. 132 address stub = find_stub(); 133 assert(stub != NULL, "no stub found for static call"); 134 // Creation also verifies the object. 135 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub); 136 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 137 138 // Verify state. 139 assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check"); 140 } 141 142 #endif // !PRODUCT | 59 // static stub relocation also tags the Method* in the code-stream. 60 __ mov_metadata(rmethod, (Metadata*)NULL); 61 __ movptr(rscratch1, 0); 62 __ br(rscratch1); 63 64 assert((__ offset() - offset) <= (int)to_interp_stub_size(), "stub too big"); 65 __ end_a_stub(); 66 return base; 67 } 68 #undef __ 69 70 int CompiledStaticCall::to_interp_stub_size() { 71 return 7 * NativeInstruction::instruction_size; 72 } 73 74 // Relocation entries for call stub, compiled java to interpreter. 75 int CompiledStaticCall::reloc_to_interp_stub() { 76 return 4; // 3 in emit_to_interp_stub + 1 in emit_call 77 } 78 79 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) { 80 address stub = find_stub(false /* is_aot */); 81 guarantee(stub != NULL, "stub not found"); 82 83 if (TraceICs) { 84 ResourceMark rm; 85 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", 86 p2i(instruction_address()), 87 callee->name_and_sig_as_C_string()); 88 } 89 90 // Creation also verifies the object. 91 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub); 92 #ifndef PRODUCT 93 NativeGeneralJump* jump = nativeGeneralJump_at(method_holder->next_instruction_address()); 94 95 // read the value once 96 volatile intptr_t data = method_holder->data(); 97 assert(data == 0 || data == (intptr_t)callee(), 98 "a) MT-unsafe modification of inline cache"); 99 assert(data == 0 || jump->jump_destination() == entry, 100 "b) MT-unsafe modification of inline cache"); 101 #endif 102 // Update stub. 103 method_holder->set_data((intptr_t)callee()); 104 NativeGeneralJump::insert_unconditional(method_holder->next_instruction_address(), entry); 105 ICache::invalidate_range(stub, to_interp_stub_size()); 106 // Update jump to call. 107 set_destination_mt_safe(stub); 108 } 109 110 void CompiledDirectStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) { 111 assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call"); 112 // Reset stub. 113 address stub = static_stub->addr(); 114 assert(stub != NULL, "stub not found"); 115 // Creation also verifies the object. 116 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub); 117 method_holder->set_data(0); 118 } 119 120 //----------------------------------------------------------------------------- 121 // Non-product mode code 122 #ifndef PRODUCT 123 124 void CompiledDirectStaticCall::verify() { 125 // Verify call. 126 _call->verify(); 127 if (os::is_MP()) { 128 _call->verify_alignment(); 129 } 130 131 // Verify stub. 132 address stub = find_stub(false /* is_aot */); 133 assert(stub != NULL, "no stub found for static call"); 134 // Creation also verifies the object. 135 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub); 136 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address()); 137 138 // Verify state. 139 assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check"); 140 } 141 142 #endif // !PRODUCT |