src/share/vm/code/compiledIC.cpp

Print this page
rev 3825 : Specify offset of IC load in java_to_interp stub.

If a compiled static call calls the interpreter, it jumps past a
java_to_interp stub in the compiled code. Patching this call must
find the load of the IC. So far the shared code assumed this is the
first instruction in the stub.
This might not be the case if, for example, the base of the constant
table must be loaded.
Extend CompiledStaticCall to consider an offset from its beginning
where to search the load of the IC.

@@ -559,11 +559,11 @@
     tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
                   instruction_address(),
                   callee->name_and_sig_as_C_string());
   }
 
-  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);   // creation also verifies the object
+  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + comp_to_int_load_offset);   // creation also verifies the object
   NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
 
   assert(method_holder->data()    == 0           || method_holder->data()    == (intptr_t)callee(), "a) MT-unsafe modification of inline cache");
   assert(jump->jump_destination() == (address)-1 || jump->jump_destination() == entry, "b) MT-unsafe modification of inline cache");
 

@@ -622,11 +622,11 @@
 void CompiledStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) {
   assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
   // Reset stub
   address stub = static_stub->addr();
   assert(stub!=NULL, "stub not found");
-  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);   // creation also verifies the object
+  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + comp_to_int_load_offset);   // creation also verifies the object
   NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
   method_holder->set_data(0);
   jump->set_jump_destination((address)-1);
 }
 

@@ -701,13 +701,18 @@
   }
 
   // Verify stub
   address stub = find_stub();
   assert(stub != NULL, "no stub found for static call");
-  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);   // creation also verifies the object
+  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub + comp_to_int_load_offset);   // creation also verifies the object
+
   NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
 
   // Verify state
   assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check");
 }
 
+#endif // !PRODUCT
+
+#ifndef COMPILER2
+const int CompiledStaticCall::comp_to_int_load_offset = 0;
 #endif