diff src/share/vm/c1x/c1x_CodeInstaller.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 6b7001391c97
children 8d88c9ac9247
line wrap: on
line diff
--- a/src/share/vm/c1x/c1x_CodeInstaller.cpp	Tue Nov 30 14:53:30 2010 +0100
+++ b/src/share/vm/c1x/c1x_CodeInstaller.cpp	Tue Nov 30 16:39:35 2010 +0100
@@ -172,7 +172,8 @@
   }
 
   // (very) conservative estimate: each site needs a relocation
-  CodeBuffer buffer("temp c1x method", _total_size, _sites->length() * relocInfo::length_limit);
+  //CodeBuffer buffer("temp c1x method", _total_size, _sites->length() * relocInfo::length_limit);
+  CodeBuffer buffer(CompilerThread::current()->get_buffer_blob());
   initialize_buffer(buffer);
   process_exception_handlers();
 
@@ -192,13 +193,13 @@
   assert(_hotspot_method == NULL && _name != NULL, "installMethod needs NON-NULL name and NULL method");
 
   // (very) conservative estimate: each site needs a relocation
-  CodeBuffer buffer("temp c1x stub", _total_size, _sites->length() * relocInfo::length_limit);
+  CodeBuffer buffer(CompilerThread::current()->get_buffer_blob());
   initialize_buffer(buffer);
 
   const char* cname = java_lang_String::as_utf8_string(_name);
   BufferBlob* blob = BufferBlob::create(strdup(cname), &buffer); // this is leaking strings... but only a limited number of stubs will be created
   IF_TRACE_C1X_3 Disassembler::decode((CodeBlob*) blob);
-  id = VmIds::addStub(blob->instructions_begin());
+  id = VmIds::addStub(blob->code_begin());
 }
 
 void CodeInstaller::initialize_fields(oop target_method) {
@@ -221,6 +222,12 @@
 
 // perform data and call relocation on the CodeBuffer
 void CodeInstaller::initialize_buffer(CodeBuffer& buffer) {
+  int locs_buffer_size = _sites->length() * (relocInfo::length_limit + sizeof(relocInfo));
+  char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
+  buffer.insts()->initialize_shared_locs((relocInfo*)locs_buffer, locs_buffer_size / sizeof(relocInfo));
+  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());
@@ -232,7 +239,6 @@
   _env->set_dependencies(_dependencies);
   buffer.initialize_oop_recorder(_oop_recorder);
 
-  buffer.initialize_consts_size(_constants_size);
   _instructions = buffer.insts();
   _constants = buffer.consts();
 
@@ -498,7 +504,7 @@
       }
       case MARK_INVOKE_INVALID:
       default:
-        fatal("invalid _next_call_type value")
+        fatal("invalid _next_call_type value");
         break;
     }
   }
@@ -563,7 +569,7 @@
       break;
     }
     default:
-      fatal("unexpected CiKind in DataPatch")
+      fatal("unexpected CiKind in DataPatch");
       break;
   }
 }
@@ -645,7 +651,7 @@
         break;
       }
       default:
-        ShouldNotReachHere()
+        ShouldNotReachHere();
         break;
     }
   }