1403 JVMCIENV->describe_pending_exception(true);
1404 compile_state->set_failure(false, "unexpected exception thrown");
1405 }
1406 if (compiler->is_bootstrapping()) {
1407 compiler->set_bootstrap_compilation_request_handled();
1408 }
1409 }
1410
1411
1412 // ------------------------------------------------------------------
1413 JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
1414 const methodHandle& method,
1415 nmethod*& nm,
1416 int entry_bci,
1417 CodeOffsets* offsets,
1418 int orig_pc_offset,
1419 CodeBuffer* code_buffer,
1420 int frame_words,
1421 OopMapSet* oop_map_set,
1422 ExceptionHandlerTable* handler_table,
1423 AbstractCompiler* compiler,
1424 DebugInformationRecorder* debug_info,
1425 Dependencies* dependencies,
1426 int compile_id,
1427 bool has_unsafe_access,
1428 bool has_wide_vector,
1429 JVMCIObject compiled_code,
1430 JVMCIObject nmethod_mirror,
1431 FailedSpeculation** failed_speculations,
1432 char* speculations,
1433 int speculations_len) {
1434 JVMCI_EXCEPTION_CONTEXT;
1435 nm = NULL;
1436 int comp_level = CompLevel_full_optimization;
1437 char* failure_detail = NULL;
1438
1439 bool install_default = JVMCIENV->get_HotSpotNmethod_isDefault(nmethod_mirror) != 0;
1440 assert(JVMCIENV->isa_HotSpotNmethod(nmethod_mirror), "must be");
1441 JVMCIObject name = JVMCIENV->get_InstalledCode_name(nmethod_mirror);
1442 const char* nmethod_mirror_name = name.is_null() ? NULL : JVMCIENV->as_utf8_string(name);
1472 // Check for {class loads, evolution, breakpoints} during compilation
1473 result = validate_compile_task_dependencies(dependencies, JVMCIENV->compile_state(), &failure_detail);
1474 if (result != JVMCI::ok) {
1475 // While not a true deoptimization, it is a preemptive decompile.
1476 MethodData* mdp = method()->method_data();
1477 if (mdp != NULL) {
1478 mdp->inc_decompile_count();
1479 #ifdef ASSERT
1480 if (mdp->decompile_count() > (uint)PerMethodRecompilationCutoff) {
1481 ResourceMark m;
1482 tty->print_cr("WARN: endless recompilation of %s. Method was set to not compilable.", method()->name_and_sig_as_C_string());
1483 }
1484 #endif
1485 }
1486
1487 // All buffers in the CodeBuffer are allocated in the CodeCache.
1488 // If the code buffer is created on each compile attempt
1489 // as in C2, then it must be freed.
1490 //code_buffer->free_blob();
1491 } else {
1492 ImplicitExceptionTable implicit_tbl;
1493 nm = nmethod::new_nmethod(method,
1494 compile_id,
1495 entry_bci,
1496 offsets,
1497 orig_pc_offset,
1498 debug_info, dependencies, code_buffer,
1499 frame_words, oop_map_set,
1500 handler_table, &implicit_tbl,
1501 compiler, comp_level,
1502 speculations, speculations_len,
1503 nmethod_mirror_index, nmethod_mirror_name, failed_speculations);
1504
1505
1506 // Free codeBlobs
1507 if (nm == NULL) {
1508 // The CodeCache is full. Print out warning and disable compilation.
1509 {
1510 MutexUnlocker ml(Compile_lock);
1511 MutexUnlocker locker(MethodCompileQueue_lock);
1512 CompileBroker::handle_full_code_cache(CodeCache::get_code_blob_type(comp_level));
1513 }
1514 } else {
1515 nm->set_has_unsafe_access(has_unsafe_access);
1516 nm->set_has_wide_vectors(has_wide_vector);
1517
1518 // Record successful registration.
1519 // (Put nm into the task handle *before* publishing to the Java heap.)
1520 if (JVMCIENV->compile_state() != NULL) {
|
1403 JVMCIENV->describe_pending_exception(true);
1404 compile_state->set_failure(false, "unexpected exception thrown");
1405 }
1406 if (compiler->is_bootstrapping()) {
1407 compiler->set_bootstrap_compilation_request_handled();
1408 }
1409 }
1410
1411
1412 // ------------------------------------------------------------------
1413 JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
1414 const methodHandle& method,
1415 nmethod*& nm,
1416 int entry_bci,
1417 CodeOffsets* offsets,
1418 int orig_pc_offset,
1419 CodeBuffer* code_buffer,
1420 int frame_words,
1421 OopMapSet* oop_map_set,
1422 ExceptionHandlerTable* handler_table,
1423 ImplicitExceptionTable* implicit_exception_table,
1424 AbstractCompiler* compiler,
1425 DebugInformationRecorder* debug_info,
1426 Dependencies* dependencies,
1427 int compile_id,
1428 bool has_unsafe_access,
1429 bool has_wide_vector,
1430 JVMCIObject compiled_code,
1431 JVMCIObject nmethod_mirror,
1432 FailedSpeculation** failed_speculations,
1433 char* speculations,
1434 int speculations_len) {
1435 JVMCI_EXCEPTION_CONTEXT;
1436 nm = NULL;
1437 int comp_level = CompLevel_full_optimization;
1438 char* failure_detail = NULL;
1439
1440 bool install_default = JVMCIENV->get_HotSpotNmethod_isDefault(nmethod_mirror) != 0;
1441 assert(JVMCIENV->isa_HotSpotNmethod(nmethod_mirror), "must be");
1442 JVMCIObject name = JVMCIENV->get_InstalledCode_name(nmethod_mirror);
1443 const char* nmethod_mirror_name = name.is_null() ? NULL : JVMCIENV->as_utf8_string(name);
1473 // Check for {class loads, evolution, breakpoints} during compilation
1474 result = validate_compile_task_dependencies(dependencies, JVMCIENV->compile_state(), &failure_detail);
1475 if (result != JVMCI::ok) {
1476 // While not a true deoptimization, it is a preemptive decompile.
1477 MethodData* mdp = method()->method_data();
1478 if (mdp != NULL) {
1479 mdp->inc_decompile_count();
1480 #ifdef ASSERT
1481 if (mdp->decompile_count() > (uint)PerMethodRecompilationCutoff) {
1482 ResourceMark m;
1483 tty->print_cr("WARN: endless recompilation of %s. Method was set to not compilable.", method()->name_and_sig_as_C_string());
1484 }
1485 #endif
1486 }
1487
1488 // All buffers in the CodeBuffer are allocated in the CodeCache.
1489 // If the code buffer is created on each compile attempt
1490 // as in C2, then it must be freed.
1491 //code_buffer->free_blob();
1492 } else {
1493 nm = nmethod::new_nmethod(method,
1494 compile_id,
1495 entry_bci,
1496 offsets,
1497 orig_pc_offset,
1498 debug_info, dependencies, code_buffer,
1499 frame_words, oop_map_set,
1500 handler_table, implicit_exception_table,
1501 compiler, comp_level,
1502 speculations, speculations_len,
1503 nmethod_mirror_index, nmethod_mirror_name, failed_speculations);
1504
1505
1506 // Free codeBlobs
1507 if (nm == NULL) {
1508 // The CodeCache is full. Print out warning and disable compilation.
1509 {
1510 MutexUnlocker ml(Compile_lock);
1511 MutexUnlocker locker(MethodCompileQueue_lock);
1512 CompileBroker::handle_full_code_cache(CodeCache::get_code_blob_type(comp_level));
1513 }
1514 } else {
1515 nm->set_has_unsafe_access(has_unsafe_access);
1516 nm->set_has_wide_vectors(has_wide_vector);
1517
1518 // Record successful registration.
1519 // (Put nm into the task handle *before* publishing to the Java heap.)
1520 if (JVMCIENV->compile_state() != NULL) {
|