changeset 10773:fbeda94727f8

Merge
author twisti
date Mon, 15 Jul 2013 17:58:17 -0700
parents dfc4b73e79e8 (diff) 395d34c10e26 (current diff)
children 0f8d0c86611d c0ce8e825f30
files
diffstat 8 files changed, 41 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java	Mon Jul 15 18:22:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java	Mon Jul 15 17:58:17 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	Mon Jul 15 18:22:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java	Mon Jul 15 17:58:17 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	Mon Jul 15 18:22:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Mon Jul 15 17:58:17 2013 -0700
@@ -268,6 +268,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	Mon Jul 15 18:22:25 2013 +0200
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Mon Jul 15 17:58:17 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/graalCompiler.cpp	Mon Jul 15 18:22:25 2013 +0200
+++ b/src/share/vm/graal/graalCompiler.cpp	Mon Jul 15 17:58:17 2013 -0700
@@ -203,12 +203,12 @@
   if (field_type == T_OBJECT || field_type == T_ARRAY) {
     KlassHandle handle = GraalEnv::get_klass_by_name(loading_klass, signature, false);
     if (handle.is_null()) {
-      return get_JavaType(signature, CHECK_NULL);
+      return get_JavaType(signature, CHECK_NH);
     } else {
-      return get_JavaType(handle, CHECK_NULL);
+      return get_JavaType(handle, CHECK_NH);
     }
   } else {
-    return VMToCompiler::createPrimitiveJavaType(field_type, CHECK_NULL);
+    return VMToCompiler::createPrimitiveJavaType(field_type, CHECK_NH);
   }
 }
 
@@ -229,7 +229,7 @@
       if (tag.is_klass()) {
         // The klass has been inserted into the constant pool
         // very recently.
-        return GraalCompiler::get_JavaType(cp->resolved_klass_at(index), CHECK_NULL);
+        return GraalCompiler::get_JavaType(cp->resolved_klass_at(index), CHECK_NH);
       } else if (tag.is_symbol()) {
         klass_name = cp->symbol_at(index);
       } else {
@@ -237,9 +237,9 @@
         klass_name = cp->unresolved_klass_at(index);
       }
     }
-    return GraalCompiler::get_JavaType(klass_name, CHECK_NULL);
+    return GraalCompiler::get_JavaType(klass_name, CHECK_NH);
   } else {
-    return GraalCompiler::get_JavaType(klass, CHECK_NULL);
+    return GraalCompiler::get_JavaType(klass, CHECK_NH);
   }
 }
 
@@ -254,19 +254,19 @@
     return VMToCompiler::createPrimitiveJavaType((int) basicType, THREAD);
   } else {
     KlassHandle klass = java_lang_Class::as_Klass(java_class());
-    Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL);
-    return GraalCompiler::createHotSpotResolvedObjectType(klass, name, CHECK_NULL);
+    Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NH);
+    return GraalCompiler::createHotSpotResolvedObjectType(klass, name, CHECK_NH);
   }
 }
 
 Handle GraalCompiler::get_JavaType(KlassHandle klass, TRAPS) {
   Handle name = java_lang_String::create_from_symbol(klass->name(), THREAD);
-  return createHotSpotResolvedObjectType(klass, name, CHECK_NULL);
+  return createHotSpotResolvedObjectType(klass, name, CHECK_NH);
 }
 
 Handle GraalCompiler::get_JavaField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, TRAPS) {
-  Handle name = java_lang_String::create_from_symbol(field_name, CHECK_NULL);
-  return VMToCompiler::createJavaField(field_holder, name, field_type, offset, flags, false, CHECK_NULL);
+  Handle name = java_lang_String::create_from_symbol(field_name, CHECK_NH);
+  return VMToCompiler::createJavaField(field_holder, name, field_type, offset, flags, false, CHECK_NH);
 }
 
 Handle GraalCompiler::createHotSpotResolvedObjectType(methodHandle method, TRAPS) {
@@ -277,8 +277,8 @@
     assert(graal_mirror->is_a(HotSpotResolvedObjectType::klass()), "unexpected class...");
     return graal_mirror;
   }
-  Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL);
-  return GraalCompiler::createHotSpotResolvedObjectType(klass, name, CHECK_NULL);
+  Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NH);
+  return GraalCompiler::createHotSpotResolvedObjectType(klass, name, CHECK_NH);
 }
 
 Handle GraalCompiler::createHotSpotResolvedObjectType(KlassHandle klass, Handle name, TRAPS) {
@@ -293,7 +293,7 @@
   if (klass->oop_is_instance()) {
     ResourceMark rm;
     InstanceKlass* ik = (InstanceKlass*) klass();
-    name = java_lang_String::create_from_str(ik->signature_name(), CHECK_NULL);
+    name = java_lang_String::create_from_str(ik->signature_name(), CHECK_NH);
   }
 
   int sizeOrSpecies;
@@ -308,7 +308,7 @@
     }
   }
 
-  return VMToCompiler::createResolvedJavaType(klass(), name, simpleName, java_class, sizeOrSpecies, CHECK_NULL);
+  return VMToCompiler::createResolvedJavaType(klass(), name, simpleName, java_class, sizeOrSpecies, CHECK_NH);
 }
 
 BasicType GraalCompiler::kindToBasicType(jchar ch) {
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Mon Jul 15 18:22:25 2013 +0200
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Mon Jul 15 17:58:17 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());
--- a/src/share/vm/graal/graalRuntime.hpp	Mon Jul 15 18:22:25 2013 +0200
+++ b/src/share/vm/graal/graalRuntime.hpp	Mon Jul 15 17:58:17 2013 -0700
@@ -34,9 +34,9 @@
   static void new_array(JavaThread* thread, Klass* klass, jint length);
   static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims);
   static void dynamic_new_array(JavaThread* thread, oop element_mirror, jint length);
-  static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupte);
+  static jboolean thread_is_interrupted(JavaThread* thread, oop obj, jboolean clear_interrupted);
   static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3);
-  static jint identity_hash_code(JavaThread* thread, oopDesc* objd);
+  static jint identity_hash_code(JavaThread* thread, oop obj);
   static address exception_handler_for_pc(JavaThread* thread);
   static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock);
   static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock);
--- a/src/share/vm/graal/graalVMToCompiler.cpp	Mon Jul 15 18:22:25 2013 +0200
+++ b/src/share/vm/graal/graalVMToCompiler.cpp	Mon Jul 15 17:58:17 2013 -0700
@@ -22,6 +22,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/systemDictionary.hpp"
 #include "graal/graalVMToCompiler.hpp"
 
 // this is a *global* handle
@@ -30,7 +31,7 @@
 Klass* VMToCompiler::_vmToCompilerPermKlass = NULL;
 
 static Klass* loadClass(Symbol* name) {
-  Klass* klass = SystemDictionary::resolve_or_null(name, SystemDictionary::java_system_loader(), NULL, Thread::current());
+  Klass* klass = SystemDictionary::resolve_or_null(name, SystemDictionary::java_system_loader(), Handle(), Thread::current());
   if (klass == NULL) {
     tty->print_cr("Could not load class %s", name->as_C_string());
     vm_abort(false);