1980 } |
1984 } |
1981 |
1985 |
1982 set_control( _gvn.transform(result_rgn) ); |
1986 set_control( _gvn.transform(result_rgn) ); |
1983 } |
1987 } |
1984 |
1988 |
|
1989 // Add check to deoptimize if RTM state is not ProfileRTM |
|
1990 void Parse::rtm_deopt() { |
|
1991 #if INCLUDE_RTM_OPT |
|
1992 if (C->profile_rtm()) { |
|
1993 assert(C->method() != NULL, "only for normal compilations"); |
|
1994 assert(!C->method()->method_data()->is_empty(), "MDO is needed to record RTM state"); |
|
1995 assert(depth() == 1, "generate check only for main compiled method"); |
|
1996 |
|
1997 // Set starting bci for uncommon trap. |
|
1998 set_parse_bci(is_osr_parse() ? osr_bci() : 0); |
|
1999 |
|
2000 // Load the rtm_state from the MethodData. |
|
2001 const TypePtr* adr_type = TypeMetadataPtr::make(C->method()->method_data()); |
|
2002 Node* mdo = makecon(adr_type); |
|
2003 int offset = MethodData::rtm_state_offset_in_bytes(); |
|
2004 Node* adr_node = basic_plus_adr(mdo, mdo, offset); |
|
2005 Node* rtm_state = make_load(control(), adr_node, TypeInt::INT, T_INT, adr_type, MemNode::unordered); |
|
2006 |
|
2007 // Separate Load from Cmp by Opaque. |
|
2008 // In expand_macro_nodes() it will be replaced either |
|
2009 // with this load when there are locks in the code |
|
2010 // or with ProfileRTM (cmp->in(2)) otherwise so that |
|
2011 // the check will fold. |
|
2012 Node* profile_state = makecon(TypeInt::make(ProfileRTM)); |
|
2013 Node* opq = _gvn.transform( new (C) Opaque3Node(C, rtm_state, Opaque3Node::RTM_OPT) ); |
|
2014 Node* chk = _gvn.transform( new (C) CmpINode(opq, profile_state) ); |
|
2015 Node* tst = _gvn.transform( new (C) BoolNode(chk, BoolTest::eq) ); |
|
2016 // Branch to failure if state was changed |
|
2017 { BuildCutout unless(this, tst, PROB_ALWAYS); |
|
2018 uncommon_trap(Deoptimization::Reason_rtm_state_change, |
|
2019 Deoptimization::Action_make_not_entrant); |
|
2020 } |
|
2021 } |
|
2022 #endif |
|
2023 } |
|
2024 |
1985 //------------------------------return_current--------------------------------- |
2025 //------------------------------return_current--------------------------------- |
1986 // Append current _map to _exit_return |
2026 // Append current _map to _exit_return |
1987 void Parse::return_current(Node* value) { |
2027 void Parse::return_current(Node* value) { |
1988 if (RegisterFinalizersAtInit && |
2028 if (RegisterFinalizersAtInit && |
1989 method()->intrinsic_id() == vmIntrinsics::_Object_init) { |
2029 method()->intrinsic_id() == vmIntrinsics::_Object_init) { |