443 assert(!is_hidden_merge(phi_map->control()), "hidden ex. states cleared");
444 assert(!is_hidden_merge(phi_map->i_o()), "hidden ex. states cleared");
445 return ex_oop;
446 }
447
448 //---------------------------------java_bc-------------------------------------
449 Bytecodes::Code GraphKit::java_bc() const {
450 ciMethod* method = this->method();
451 int bci = this->bci();
452 if (method != NULL && bci != InvocationEntryBci)
453 return method->java_code_at_bci(bci);
454 else
455 return Bytecodes::_illegal;
456 }
457
458 //------------------------------builtin_throw----------------------------------
459 void GraphKit::builtin_throw(Deoptimization::DeoptReason reason, Node* arg) {
460 bool must_throw = true;
461
462 if (env()->jvmti_can_post_exceptions()) {
463 // Do not try anything fancy if we're notifying the VM on every throw.
464 // Cf. case Bytecodes::_athrow in parse2.cpp.
465 uncommon_trap(reason, Deoptimization::Action_none,
466 (ciKlass*)NULL, (char*)NULL, must_throw);
467 return;
468 }
469
470 // If this particular condition has not yet happened at this
471 // bytecode, then use the uncommon trap mechanism, and allow for
472 // a future recompilation if several traps occur here.
473 // If the throw is hot, try to use a more complicated inline mechanism
474 // which keeps execution inside the compiled code.
475 bool treat_throw_as_hot = false;
476 ciMethodData* md = method()->method_data();
477
478 if (ProfileTraps) {
479 if (too_many_traps(reason)) {
480 treat_throw_as_hot = true;
481 }
482 // (If there is no MDO at all, assume it is early in
483 // execution, and that any deopts are part of the
484 // startup transient, and don't need to be remembered.)
485
486 // Also, if there is a local exception handler, treat all throws
487 // as hot if there has been at least one in this method.
488 if (C->trap_count(reason) != 0
|
443 assert(!is_hidden_merge(phi_map->control()), "hidden ex. states cleared");
444 assert(!is_hidden_merge(phi_map->i_o()), "hidden ex. states cleared");
445 return ex_oop;
446 }
447
448 //---------------------------------java_bc-------------------------------------
449 Bytecodes::Code GraphKit::java_bc() const {
450 ciMethod* method = this->method();
451 int bci = this->bci();
452 if (method != NULL && bci != InvocationEntryBci)
453 return method->java_code_at_bci(bci);
454 else
455 return Bytecodes::_illegal;
456 }
457
458 //------------------------------builtin_throw----------------------------------
459 void GraphKit::builtin_throw(Deoptimization::DeoptReason reason, Node* arg) {
460 bool must_throw = true;
461
462 if (env()->jvmti_can_post_exceptions()) {
463 if (CheckExceptionEventsNeeded) {
464 // if the exception capability is set, then we will generate a
465 // runtime call to see if we actually need to report exception
466 // events. If we don't need to report exception events, we will
467 // take the normal fast path provided by add_exception_events.
468 // If exception event reporting is enabled, we will take the
469 // uncommon_trap in the BuildCutout below.
470
471 // call C++ runtime routine to determine whether we need to
472 // report exception events
473 Node* c = make_runtime_call(RC_LEAF, OptoRuntime::must_post_exception_events_Type(),
474 CAST_FROM_FN_PTR(address, JvmtiExport::must_post_exception_events_jrt_leaf),
475 "must_post_exception_events", NULL //no memory effects
476 );
477
478 Node* need_exc_bool = _gvn.transform(new (C, 1) ProjNode(c, TypeFunc::Parms + 0));
479
480 // Test the result returned by the runtime call vs. 0
481 Node* zero = _gvn.intcon(0);
482 Node* chk = _gvn.transform( new (C, 3) CmpINode(need_exc_bool, zero) );
483 BoolTest::mask btesteq = BoolTest::eq;
484 Node* tst = _gvn.transform( new (C, 2) BoolNode(chk, btesteq) );
485
486 // Branch to slow_path if runtime call returned true
487 { BuildCutout unless(this, tst, PROB_MAX);
488 // Do not try anything fancy if we're notifying the VM on every throw.
489 // Cf. case Bytecodes::_athrow in parse2.cpp.
490 uncommon_trap(reason, Deoptimization::Action_none,
491 (ciKlass*)NULL, (char*)NULL, must_throw);
492 }
493 // here if the runtime call returned false
494 // note we do not return here, but continue on with the normal codegen
495 }
496 else {
497 // CheckExceptionEventsNeeded is false
498 // Do not try anything fancy if we're notifying the VM on every throw.
499 // Cf. case Bytecodes::_athrow in parse2.cpp.
500 uncommon_trap(reason, Deoptimization::Action_none,
501 (ciKlass*)NULL, (char*)NULL, must_throw);
502 return;
503 }
504 }
505
506 // If this particular condition has not yet happened at this
507 // bytecode, then use the uncommon trap mechanism, and allow for
508 // a future recompilation if several traps occur here.
509 // If the throw is hot, try to use a more complicated inline mechanism
510 // which keeps execution inside the compiled code.
511 bool treat_throw_as_hot = false;
512 ciMethodData* md = method()->method_data();
513
514 if (ProfileTraps) {
515 if (too_many_traps(reason)) {
516 treat_throw_as_hot = true;
517 }
518 // (If there is no MDO at all, assume it is early in
519 // execution, and that any deopts are part of the
520 // startup transient, and don't need to be remembered.)
521
522 // Also, if there is a local exception handler, treat all throws
523 // as hot if there has been at least one in this method.
524 if (C->trap_count(reason) != 0
|