changeset 10771:ec8ee1c2ad7a

Move non_oop_bits value up to Graal.
author twisti
date Fri, 12 Jul 2013 10:10:07 -0700
parents 4e6d6122c558
children dfc4b73e79e8
files graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalCompilerToVM.cpp
diffstat 5 files changed, 22 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java	Thu Jul 11 10:31:16 2013 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java	Fri Jul 12 10:10:07 2013 -0700
@@ -25,6 +25,7 @@
 import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
+import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
@@ -35,9 +36,6 @@
 /**
  * A direct call that complies with the conventions for such calls in HotSpot. In particular, for
  * calls using an inline cache, a MOVE instruction is emitted just prior to the aligned direct call.
- * This instruction (which moves 0L in RAX) is patched by the C++ Graal code to replace the 0L
- * constant with Universe::non_oop_word(), a special sentinel used for the initial value of the
- * Klass in an inline cache. It puts the called method into rbx before calling.
  */
 @Opcode("CALL_DIRECT")
 final class AMD64HotspotDirectStaticCallOp extends DirectCallOp {
@@ -55,12 +53,10 @@
     @Override
     public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
         // The mark for an invocation that uses an inline cache must be placed at the
-        // instruction
-        // that loads the Klass from the inline cache so that the C++ code can find it
-        // and replace the inline 0L value with Universe::non_oop_word()
+        // instruction that loads the Klass from the inline cache.
         AMD64Move.move(tasm, masm, AMD64.rbx.asValue(Kind.Long), metaspaceMethod);
         tasm.recordMark(invokeKind == InvokeKind.Static ? Marks.MARK_INVOKESTATIC : Marks.MARK_INVOKESPECIAL);
-        AMD64Move.move(tasm, masm, AMD64.rax.asValue(Kind.Long), Constant.LONG_0);
+        AMD64Move.move(tasm, masm, AMD64.rax.asValue(Kind.Long), Constant.forLong(HotSpotGraalRuntime.graalRuntime().getConfig().nonOopBits));
         super.emitCode(tasm, masm);
     }
 }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java	Thu Jul 11 10:31:16 2013 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java	Fri Jul 12 10:10:07 2013 -0700
@@ -27,6 +27,7 @@
 import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
+import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
@@ -37,9 +38,6 @@
 /**
  * A direct call that complies with the conventions for such calls in HotSpot. In particular, for
  * calls using an inline cache, a MOVE instruction is emitted just prior to the aligned direct call.
- * This instruction (which moves 0L in RAX) is patched by the C++ Graal code to replace the 0L
- * constant with Universe::non_oop_word(), a special sentinel used for the initial value of the
- * Klass in an inline cache.
  */
 @Opcode("CALL_DIRECT")
 final class AMD64HotspotDirectVirtualCallOp extends DirectCallOp {
@@ -55,11 +53,9 @@
     @Override
     public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
         // The mark for an invocation that uses an inline cache must be placed at the
-        // instruction
-        // that loads the Klass from the inline cache so that the C++ code can find it
-        // and replace the inline 0L value with Universe::non_oop_word()
+        // instruction that loads the Klass from the inline cache.
         tasm.recordMark(invokeKind == Virtual ? Marks.MARK_INVOKEVIRTUAL : Marks.MARK_INVOKEINTERFACE);
-        AMD64Move.move(tasm, masm, AMD64.rax.asValue(Kind.Long), Constant.LONG_0);
+        AMD64Move.move(tasm, masm, AMD64.rax.asValue(Kind.Long), Constant.forLong(HotSpotGraalRuntime.graalRuntime().getConfig().nonOopBits));
         super.emitCode(tasm, masm);
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Thu Jul 11 10:31:16 2013 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Fri Jul 12 10:10:07 2013 -0700
@@ -265,6 +265,12 @@
      */
     public int threadIsMethodHandleReturnOffset;
 
+    /**
+     * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value
+     * are allowed to look like (respectively) the high or low bits of a real oop.
+     */
+    public long nonOopBits;
+
     public long verifyOopCounterAddress;
     public long verifyOopMask;
     public long verifyOopBits;
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Thu Jul 11 10:31:16 2013 -0700
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Fri Jul 12 10:10:07 2013 -0700
@@ -788,7 +788,7 @@
     assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected");
     jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
 
-    address instruction = _instructions->start() + pc_offset;
+    address pc = _instructions->start() + pc_offset;
 
     switch (id) {
       case MARK_UNVERIFIED_ENTRY:
@@ -807,40 +807,34 @@
         _offsets.set_value(CodeOffsets::Deopt, pc_offset);
         break;
       case MARK_INVOKEVIRTUAL:
-      case MARK_INVOKEINTERFACE: {
-        // Convert the initial value of the Klass* slot in an inline cache
-        // from 0L to Universe::non_oop_word().
-        NativeMovConstReg* n_copy = nativeMovConstReg_at(instruction);
-        assert(n_copy->data() == 0, "inline cache Klass* initial value should be 0L");
-        n_copy->set_data((intptr_t)Universe::non_oop_word());
-      }
+      case MARK_INVOKEINTERFACE:
       case MARK_INLINE_INVOKE:
       case MARK_INVOKESTATIC:
       case MARK_INVOKESPECIAL:
         _next_call_type = (MarkId) id;
-        _invoke_mark_pc = instruction;
+        _invoke_mark_pc = pc;
         break;
       case MARK_POLL_NEAR: {
-        NativeInstruction* ni = nativeInstruction_at(instruction);
-        int32_t* disp = (int32_t*) pd_locate_operand(instruction);
+        NativeInstruction* ni = nativeInstruction_at(pc);
+        int32_t* disp = (int32_t*) pd_locate_operand(pc);
         // int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand);
         int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand
         intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni;
         *disp = (int32_t)new_disp;
       }
       case MARK_POLL_FAR:
-        _instructions->relocate(instruction, relocInfo::poll_type);
+        _instructions->relocate(pc, relocInfo::poll_type);
         break;
       case MARK_POLL_RETURN_NEAR: {
-        NativeInstruction* ni = nativeInstruction_at(instruction);
-        int32_t* disp = (int32_t*) pd_locate_operand(instruction);
+        NativeInstruction* ni = nativeInstruction_at(pc);
+        int32_t* disp = (int32_t*) pd_locate_operand(pc);
         // int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand);
         int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand
         intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni;
         *disp = (int32_t)new_disp;
       }
       case MARK_POLL_RETURN_FAR:
-        _instructions->relocate(instruction, relocInfo::poll_return_type);
+        _instructions->relocate(pc, relocInfo::poll_return_type);
         break;
       default:
         ShouldNotReachHere();
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Thu Jul 11 10:31:16 2013 -0700
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Fri Jul 12 10:10:07 2013 -0700
@@ -786,6 +786,7 @@
   set_boolean("tlabStats", TLABStats);
   set_boolean("inlineContiguousAllocationSupported", !CMSIncrementalMode && Universe::heap()->supports_inline_contig_alloc());
 
+  set_address("nonOopBits", Universe::non_oop_word());
   set_long("verifyOopCounterAddress", (jlong)(address) StubRoutines::verify_oop_count_addr());
   set_long("verifyOopMask", Universe::verify_oop_mask());
   set_long("verifyOopBits", Universe::verify_oop_bits());