diff src/share/vm/c1x/c1x_Compiler.cpp @ 1931:48bbaead8b6c

Adjustments after merge with OpenJDK repository.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Tue, 30 Nov 2010 16:39:35 +0100
parents ba37b9335e1e
children 79d04223b8a5
line wrap: on
line diff
--- a/src/share/vm/c1x/c1x_Compiler.cpp	Tue Nov 30 14:53:30 2010 +0100
+++ b/src/share/vm/c1x/c1x_Compiler.cpp	Tue Nov 30 16:39:35 2010 +0100
@@ -36,10 +36,13 @@
 // Initialization
 void C1XCompiler::initialize() {
   if (_initialized) return;
-  Thread* THREAD = Thread::current();
+  CompilerThread* THREAD = CompilerThread::current();
   _initialized = true;
   TRACE_C1X_1("C1XCompiler::initialize");
 
+  initialize_buffer_blob();
+  Runtime1::initialize(THREAD->get_buffer_blob());
+
   JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment();
   jclass klass = env->FindClass("com/sun/hotspot/c1x/VMEntriesNative");
   if (klass == NULL) {
@@ -66,6 +69,21 @@
   }
 }
 
+void C1XCompiler::initialize_buffer_blob() {
+
+  CompilerThread* THREAD = CompilerThread::current();
+  if (THREAD->get_buffer_blob() == NULL) {
+    // setup CodeBuffer.  Preallocate a BufferBlob of size
+    // NMethodSizeLimit plus some extra space for constants.
+    int code_buffer_size = Compilation::desired_max_code_buffer_size() +
+      Compilation::desired_max_constant_size();
+    BufferBlob* blob = BufferBlob::create("C1X temporary CodeBuffer",
+                                          code_buffer_size);
+    guarantee(blob != NULL, "must create code buffer");
+    THREAD->set_buffer_blob(blob);
+  }
+}
+
 // Compilation entry point for methods
 void C1XCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
   initialize();
@@ -73,6 +91,7 @@
   ResourceMark rm;
   HandleMark hm;
 
+  initialize_buffer_blob();
   VmIds::initializeObjects();
 
   CompilerThread::current()->set_compiling(true);
@@ -156,7 +175,7 @@
     case 'r': return T_ADDRESS;
     case '-': return T_ILLEGAL;
     default:
-      fatal1("unexpected CiKind: %c", ch);
+      fatal(err_msg("unexpected CiKind: %c", ch));
       break;
   }
 }