diff src/share/vm/graal/graalCompiler.cpp @ 3555:22d11b3bc561

Various hacks to be able to install machine code from a Java thread.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 24 Aug 2011 01:05:02 +0200
parents 536528f48708
children b3f0f8a01ca2
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompiler.cpp	Mon Aug 22 19:55:06 2011 +0200
+++ b/src/share/vm/graal/graalCompiler.cpp	Wed Aug 24 01:05:02 2011 +0200
@@ -84,7 +84,7 @@
 
 void GraalCompiler::initialize_buffer_blob() {
 
-  CompilerThread* THREAD = CompilerThread::current();
+  JavaThread* THREAD = JavaThread::current();
   if (THREAD->get_buffer_blob() == NULL) {
     // setup CodeBuffer.  Preallocate a BufferBlob of size
     // NMethodSizeLimit plus some extra space for constants.
@@ -104,15 +104,13 @@
   ResourceMark rm;
   HandleMark hm;
 
-  initialize_buffer_blob();
   VmIds::initializeObjects();
 
   TRACE_graal_2("GraalCompiler::compile_method");
 
   CompilerThread::current()->set_compiling(true);
   methodOop method = (methodOop) target->get_oop();
-  Handle name = VmIds::toString<Handle>(method->name(), CHECK);
-  Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, name, CHECK);
+  Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, CHECK);
   VMExits::compileMethod(hotspot_method, entry_bci);
   CompilerThread::current()->set_compiling(false);
 
@@ -202,12 +200,14 @@
   return obj();
 }
 
-oop GraalCompiler::createHotSpotMethodResolved(methodHandle method, Handle name, TRAPS) {
+oop GraalCompiler::createHotSpotMethodResolved(methodHandle method, TRAPS) {
   if (method->graal_mirror() != NULL) {
     assert(method->graal_mirror()->is_a(HotSpotMethodResolved::klass()), "unexpected class...");
     return method->graal_mirror();
   }
 
+  Handle name = VmIds::toString<Handle>(method->name(), CHECK_NULL);
+
   instanceKlass::cast(HotSpotMethodResolved::klass())->initialize(CHECK_NULL);
   Handle obj = instanceKlass::cast(HotSpotMethodResolved::klass())->allocate_instance(CHECK_NULL);
   assert(obj() != NULL, "must succeed in allocating instance");