changeset 10409:36bcc10e01c0

merge fixes
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Jun 2013 15:37:32 +0200
parents 836a62f43af9
children 9062da84cd75
files hotspot/.project src/cpu/sparc/vm/compiledIC_sparc.cpp src/cpu/x86/vm/compiledIC_x86.cpp src/cpu/x86/vm/sharedRuntime_x86_64.cpp src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalEnv.cpp src/share/vm/oops/method.cpp src/share/vm/runtime/arguments.cpp src/share/vm/runtime/compilationPolicy.cpp src/share/vm/runtime/globals.hpp src/share/vm/runtime/sharedRuntime.cpp src/share/vm/runtime/thread.hpp
diffstat 12 files changed, 78 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/.project	Wed Jun 19 10:45:56 2013 +0200
+++ b/hotspot/.project	Wed Jun 19 15:37:32 2013 +0200
@@ -86,6 +86,11 @@
 	</natures>
 	<linkedResources>
 		<link>
+			<name>ptx</name>
+			<type>2</type>
+			<locationURI>PARENT-1-PROJECT_LOC/src/gpu/ptx</locationURI>
+		</link>
+		<link>
 			<name>x86</name>
 			<type>2</type>
 			<locationURI>PARENT-1-PROJECT_LOC/src/cpu/x86/vm</locationURI>
--- a/src/cpu/sparc/vm/compiledIC_sparc.cpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/cpu/sparc/vm/compiledIC_sparc.cpp	Wed Jun 19 15:37:32 2013 +0200
@@ -130,6 +130,12 @@
 
 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
   address stub = find_stub();
+#ifdef GRAAL
+  if (stub == NULL) {
+    set_destination_mt_safe(entry);
+    return;
+  }
+#endif
   guarantee(stub != NULL, "stub not found");
 
   if (TraceICs) {
@@ -181,10 +187,12 @@
 
   // Verify stub.
   address stub = find_stub();
+#ifndef GRAAL
   assert(stub != NULL, "no stub found for static call");
   // Creation also verifies the object.
   NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
   NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
+#endif
 
   // Verify state.
   assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check");
--- a/src/cpu/x86/vm/compiledIC_x86.cpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/cpu/x86/vm/compiledIC_x86.cpp	Wed Jun 19 15:37:32 2013 +0200
@@ -117,6 +117,12 @@
 
 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
   address stub = find_stub();
+#ifdef GRAAL
+  if (stub == NULL) {
+    set_destination_mt_safe(entry);
+    return;
+  }
+#endif
   guarantee(stub != NULL, "stub not found");
 
   if (TraceICs) {
@@ -168,10 +174,12 @@
 
   // Verify stub.
   address stub = find_stub();
+#ifndef GRAAL
   assert(stub != NULL, "no stub found for static call");
   // Creation also verifies the object.
   NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
   NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
+#endif
 
   // Verify state.
   assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check");
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Wed Jun 19 15:37:32 2013 +0200
@@ -3357,8 +3357,7 @@
 
 #ifdef GRAAL
   int implicit_exception_uncommon_trap_offset = __ pc() - start;
-  // pc where the exception happened is in ScratchA
-  __ pushptr(Address(r15_thread, in_bytes(JavaThread::ScratchA_offset())));
+  __ pushptr(Address(r15_thread, in_bytes(JavaThread::graal_implicit_exception_pc_offset())));
 
   int uncommon_trap_offset = __ pc() - start;
 
--- a/src/share/vm/graal/graalCompiler.cpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/share/vm/graal/graalCompiler.cpp	Wed Jun 19 15:37:32 2013 +0200
@@ -136,7 +136,7 @@
     } else {
       length = _deopted_leaf_graph_count;
     }
-    elements = new jlong[length];
+    elements = NEW_C_HEAP_ARRAY(jlong, length, mtCompiler);
     for (int i = 0; i < length; i++) {
       elements[i] = _deopted_leaf_graphs[i];
     }
@@ -146,7 +146,7 @@
   for (int i = 0; i < length; i++) {
     array->long_at_put(i, elements[i]);
   }
-  delete elements;
+  FREE_C_HEAP_ARRAY(jlong, elements, mtCompiler);
   return array;
 }
 
@@ -171,7 +171,8 @@
   ResourceMark rm;
   JavaThread::current()->set_is_compiling(true);
   Handle holder = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK);
-  VMToCompiler::compileMethod(method(), holder, entry_bci, blocking, method->graal_priority());
+  MethodCounters* mcs = method->method_counters();
+  VMToCompiler::compileMethod(method(), holder, entry_bci, blocking, mcs->graal_priority());
   JavaThread::current()->set_is_compiling(false);
 }
 
@@ -223,7 +224,8 @@
       // We have to lock the cpool to keep the oop from being resolved
       // while we are accessing it. But we must release the lock before
       // calling up into Java.
-      MonitorLockerEx ml(cp->lock());
+      oop cplock = cp->lock();
+      ObjectLocker ol(cplock, THREAD, cplock != NULL);
       constantTag tag = cp->tag_at(index);
       if (tag.is_klass()) {
         // The klass has been inserted into the constant pool
--- a/src/share/vm/graal/graalEnv.cpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/share/vm/graal/graalEnv.cpp	Wed Jun 19 15:37:32 2013 +0200
@@ -172,7 +172,8 @@
     {
       // We have to lock the cpool to keep the oop from being resolved
       // while we are accessing it.
-      MutexLockerEx ml(cpool->lock(), Mutex::_no_safepoint_check_flag);
+      oop cplock = cpool->lock();
+      ObjectLocker ol(cplock, THREAD, cplock != NULL);
 
       constantTag tag = cpool->tag_at(index);
       if (tag.is_klass()) {
--- a/src/share/vm/oops/method.cpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/share/vm/oops/method.cpp	Wed Jun 19 15:37:32 2013 +0200
@@ -1988,5 +1988,3 @@
   guarantee(md == NULL ||
       md->is_methodData(), "should be method data");
 }
-
-#endif
--- a/src/share/vm/runtime/arguments.cpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/share/vm/runtime/arguments.cpp	Wed Jun 19 15:37:32 2013 +0200
@@ -2219,6 +2219,38 @@
     FLAG_SET_CMDLINE(bool, UseCompressedOops, false);
   }
 
+  if (UseCompressedKlassPointers) {
+    if (IgnoreUnrecognizedVMOptions) {
+      warning("UseCompressedKlassPointers is disabled, because it is not supported by Graal");
+      FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false);
+    } else {
+      jio_fprintf(defaultStream::error_stream(),
+                    "UseCompressedKlassPointers are not supported in Graal at the moment\n");
+      status = false;
+    }
+  } else {
+    // This prevents the flag being set to true by set_ergonomics_flags()
+    FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false);
+  }
+  if (UseG1GC) {
+      if (IgnoreUnrecognizedVMOptions) {
+        warning("UseG1GC is still experimental in Graal, use SerialGC instead ");
+        FLAG_SET_CMDLINE(bool, UseG1GC, true);
+      } else {
+        warning("UseG1GC is still experimental in Graal, use SerialGC instead ");
+        status = true;
+      }
+    } else {
+      // This prevents the flag being set to true by set_ergonomics_flags()
+      FLAG_SET_CMDLINE(bool, UseG1GC, false);
+    }
+
+  if (!ScavengeRootsInCode) {
+      warning("forcing ScavengeRootsInCode non-zero because Graal is enabled");
+      ScavengeRootsInCode = 1;
+  }
+
+#endif
   return status;
 }
 
--- a/src/share/vm/runtime/compilationPolicy.cpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/share/vm/runtime/compilationPolicy.cpp	Wed Jun 19 15:37:32 2013 +0200
@@ -482,8 +482,9 @@
 
 void GraalCompPolicy::method_invocation_event(methodHandle m, JavaThread* thread) {
   MethodCounters* mcs = m->method_counters();
+  assert(mcs != NULL, "method counters should be initialized");
   int hot_count = m->invocation_count();
-  jlong hot_time = (mcs == NULL) ? 0 : mcs->graal_invocation_time();
+  jlong hot_time = mcs->graal_invocation_time();
   reset_counter_for_invocation_event(m);
 
   if (is_compilation_enabled() && can_be_compiled(m)) {
@@ -497,18 +498,18 @@
         }
         if (UseNewCode) {
           if (m->queued_for_compilation()) {
-            if (time_per_call < (m->graal_priority() / 5)) {
-              m->set_graal_priority(time_per_call);
+            if (time_per_call < (mcs->graal_priority() / 5)) {
+              mcs->set_graal_priority(time_per_call);
               m->clear_queued_for_compilation();
             }
           } else {
-            if (time_per_call < m->graal_priority()) {
-              m->set_graal_priority(time_per_call);
+            if (time_per_call < mcs->graal_priority()) {
+              mcs->set_graal_priority(time_per_call);
             }
           }
         } else {
-          if (time_per_call < m->graal_priority()) {
-            m->set_graal_priority(time_per_call);
+          if (time_per_call < mcs->graal_priority()) {
+            mcs->set_graal_priority(time_per_call);
           }
         }
       }
--- a/src/share/vm/runtime/globals.hpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/share/vm/runtime/globals.hpp	Wed Jun 19 15:37:32 2013 +0200
@@ -3709,6 +3709,9 @@
   product(bool , AllowNonVirtualCalls, false,                               \
           "Obey the ACC_SUPER flag and allow invokenonvirtual calls")       \
                                                                             \
+  product(bool, TraceWarpLoading, false,                                    \
+          "Trace external GPU warp loading")                                \
+                                                                            \
   diagnostic(ccstr, SharedArchiveFile, NULL,                                \
           "Override the default location of the CDS archive file")          \
                                                                             \
--- a/src/share/vm/runtime/sharedRuntime.cpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Wed Jun 19 15:37:32 2013 +0200
@@ -781,7 +781,7 @@
 #ifdef GRAAL
 address SharedRuntime::deoptimize_for_implicit_exception(JavaThread* thread, address pc, nmethod* nm, int deopt_reason) {
   assert(deopt_reason > Deoptimization::Reason_none && deopt_reason < Deoptimization::Reason_LIMIT, "invalid deopt reason");
-  thread->_ScratchA = (intptr_t)pc;
+  thread->set_graal_implicit_exception_pc(pc);
   thread->set_pending_deoptimization(Deoptimization::make_trap_request((Deoptimization::DeoptReason)deopt_reason, Deoptimization::Action_reinterpret));
   return (SharedRuntime::deopt_blob()->implicit_exception_uncommon_trap());
 }
--- a/src/share/vm/runtime/thread.hpp	Wed Jun 19 10:45:56 2013 +0200
+++ b/src/share/vm/runtime/thread.hpp	Wed Jun 19 15:37:32 2013 +0200
@@ -898,7 +898,8 @@
  private:
 
 #ifdef GRAAL
-  address _graal_alternate_call_target;
+  address   _graal_alternate_call_target;
+  address   _graal_implicit_exception_pc;  // pc at which the most recent implicit exception occurred
 #endif
   StackGuardState        _stack_guard_state;
 
@@ -1273,6 +1274,7 @@
 
 #ifdef GRAAL
   void set_graal_alternate_call_target(address a) { _graal_alternate_call_target = a; }
+  void set_graal_implicit_exception_pc(address a) { _graal_implicit_exception_pc = a; }
 #endif
 
   // Exception handling for compiled methods
@@ -1357,6 +1359,7 @@
   static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread            ); }
 #ifdef GRAAL
   static ByteSize graal_alternate_call_target_offset() { return byte_offset_of(JavaThread, _graal_alternate_call_target); }
+  static ByteSize graal_implicit_exception_pc_offset() { return byte_offset_of(JavaThread, _graal_implicit_exception_pc); }
 #endif
   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }