changeset 3064:8b0236cbed14

Make sure that the compiler is initialized at startup (and not on the first compiled method).
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 22 Jun 2011 21:51:26 +0200
parents 848dd57066ad
children fef84503ab7d
files src/cpu/x86/vm/c1_MacroAssembler_x86.cpp src/os/windows/vm/os_windows.cpp src/share/vm/compiler/compileBroker.cpp src/share/vm/graal/graalCompiler.cpp src/share/vm/runtime/thread.cpp
diffstat 5 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Tue Jun 21 17:14:24 2011 +0200
+++ b/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Wed Jun 22 21:51:26 2011 +0200
@@ -283,11 +283,12 @@
       jcc(Assembler::notZero, loop);
     }
   }
-
-  if (CURRENT_ENV->dtrace_alloc_probes()) {
-    assert(obj == rax, "must be");
-    call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)));
-  }
+  
+  // (tw) fix me
+//  if (CURRENT_ENV->dtrace_alloc_probes()) {
+//    assert(obj == rax, "must be");
+//    call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)));
+//  }
 
   verify_oop(obj);
 }
@@ -317,10 +318,11 @@
   const Register len_zero = len;
   initialize_body(obj, arr_size, header_size * BytesPerWord, len_zero);
 
-  if (CURRENT_ENV->dtrace_alloc_probes()) {
-    assert(obj == rax, "must be");
-    call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)));
-  }
+  // (tw) fix me
+//  if (CURRENT_ENV->dtrace_alloc_probes()) {
+//    assert(obj == rax, "must be");
+//    call(RuntimeAddress(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)));
+//  }
 
   verify_oop(obj);
 }
--- a/src/os/windows/vm/os_windows.cpp	Tue Jun 21 17:14:24 2011 +0200
+++ b/src/os/windows/vm/os_windows.cpp	Wed Jun 22 21:51:26 2011 +0200
@@ -409,7 +409,6 @@
     }
   }
 
-
   if (UseVectoredExceptions) {
     // If we are using vectored exception we don't need to set a SEH
     thread->run();
--- a/src/share/vm/compiler/compileBroker.cpp	Tue Jun 21 17:14:24 2011 +0200
+++ b/src/share/vm/compiler/compileBroker.cpp	Wed Jun 22 21:51:26 2011 +0200
@@ -1534,6 +1534,12 @@
     log->stamp();
     log->end_elem();
   }
+  
+  if (UseGraal) {
+    thread->set_compiling(true); // Prevent recursive compilations while the compiler is initializing.
+    ThreadToNativeFromVM trans(JavaThread::current());
+    GraalCompiler::instance()->initialize();
+  }
 
   while (true) {
     {
--- a/src/share/vm/graal/graalCompiler.cpp	Tue Jun 21 17:14:24 2011 +0200
+++ b/src/share/vm/graal/graalCompiler.cpp	Wed Jun 22 21:51:26 2011 +0200
@@ -41,8 +41,8 @@
 // Initialization
 void GraalCompiler::initialize() {
   if (_initialized) return;
+  _initialized = true;
   CompilerThread* THREAD = CompilerThread::current();
-  _initialized = true;
   TRACE_graal_1("GraalCompiler::initialize");
 
   VmIds::initializeObjects();
@@ -99,7 +99,7 @@
 
 // Compilation entry point for methods
 void GraalCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
-  initialize();
+  assert(_initialized, "must already be initialized");
   VM_ENTRY_MARK;
   ResourceMark rm;
   HandleMark hm;
--- a/src/share/vm/runtime/thread.cpp	Tue Jun 21 17:14:24 2011 +0200
+++ b/src/share/vm/runtime/thread.cpp	Wed Jun 22 21:51:26 2011 +0200
@@ -29,6 +29,7 @@
 #include "classfile/vmSymbols.hpp"
 #include "code/scopeDesc.hpp"
 #include "compiler/compileBroker.hpp"
+#include "graal/graalCompiler.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/linkResolver.hpp"
 #include "jvmtifiles/jvmtiEnv.hpp"