changeset 3664:6e1abd79e7c8

Register assumptions before anything else. Don't free code blob (it is reused).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 17 Nov 2011 19:11:55 +0100
parents 8c46cdb684d4
children 3c31c42c0cd3 e755289380e3 5c8fc9f05960
files src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalCodeInstaller.hpp src/share/vm/graal/graalEnv.cpp
diffstat 3 files changed, 21 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Thu Nov 17 18:33:33 2011 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Thu Nov 17 19:11:55 2011 +0100
@@ -235,16 +235,14 @@
   _env = CURRENT_ENV;
   GraalCompiler::initialize_buffer_blob();
   CodeBuffer buffer(JavaThread::current()->get_buffer_blob());
-
-  {
-    No_Safepoint_Verifier no_safepoint;
-    initialize_fields(target_method);
-    initialize_buffer(buffer);
-    process_exception_handlers();
-  }
-
-  if (_assumptions != NULL) {
-    objArrayHandle assumptions = (objArrayOop)_assumptions;
+  
+  _oop_recorder = new OopRecorder(_env->arena());
+  _env->set_oop_recorder(_oop_recorder);
+  _env->set_dependencies(_dependencies);
+  _dependencies = new Dependencies(_env);
+  Handle assumptions_handle = CiTargetMethod::assumptions(HotSpotTargetMethod::targetMethod(target_method));
+  if (!assumptions_handle.is_null()) {
+    objArrayHandle assumptions = (objArrayOop)CiAssumptions::list(assumptions_handle());
     for (int i = 0; i < assumptions->length(); ++i) {
       Handle assumption = assumptions->obj_at(i);
       if (!assumption.is_null()) {
@@ -260,6 +258,13 @@
     }
   }
 
+  {
+    No_Safepoint_Verifier no_safepoint;
+    initialize_fields(target_method);
+    initialize_buffer(buffer);
+    process_exception_handlers();
+  }
+
   int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer
   methodHandle method = getMethodFromHotSpotMethod(HotSpotTargetMethod::method(target_method)); 
   {
@@ -273,7 +278,9 @@
 CodeInstaller::CodeInstaller(Handle target_method, jlong& id) {
   No_Safepoint_Verifier no_safepoint;
   _env = CURRENT_ENV;
-
+  
+  _oop_recorder = new OopRecorder(_env->arena());
+  _env->set_oop_recorder(_oop_recorder);
   initialize_fields(target_method);
   assert(_hotspot_method == NULL && _name != NULL, "installMethod needs NON-NULL name and NULL method");
 
@@ -296,12 +303,6 @@
   }
   _name = HotSpotTargetMethod::name(target_method);
   _sites = (arrayOop) HotSpotTargetMethod::sites(target_method);
-  oop assumptions = CiTargetMethod::assumptions(_citarget_method);
-  if (assumptions != NULL) {
-    _assumptions = (arrayOop) CiAssumptions::list(assumptions);
-  } else {
-    _assumptions = NULL;
-  }
   _exception_handlers = (arrayOop) HotSpotTargetMethod::exceptionHandlers(target_method);
 
   _code = (arrayOop) CiTargetMethod::targetCode(_citarget_method);
@@ -325,15 +326,10 @@
   buffer.initialize_stubs_size(256);
   buffer.initialize_consts_size(_constants_size);
 
-  _oop_recorder = new OopRecorder(_env->arena());
-  _env->set_oop_recorder(_oop_recorder);
   _debug_recorder = new DebugInformationRecorder(_env->oop_recorder());
   _debug_recorder->set_oopmaps(new OopMapSet());
-  _dependencies = new Dependencies(_env);
-
-  _env->set_oop_recorder(_oop_recorder);
+  
   _env->set_debug_info(_debug_recorder);
-  _env->set_dependencies(_dependencies);
   buffer.initialize_oop_recorder(_oop_recorder);
 
   _instructions = buffer.insts();
--- a/src/share/vm/graal/graalCodeInstaller.hpp	Thu Nov 17 18:33:33 2011 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.hpp	Thu Nov 17 19:11:55 2011 +0100
@@ -56,7 +56,6 @@
   oop           _hotspot_method;
   oop           _name;
   arrayOop      _sites;
-  arrayOop      _assumptions;
   arrayOop      _exception_handlers;
   CodeOffsets   _offsets;
 
--- a/src/share/vm/graal/graalEnv.cpp	Thu Nov 17 18:33:33 2011 +0100
+++ b/src/share/vm/graal/graalEnv.cpp	Thu Nov 17 19:11:55 2011 +0100
@@ -466,7 +466,7 @@
       // All buffers in the CodeBuffer are allocated in the CodeCache.
       // If the code buffer is created on each compile attempt
       // as in C2, then it must be freed.
-      code_buffer->free_blob();
+      //code_buffer->free_blob();
       return NULL;
     }
 
@@ -484,7 +484,7 @@
                                compiler, comp_level);
 
     // Free codeBlobs
-    code_buffer->free_blob();
+    //code_buffer->free_blob();
 
     // stress test 6243940 by immediately making the method
     // non-entrant behind the system's back. This has serious