Mercurial > hg > graal-compiler
comparison 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 |
comparison
equal
deleted
inserted
replaced
3601:3822c5969a8b | 3619:5e9645341ec3 |
---|---|
228 ShouldNotReachHere(); | 228 ShouldNotReachHere(); |
229 return NULL; | 229 return NULL; |
230 } | 230 } |
231 | 231 |
232 // constructor used to create a method | 232 // constructor used to create a method |
233 CodeInstaller::CodeInstaller(Handle target_method) { | 233 CodeInstaller::CodeInstaller(Handle target_method, nmethod*& nm, bool install_code) { |
234 _env = CURRENT_ENV; | 234 _env = CURRENT_ENV; |
235 ciMethod *ciMethodObject = NULL; | 235 ciMethod *ciMethodObject = NULL; |
236 { | 236 { |
237 methodOop method = getMethodFromHotSpotMethod(HotSpotTargetMethod::method(target_method)); | 237 methodOop method = getMethodFromHotSpotMethod(HotSpotTargetMethod::method(target_method)); |
238 ciMethodObject = (ciMethod *) _env->get_object(method); | 238 ciMethodObject = (ciMethod *) _env->get_object(method); |
253 initialize_buffer(buffer); | 253 initialize_buffer(buffer); |
254 process_exception_handlers(); | 254 process_exception_handlers(); |
255 | 255 |
256 int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer | 256 int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer |
257 ThreadToNativeFromVM t((JavaThread*) Thread::current()); | 257 ThreadToNativeFromVM t((JavaThread*) Thread::current()); |
258 _env->register_method(ciMethodObject, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, | 258 nm = _env->register_method(ciMethodObject, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, |
259 &_implicit_exception_table, GraalCompiler::instance(), _env->comp_level(), false, false); | 259 &_implicit_exception_table, GraalCompiler::instance(), _env->comp_level(), false, false, install_code); |
260 | |
261 } | 260 } |
262 | 261 |
263 // constructor used to create a stub | 262 // constructor used to create a stub |
264 CodeInstaller::CodeInstaller(Handle target_method, jlong& id) { | 263 CodeInstaller::CodeInstaller(Handle target_method, jlong& id) { |
265 No_Safepoint_Verifier no_safepoint; | 264 No_Safepoint_Verifier no_safepoint; |
652 } else { | 651 } else { |
653 runtime_call->print(); | 652 runtime_call->print(); |
654 fatal("unsupported type of instruction for call site"); | 653 fatal("unsupported type of instruction for call site"); |
655 } | 654 } |
656 | 655 |
656 if (target->is_a(SystemDictionary::HotSpotCompiledMethod_klass())) { | |
657 assert(inst->is_jump(), "jump expected"); | |
658 | |
659 nmethod* nm = (nmethod*) HotSpotCompiledMethod::nmethod(target); | |
660 nativeJump_at((address)inst)->set_jump_destination(nm->verified_entry_point()); | |
661 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand); | |
662 | |
663 return; | |
664 } | |
665 | |
657 if (debug_info != NULL) { | 666 if (debug_info != NULL) { |
658 _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(_frame_size, _parameter_count, debug_info)); | 667 _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(_frame_size, _parameter_count, debug_info)); |
659 oop code_pos = CiDebugInfo::codePos(debug_info); | 668 oop code_pos = CiDebugInfo::codePos(debug_info); |
660 record_scope(next_pc_offset, code_pos, new GrowableArray<ScopeValue*>()); | 669 record_scope(next_pc_offset, code_pos, new GrowableArray<ScopeValue*>()); |
661 } | 670 } |