< prev index next >

src/hotspot/share/opto/parse1.cpp

Print this page

1137   _exits.map()->apply_replaced_nodes(_new_idx);
1138 }
1139 
1140 //-----------------------------create_entry_map-------------------------------
1141 // Initialize our parser map to contain the types at method entry.
1142 // For OSR, the map contains a single RawPtr parameter.
1143 // Initial monitor locking for sync. methods is performed by do_method_entry.
1144 SafePointNode* Parse::create_entry_map() {
1145   // Check for really stupid bail-out cases.
1146   uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack();
1147   if (len >= 32760) {
1148     // Bailout expected, this is a very rare edge case.
1149     C->record_method_not_compilable("too many local variables");
1150     return nullptr;
1151   }
1152 
1153   // clear current replaced nodes that are of no use from here on (map was cloned in build_exits).
1154   _caller->map()->delete_replaced_nodes();
1155 
1156   // If this is an inlined method, we may have to do a receiver null check.
1157   if (_caller->has_method() && is_normal_parse() && !method()->is_static()) {
1158     GraphKit kit(_caller);
1159     kit.null_check_receiver_before_call(method());









1160     _caller = kit.transfer_exceptions_into_jvms();
1161     if (kit.stopped()) {
1162       _exits.add_exception_states_from(_caller);
1163       _exits.set_jvms(_caller);
1164       return nullptr;
1165     }
1166   }
1167 
1168   assert(method() != nullptr, "parser must have a method");
1169 
1170   // Create an initial safepoint to hold JVM state during parsing
1171   JVMState* jvms = new (C) JVMState(method(), _caller->has_method() ? _caller : nullptr);
1172   set_map(new SafePointNode(len, jvms));
1173   jvms->set_map(map());
1174   record_for_igvn(map());
1175   assert(jvms->endoff() == len, "correct jvms sizing");
1176 
1177   SafePointNode* inmap = _caller->map();
1178   assert(inmap != nullptr, "must have inmap");
1179   // In case of null check on receiver above

2173 
2174     Node* fast_io  = call->in(TypeFunc::I_O);
2175     Node* fast_mem = call->in(TypeFunc::Memory);
2176     // These two phis are pre-filled with copies of of the fast IO and Memory
2177     Node* io_phi   = PhiNode::make(result_rgn, fast_io,  Type::ABIO);
2178     Node* mem_phi  = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM);
2179 
2180     result_rgn->init_req(2, control());
2181     io_phi    ->init_req(2, i_o());
2182     mem_phi   ->init_req(2, reset_memory());
2183 
2184     set_all_memory( _gvn.transform(mem_phi) );
2185     set_i_o(        _gvn.transform(io_phi) );
2186   }
2187 
2188   set_control( _gvn.transform(result_rgn) );
2189 }
2190 
2191 // Add check to deoptimize once holder klass is fully initialized.
2192 void Parse::clinit_deopt() {



2193   assert(C->has_method(), "only for normal compilations");
2194   assert(depth() == 1, "only for main compiled method");
2195   assert(is_normal_parse(), "no barrier needed on osr entry");
2196   assert(!method()->holder()->is_not_initialized(), "initialization should have been started");
2197 
2198   set_parse_bci(0);
2199 
2200   Node* holder = makecon(TypeKlassPtr::make(method()->holder(), Type::trust_interfaces));
2201   guard_klass_being_initialized(holder);
2202 }
2203 
2204 // Add check to deoptimize if RTM state is not ProfileRTM
2205 void Parse::rtm_deopt() {
2206 #if INCLUDE_RTM_OPT
2207   if (C->profile_rtm()) {
2208     assert(C->has_method(), "only for normal compilations");
2209     assert(!C->method()->method_data()->is_empty(), "MDO is needed to record RTM state");
2210     assert(depth() == 1, "generate check only for main compiled method");
2211 
2212     // Set starting bci for uncommon trap.

1137   _exits.map()->apply_replaced_nodes(_new_idx);
1138 }
1139 
1140 //-----------------------------create_entry_map-------------------------------
1141 // Initialize our parser map to contain the types at method entry.
1142 // For OSR, the map contains a single RawPtr parameter.
1143 // Initial monitor locking for sync. methods is performed by do_method_entry.
1144 SafePointNode* Parse::create_entry_map() {
1145   // Check for really stupid bail-out cases.
1146   uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack();
1147   if (len >= 32760) {
1148     // Bailout expected, this is a very rare edge case.
1149     C->record_method_not_compilable("too many local variables");
1150     return nullptr;
1151   }
1152 
1153   // clear current replaced nodes that are of no use from here on (map was cloned in build_exits).
1154   _caller->map()->delete_replaced_nodes();
1155 
1156   // If this is an inlined method, we may have to do a receiver null check.
1157   if (_caller->has_method() && is_normal_parse()) {
1158     GraphKit kit(_caller);
1159     if (!method()->is_static()) {
1160       kit.null_check_receiver_before_call(method());
1161     } else if (C->do_clinit_barriers() && C->needs_clinit_barrier(method()->holder(), _caller->method())) {
1162       ciMethod* declared_method = kit.method()->get_method_at_bci(kit.bci());
1163       const int nargs = declared_method->arg_size();
1164       kit.inc_sp(nargs);
1165       Node* holder = makecon(TypeKlassPtr::make(method()->holder(), Type::trust_interfaces));
1166       kit.guard_klass_is_initialized(holder);
1167       kit.dec_sp(nargs);
1168     }
1169     _caller = kit.transfer_exceptions_into_jvms();
1170     if (kit.stopped()) {
1171       _exits.add_exception_states_from(_caller);
1172       _exits.set_jvms(_caller);
1173       return nullptr;
1174     }
1175   }
1176 
1177   assert(method() != nullptr, "parser must have a method");
1178 
1179   // Create an initial safepoint to hold JVM state during parsing
1180   JVMState* jvms = new (C) JVMState(method(), _caller->has_method() ? _caller : nullptr);
1181   set_map(new SafePointNode(len, jvms));
1182   jvms->set_map(map());
1183   record_for_igvn(map());
1184   assert(jvms->endoff() == len, "correct jvms sizing");
1185 
1186   SafePointNode* inmap = _caller->map();
1187   assert(inmap != nullptr, "must have inmap");
1188   // In case of null check on receiver above

2182 
2183     Node* fast_io  = call->in(TypeFunc::I_O);
2184     Node* fast_mem = call->in(TypeFunc::Memory);
2185     // These two phis are pre-filled with copies of of the fast IO and Memory
2186     Node* io_phi   = PhiNode::make(result_rgn, fast_io,  Type::ABIO);
2187     Node* mem_phi  = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM);
2188 
2189     result_rgn->init_req(2, control());
2190     io_phi    ->init_req(2, i_o());
2191     mem_phi   ->init_req(2, reset_memory());
2192 
2193     set_all_memory( _gvn.transform(mem_phi) );
2194     set_i_o(        _gvn.transform(io_phi) );
2195   }
2196 
2197   set_control( _gvn.transform(result_rgn) );
2198 }
2199 
2200 // Add check to deoptimize once holder klass is fully initialized.
2201 void Parse::clinit_deopt() {
2202   if (method()->holder()->is_initialized()) {
2203     return; // in case do_clinit_barriers() is true
2204   }
2205   assert(C->has_method(), "only for normal compilations");
2206   assert(depth() == 1, "only for main compiled method");
2207   assert(is_normal_parse(), "no barrier needed on osr entry");
2208   assert(!method()->holder()->is_not_initialized(), "initialization should have been started");
2209 
2210   set_parse_bci(0);
2211 
2212   Node* holder = makecon(TypeKlassPtr::make(method()->holder(), Type::trust_interfaces));
2213   guard_klass_being_initialized(holder);
2214 }
2215 
2216 // Add check to deoptimize if RTM state is not ProfileRTM
2217 void Parse::rtm_deopt() {
2218 #if INCLUDE_RTM_OPT
2219   if (C->profile_rtm()) {
2220     assert(C->has_method(), "only for normal compilations");
2221     assert(!C->method()->method_data()->is_empty(), "MDO is needed to record RTM state");
2222     assert(depth() == 1, "generate check only for main compiled method");
2223 
2224     // Set starting bci for uncommon trap.
< prev index next >