Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalCodeInstaller.cpp @ 9654:18632807db02
RuntimeStub installation support is now more distinct from normal nmethod installation
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 13 May 2013 11:21:24 +0200 |
parents | 44e05c9afb54 |
children | ed6202820ecf |
comparison
equal
deleted
inserted
replaced
9653:36e12fbbefdf | 9654:18632807db02 |
---|---|
349 | 349 |
350 return result; | 350 return result; |
351 } | 351 } |
352 | 352 |
353 // constructor used to create a method | 353 // constructor used to create a method |
354 CodeInstaller::CodeInstaller(Handle& comp_result, methodHandle method, GraalEnv::CodeInstallResult& result, CodeBlob*& cb, Handle installed_code, Handle triggered_deoptimizations) { | 354 CodeInstaller::CodeInstaller(Handle& comp_result, GraalEnv::CodeInstallResult& result, CodeBlob*& cb, Handle installed_code, Handle triggered_deoptimizations) { |
355 GraalCompiler::initialize_buffer_blob(); | 355 GraalCompiler::initialize_buffer_blob(); |
356 CodeBuffer buffer(JavaThread::current()->get_buffer_blob()); | 356 CodeBuffer buffer(JavaThread::current()->get_buffer_blob()); |
357 jobject comp_result_obj = JNIHandles::make_local(comp_result()); | 357 jobject comp_result_obj = JNIHandles::make_local(comp_result()); |
358 jint entry_bci = HotSpotCompilationResult::entryBCI(comp_result); | 358 jint entry_bci = HotSpotCompilationResult::entryBCI(comp_result); |
359 initialize_assumptions(JNIHandles::resolve(comp_result_obj)); | 359 initialize_assumptions(JNIHandles::resolve(comp_result_obj)); |
360 | 360 |
361 { | 361 { |
362 No_Safepoint_Verifier no_safepoint; | 362 No_Safepoint_Verifier no_safepoint; |
363 initialize_fields(JNIHandles::resolve(comp_result_obj), method); | 363 initialize_fields(JNIHandles::resolve(comp_result_obj)); |
364 initialize_buffer(buffer); | 364 initialize_buffer(buffer); |
365 process_exception_handlers(); | 365 process_exception_handlers(); |
366 } | 366 } |
367 | 367 |
368 int stack_slots = _total_frame_size / HeapWordSize; // conversion to words | 368 int stack_slots = _total_frame_size / HeapWordSize; // conversion to words |
377 _debug_recorder->_oopmaps, | 377 _debug_recorder->_oopmaps, |
378 false); | 378 false); |
379 result = GraalEnv::ok; | 379 result = GraalEnv::ok; |
380 } else { | 380 } else { |
381 nmethod* nm = NULL; | 381 nmethod* nm = NULL; |
382 methodHandle method = getMethodFromHotSpotMethod(HotSpotCompilationResult::method(comp_result)); | |
382 result = GraalEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, | 383 result = GraalEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, |
383 GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, false, leaf_graph_ids, installed_code, triggered_deoptimizations); | 384 GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, false, leaf_graph_ids, installed_code, triggered_deoptimizations); |
384 cb = nm; | 385 cb = nm; |
385 } | 386 } |
386 } | 387 } |
387 | 388 |
388 void CodeInstaller::initialize_fields(oop comp_result, methodHandle method) { | 389 void CodeInstaller::initialize_fields(oop comp_result) { |
389 _comp_result = HotSpotCompilationResult::comp(comp_result); | 390 _comp_result = HotSpotCompilationResult::comp(comp_result); |
390 if (!method.is_null()) { | 391 oop hotspotJavaMethod = HotSpotCompilationResult::method(comp_result); |
392 if (hotspotJavaMethod != NULL) { | |
393 methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod); | |
391 _parameter_count = method->size_of_parameters(); | 394 _parameter_count = method->size_of_parameters(); |
392 TRACE_graal_1("installing code for %s", method->name_and_sig_as_C_string()); | 395 TRACE_graal_1("installing code for %s", method->name_and_sig_as_C_string()); |
396 } else { | |
397 // TODO (ds) not sure if this is correct - only used in OopMap constructor for non-product builds | |
398 _parameter_count = 0; | |
393 } | 399 } |
394 _stubName = HotSpotCompilationResult::stubName(comp_result); | 400 _stubName = HotSpotCompilationResult::stubName(comp_result); |
395 _sites = (arrayOop) HotSpotCompilationResult::sites(comp_result); | 401 _sites = (arrayOop) HotSpotCompilationResult::sites(comp_result); |
396 _exception_handlers = (arrayOop) HotSpotCompilationResult::exceptionHandlers(comp_result); | 402 _exception_handlers = (arrayOop) HotSpotCompilationResult::exceptionHandlers(comp_result); |
397 | 403 |