diff src/share/vm/graal/graalCodeInstaller.cpp @ 3619:5e9645341ec3

support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 09 Nov 2011 11:27:38 +0100
parents af1319bc4fd5
children c7d4198a9bce 6c04a4f268e5
line wrap: on
line diff
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Tue Oct 25 14:44:32 2011 +0200
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Wed Nov 09 11:27:38 2011 +0100
@@ -230,7 +230,7 @@
 }
 
 // constructor used to create a method
-CodeInstaller::CodeInstaller(Handle target_method) {
+CodeInstaller::CodeInstaller(Handle target_method, nmethod*& nm, bool install_code) {
   _env = CURRENT_ENV;
   ciMethod *ciMethodObject = NULL;
   {
@@ -255,9 +255,8 @@
 
   int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer
   ThreadToNativeFromVM t((JavaThread*) Thread::current());
-  _env->register_method(ciMethodObject, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
-      &_implicit_exception_table, GraalCompiler::instance(), _env->comp_level(), false, false);
-
+  nm = _env->register_method(ciMethodObject, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
+      &_implicit_exception_table, GraalCompiler::instance(), _env->comp_level(), false, false, install_code);
 }
 
 // constructor used to create a stub
@@ -654,6 +653,16 @@
     fatal("unsupported type of instruction for call site");
   }
 
+  if (target->is_a(SystemDictionary::HotSpotCompiledMethod_klass())) {
+    assert(inst->is_jump(), "jump expected");
+
+    nmethod* nm = (nmethod*) HotSpotCompiledMethod::nmethod(target);
+    nativeJump_at((address)inst)->set_jump_destination(nm->verified_entry_point());
+    _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
+
+    return;
+  }
+
   if (debug_info != NULL) {
     _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(_frame_size, _parameter_count, debug_info));
     oop code_pos = CiDebugInfo::codePos(debug_info);