src/share/vm/opto/parse1.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-comp-code-aging Sdiff src/share/vm/opto

src/share/vm/opto/parse1.cpp

Print this page




 551   // Check for bailouts during map initialization
 552   if (failing() || entry_map == NULL) {
 553     if (log)  log->done("parse");
 554     return;
 555   }
 556 
 557   Node_Notes* caller_nn = C->default_node_notes();
 558   // Collect debug info for inlined calls unless -XX:-DebugInlinedCalls.
 559   if (DebugInlinedCalls || depth() == 1) {
 560     C->set_default_node_notes(make_node_notes(caller_nn));
 561   }
 562 
 563   if (is_osr_parse()) {
 564     Node* osr_buf = entry_map->in(TypeFunc::Parms+0);
 565     entry_map->set_req(TypeFunc::Parms+0, top());
 566     set_map(entry_map);
 567     load_interpreter_state(osr_buf);
 568   } else {
 569     set_map(entry_map);
 570     do_method_entry();



 571   }
 572   if (depth() == 1) {
 573     // Add check to deoptimize the nmethod if RTM state was changed
 574     rtm_deopt();
 575   }
 576 
 577   // Check for bailouts during method entry.
 578   if (failing()) {
 579     if (log)  log->done("parse");
 580     C->set_default_node_notes(caller_nn);
 581     return;
 582   }
 583 
 584   entry_map = map();  // capture any changes performed by method setup code
 585   assert(jvms()->endoff() == map()->req(), "map matches JVMS layout");
 586 
 587   // We begin parsing as if we have just encountered a jump to the
 588   // method entry.
 589   Block* entry_block = start_block();
 590   assert(entry_block->start() == (is_osr_parse() ? osr_bci() : 0), "");


2031     Node* rtm_state = make_load(control(), adr_node, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
2032 
2033     // Separate Load from Cmp by Opaque.
2034     // In expand_macro_nodes() it will be replaced either
2035     // with this load when there are locks in the code
2036     // or with ProfileRTM (cmp->in(2)) otherwise so that
2037     // the check will fold.
2038     Node* profile_state = makecon(TypeInt::make(ProfileRTM));
2039     Node* opq   = _gvn.transform( new (C) Opaque3Node(C, rtm_state, Opaque3Node::RTM_OPT) );
2040     Node* chk   = _gvn.transform( new (C) CmpINode(opq, profile_state) );
2041     Node* tst   = _gvn.transform( new (C) BoolNode(chk, BoolTest::eq) );
2042     // Branch to failure if state was changed
2043     { BuildCutout unless(this, tst, PROB_ALWAYS);
2044       uncommon_trap(Deoptimization::Reason_rtm_state_change,
2045                     Deoptimization::Action_make_not_entrant);
2046     }
2047   }
2048 #endif
2049 }
2050 


























2051 //------------------------------return_current---------------------------------
2052 // Append current _map to _exit_return
2053 void Parse::return_current(Node* value) {
2054   if (RegisterFinalizersAtInit &&
2055       method()->intrinsic_id() == vmIntrinsics::_Object_init) {
2056     call_register_finalizer();
2057   }
2058 
2059   // Do not set_parse_bci, so that return goo is credited to the return insn.
2060   set_bci(InvocationEntryBci);
2061   if (method()->is_synchronized() && GenerateSynchronizationCode) {
2062     shared_unlock(_synch_lock->box_node(), _synch_lock->obj_node());
2063   }
2064   if (C->env()->dtrace_method_probes()) {
2065     make_dtrace_method_exit(method());
2066   }
2067   SafePointNode* exit_return = _exits.map();
2068   exit_return->in( TypeFunc::Control  )->add_req( control() );
2069   exit_return->in( TypeFunc::I_O      )->add_req( i_o    () );
2070   Node *mem = exit_return->in( TypeFunc::Memory   );




 551   // Check for bailouts during map initialization
 552   if (failing() || entry_map == NULL) {
 553     if (log)  log->done("parse");
 554     return;
 555   }
 556 
 557   Node_Notes* caller_nn = C->default_node_notes();
 558   // Collect debug info for inlined calls unless -XX:-DebugInlinedCalls.
 559   if (DebugInlinedCalls || depth() == 1) {
 560     C->set_default_node_notes(make_node_notes(caller_nn));
 561   }
 562 
 563   if (is_osr_parse()) {
 564     Node* osr_buf = entry_map->in(TypeFunc::Parms+0);
 565     entry_map->set_req(TypeFunc::Parms+0, top());
 566     set_map(entry_map);
 567     load_interpreter_state(osr_buf);
 568   } else {
 569     set_map(entry_map);
 570     do_method_entry();
 571     if (depth() == 1 && C->age_code()) {
 572       decrement_age();
 573     }
 574   }
 575   if (depth() == 1) {
 576     // Add check to deoptimize the nmethod if RTM state was changed
 577     rtm_deopt();
 578   }
 579 
 580   // Check for bailouts during method entry.
 581   if (failing()) {
 582     if (log)  log->done("parse");
 583     C->set_default_node_notes(caller_nn);
 584     return;
 585   }
 586 
 587   entry_map = map();  // capture any changes performed by method setup code
 588   assert(jvms()->endoff() == map()->req(), "map matches JVMS layout");
 589 
 590   // We begin parsing as if we have just encountered a jump to the
 591   // method entry.
 592   Block* entry_block = start_block();
 593   assert(entry_block->start() == (is_osr_parse() ? osr_bci() : 0), "");


2034     Node* rtm_state = make_load(control(), adr_node, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
2035 
2036     // Separate Load from Cmp by Opaque.
2037     // In expand_macro_nodes() it will be replaced either
2038     // with this load when there are locks in the code
2039     // or with ProfileRTM (cmp->in(2)) otherwise so that
2040     // the check will fold.
2041     Node* profile_state = makecon(TypeInt::make(ProfileRTM));
2042     Node* opq   = _gvn.transform( new (C) Opaque3Node(C, rtm_state, Opaque3Node::RTM_OPT) );
2043     Node* chk   = _gvn.transform( new (C) CmpINode(opq, profile_state) );
2044     Node* tst   = _gvn.transform( new (C) BoolNode(chk, BoolTest::eq) );
2045     // Branch to failure if state was changed
2046     { BuildCutout unless(this, tst, PROB_ALWAYS);
2047       uncommon_trap(Deoptimization::Reason_rtm_state_change,
2048                     Deoptimization::Action_make_not_entrant);
2049     }
2050   }
2051 #endif
2052 }
2053 
2054 void Parse::decrement_age() {
2055   // Get the Method* node.
2056   MethodCounters* mc = method()->ensure_method_counters();
2057   if (mc == NULL) {
2058     C->record_failure("Must have MCs");
2059     return;
2060   }
2061   assert(!is_osr_parse(), "Not doing this for OSRs");
2062 
2063   // Set starting bci for uncommon trap.
2064   set_parse_bci(0);
2065 
2066   const TypePtr* adr_type = TypeRawPtr::make((address)mc);
2067   Node* mc_adr = makecon(adr_type);
2068   Node* cnt_adr = basic_plus_adr(mc_adr, mc_adr, in_bytes(MethodCounters::nmethod_age_offset()));
2069   Node* cnt = make_load(control(), cnt_adr, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
2070   Node* decr = _gvn.transform(new (C) SubINode(cnt, makecon(TypeInt::ONE)));
2071   store_to_memory(control(), cnt_adr, decr, T_INT, adr_type, MemNode::unordered);
2072   Node *chk   = _gvn.transform(new (C) CmpINode(decr, makecon(TypeInt::ZERO)));
2073   Node* tst   = _gvn.transform(new (C) BoolNode(chk, BoolTest::gt));
2074   { BuildCutout unless(this, tst, PROB_ALWAYS);
2075     uncommon_trap(Deoptimization::Reason_profile_aging,
2076                   Deoptimization::Action_make_not_entrant);
2077   }
2078 }
2079 
2080 //------------------------------return_current---------------------------------
2081 // Append current _map to _exit_return
2082 void Parse::return_current(Node* value) {
2083   if (RegisterFinalizersAtInit &&
2084       method()->intrinsic_id() == vmIntrinsics::_Object_init) {
2085     call_register_finalizer();
2086   }
2087 
2088   // Do not set_parse_bci, so that return goo is credited to the return insn.
2089   set_bci(InvocationEntryBci);
2090   if (method()->is_synchronized() && GenerateSynchronizationCode) {
2091     shared_unlock(_synch_lock->box_node(), _synch_lock->obj_node());
2092   }
2093   if (C->env()->dtrace_method_probes()) {
2094     make_dtrace_method_exit(method());
2095   }
2096   SafePointNode* exit_return = _exits.map();
2097   exit_return->in( TypeFunc::Control  )->add_req( control() );
2098   exit_return->in( TypeFunc::I_O      )->add_req( i_o    () );
2099   Node *mem = exit_return->in( TypeFunc::Memory   );


src/share/vm/opto/parse1.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File