< prev index next >

src/hotspot/share/opto/parse1.cpp

Print this page

   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "compiler/compileLog.hpp"
  26 #include "interpreter/linkResolver.hpp"
  27 #include "memory/resourceArea.hpp"
  28 #include "oops/method.hpp"

  29 #include "opto/addnode.hpp"
  30 #include "opto/c2compiler.hpp"
  31 #include "opto/castnode.hpp"
  32 #include "opto/idealGraphPrinter.hpp"
  33 #include "opto/locknode.hpp"
  34 #include "opto/memnode.hpp"
  35 #include "opto/opaquenode.hpp"
  36 #include "opto/parse.hpp"
  37 #include "opto/rootnode.hpp"
  38 #include "opto/runtime.hpp"
  39 #include "opto/type.hpp"
  40 #include "runtime/handles.inline.hpp"

  41 #include "runtime/safepointMechanism.hpp"
  42 #include "runtime/sharedRuntime.hpp"
  43 #include "utilities/bitMap.inline.hpp"
  44 #include "utilities/copy.hpp"
  45 
  46 // Static array so we can figure out which bytecodes stop us from compiling
  47 // the most. Some of the non-static variables are needed in bytecodeInfo.cpp
  48 // and eventually should be encapsulated in a proper class (gri 8/18/98).
  49 
  50 #ifndef PRODUCT
  51 uint nodes_created             = 0;
  52 uint methods_parsed            = 0;
  53 uint methods_seen              = 0;
  54 uint blocks_parsed             = 0;
  55 uint blocks_seen               = 0;
  56 
  57 uint explicit_null_checks_inserted = 0;
  58 uint explicit_null_checks_elided   = 0;
  59 uint all_null_checks_found         = 0;
  60 uint implicit_null_checks          = 0;

1115   _exits.map()->apply_replaced_nodes(_new_idx);
1116 }
1117 
1118 //-----------------------------create_entry_map-------------------------------
1119 // Initialize our parser map to contain the types at method entry.
1120 // For OSR, the map contains a single RawPtr parameter.
1121 // Initial monitor locking for sync. methods is performed by do_method_entry.
1122 SafePointNode* Parse::create_entry_map() {
1123   // Check for really stupid bail-out cases.
1124   uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack();
1125   if (len >= 32760) {
1126     // Bailout expected, this is a very rare edge case.
1127     C->record_method_not_compilable("too many local variables");
1128     return nullptr;
1129   }
1130 
1131   // clear current replaced nodes that are of no use from here on (map was cloned in build_exits).
1132   _caller->map()->delete_replaced_nodes();
1133 
1134   // If this is an inlined method, we may have to do a receiver null check.
1135   if (_caller->has_method() && is_normal_parse() && !method()->is_static()) {
1136     GraphKit kit(_caller);
1137     kit.null_check_receiver_before_call(method());









1138     _caller = kit.transfer_exceptions_into_jvms();
1139     if (kit.stopped()) {
1140       _exits.add_exception_states_from(_caller);
1141       _exits.set_jvms(_caller);
1142       return nullptr;
1143     }
1144   }
1145 
1146   assert(method() != nullptr, "parser must have a method");
1147 
1148   // Create an initial safepoint to hold JVM state during parsing
1149   JVMState* jvms = new (C) JVMState(method(), _caller->has_method() ? _caller : nullptr);
1150   set_map(new SafePointNode(len, jvms));
1151 
1152   // Capture receiver info for compiled lambda forms.
1153   if (method()->is_compiled_lambda_form()) {
1154     ciInstance* recv_info = _caller->compute_receiver_info(method());
1155     jvms->set_receiver_info(recv_info);
1156   }
1157 

1177     set_all_memory(reset_memory());
1178   }
1179   assert(merged_memory(), "");
1180 
1181   // Now add the locals which are initially bound to arguments:
1182   uint arg_size = tf()->domain()->cnt();
1183   ensure_stack(arg_size - TypeFunc::Parms);  // OSR methods have funny args
1184   for (i = TypeFunc::Parms; i < arg_size; i++) {
1185     map()->init_req(i, inmap->argument(_caller, i - TypeFunc::Parms));
1186   }
1187 
1188   // Clear out the rest of the map (locals and stack)
1189   for (i = arg_size; i < len; i++) {
1190     map()->init_req(i, top());
1191   }
1192 
1193   SafePointNode* entry_map = stop();
1194   return entry_map;
1195 }
1196 









































































































1197 //-----------------------------do_method_entry--------------------------------
1198 // Emit any code needed in the pseudo-block before BCI zero.
1199 // The main thing to do is lock the receiver of a synchronized method.
1200 void Parse::do_method_entry() {
1201   set_parse_bci(InvocationEntryBci); // Pseudo-BCP
1202   set_sp(0);                         // Java Stack Pointer
1203 
1204   NOT_PRODUCT( count_compiled_calls(true/*at_method_entry*/, false/*is_inline*/); )
1205 
1206   if (C->env()->dtrace_method_probes()) {
1207     make_dtrace_method_entry(method());
1208   }
1209 


1210 #ifdef ASSERT
1211   // Narrow receiver type when it is too broad for the method being parsed.
1212   if (!method()->is_static()) {
1213     ciInstanceKlass* callee_holder = method()->holder();
1214     const Type* holder_type = TypeInstPtr::make(TypePtr::BotPTR, callee_holder, Type::trust_interfaces);
1215 
1216     Node* receiver_obj = local(0);
1217     const TypeInstPtr* receiver_type = _gvn.type(receiver_obj)->isa_instptr();
1218 
1219     if (receiver_type != nullptr && !receiver_type->higher_equal(holder_type)) {
1220       // Receiver should always be a subtype of callee holder.
1221       // But, since C2 type system doesn't properly track interfaces,
1222       // the invariant can't be expressed in the type system for default methods.
1223       // Example: for unrelated C <: I and D <: I, (C `meet` D) = Object </: I.
1224       assert(callee_holder->is_interface(), "missing subtype check");
1225 
1226       // Perform dynamic receiver subtype check against callee holder class w/ a halt on failure.
1227       Node* holder_klass = _gvn.makecon(TypeKlassPtr::make(callee_holder, Type::trust_interfaces));
1228       Node* not_subtype_ctrl = gen_subtype_check(receiver_obj, holder_klass);
1229       assert(!stopped(), "not a subtype");

1247     // Setup Object Pointer
1248     Node *lock_obj = nullptr;
1249     if (method()->is_static()) {
1250       ciInstance* mirror = _method->holder()->java_mirror();
1251       const TypeInstPtr *t_lock = TypeInstPtr::make(mirror);
1252       lock_obj = makecon(t_lock);
1253     } else {                  // Else pass the "this" pointer,
1254       lock_obj = local(0);    // which is Parm0 from StartNode
1255     }
1256     // Clear out dead values from the debug info.
1257     kill_dead_locals();
1258     // Build the FastLockNode
1259     _synch_lock = shared_lock(lock_obj);
1260     // Check for bailout in shared_lock
1261     if (failing()) { return; }
1262   }
1263 
1264   // Feed profiling data for parameters to the type system so it can
1265   // propagate it as speculative types
1266   record_profiled_parameters_for_speculation();


1267 }
1268 
1269 //------------------------------init_blocks------------------------------------
1270 // Initialize our parser map to contain the types/monitors at method entry.
1271 void Parse::init_blocks() {
1272   // Create the blocks.
1273   _block_count = flow()->block_count();
1274   _blocks = NEW_RESOURCE_ARRAY(Block, _block_count);
1275 
1276   // Initialize the structs.
1277   for (int rpo = 0; rpo < block_count(); rpo++) {
1278     Block* block = rpo_at(rpo);
1279     new(block) Block(this, rpo);
1280   }
1281 
1282   // Collect predecessor and successor information.
1283   for (int rpo = 0; rpo < block_count(); rpo++) {
1284     Block* block = rpo_at(rpo);
1285     block->init_graph(this);
1286   }

1575       // to produce successors for trapping blocks.
1576       int trap_index = block()->flow()->trap_index();
1577       assert(trap_index != 0, "trap index must be valid");
1578       uncommon_trap(trap_index);
1579       break;
1580     }
1581 
1582     NOT_PRODUCT( parse_histogram()->set_initial_state(bc()); );
1583 
1584 #ifdef ASSERT
1585     int pre_bc_sp = sp();
1586     int inputs, depth;
1587     bool have_se = !stopped() && compute_stack_effects(inputs, depth);
1588     assert(!have_se || pre_bc_sp >= inputs, "have enough stack to execute this BC: pre_bc_sp=%d, inputs=%d", pre_bc_sp, inputs);
1589 #endif //ASSERT
1590 
1591     do_one_bytecode();
1592     if (failing()) return;
1593 
1594     assert(!have_se || stopped() || failing() || (sp() - pre_bc_sp) == depth,
1595            "incorrect depth prediction: sp=%d, pre_bc_sp=%d, depth=%d", sp(), pre_bc_sp, depth);
1596 
1597     do_exceptions();
1598 
1599     NOT_PRODUCT( parse_histogram()->record_change(); );
1600 
1601     if (log != nullptr)
1602       log->clear_context();  // skip marker if nothing was printed
1603 
1604     // Fall into next bytecode.  Each bytecode normally has 1 sequential
1605     // successor which is typically made ready by visiting this bytecode.
1606     // If the successor has several predecessors, then it is a merge
1607     // point, starts a new basic block, and is handled like other basic blocks.
1608   }
1609 }
1610 
1611 
1612 //------------------------------merge------------------------------------------
1613 void Parse::set_parse_bci(int bci) {
1614   set_bci(bci);
1615   Node_Notes* nn = C->default_node_notes();

2157 
2158     Node* fast_io  = call->in(TypeFunc::I_O);
2159     Node* fast_mem = call->in(TypeFunc::Memory);
2160     // These two phis are pre-filled with copies of of the fast IO and Memory
2161     Node* io_phi   = PhiNode::make(result_rgn, fast_io,  Type::ABIO);
2162     Node* mem_phi  = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM);
2163 
2164     result_rgn->init_req(2, control());
2165     io_phi    ->init_req(2, i_o());
2166     mem_phi   ->init_req(2, reset_memory());
2167 
2168     set_all_memory( _gvn.transform(mem_phi) );
2169     set_i_o(        _gvn.transform(io_phi) );
2170   }
2171 
2172   set_control( _gvn.transform(result_rgn) );
2173 }
2174 
2175 // Add check to deoptimize once holder klass is fully initialized.
2176 void Parse::clinit_deopt() {



2177   assert(C->has_method(), "only for normal compilations");
2178   assert(depth() == 1, "only for main compiled method");
2179   assert(is_normal_parse(), "no barrier needed on osr entry");
2180   assert(!method()->holder()->is_not_initialized(), "initialization should have been started");
2181 
2182   set_parse_bci(0);
2183 
2184   Node* holder = makecon(TypeKlassPtr::make(method()->holder(), Type::trust_interfaces));
2185   guard_klass_being_initialized(holder);
2186 }
2187 
2188 //------------------------------return_current---------------------------------
2189 // Append current _map to _exit_return
2190 void Parse::return_current(Node* value) {
2191   if (method()->intrinsic_id() == vmIntrinsics::_Object_init) {
2192     call_register_finalizer();
2193   }
2194 
2195   // Do not set_parse_bci, so that return goo is credited to the return insn.
2196   set_bci(InvocationEntryBci);

   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "compiler/compileLog.hpp"
  26 #include "interpreter/linkResolver.hpp"
  27 #include "memory/resourceArea.hpp"
  28 #include "oops/method.hpp"
  29 #include "oops/trainingData.hpp"
  30 #include "opto/addnode.hpp"
  31 #include "opto/c2compiler.hpp"
  32 #include "opto/castnode.hpp"
  33 #include "opto/idealGraphPrinter.hpp"
  34 #include "opto/locknode.hpp"
  35 #include "opto/memnode.hpp"
  36 #include "opto/opaquenode.hpp"
  37 #include "opto/parse.hpp"
  38 #include "opto/rootnode.hpp"
  39 #include "opto/runtime.hpp"
  40 #include "opto/type.hpp"
  41 #include "runtime/handles.inline.hpp"
  42 #include "runtime/runtimeUpcalls.hpp"
  43 #include "runtime/safepointMechanism.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "utilities/bitMap.inline.hpp"
  46 #include "utilities/copy.hpp"
  47 
  48 // Static array so we can figure out which bytecodes stop us from compiling
  49 // the most. Some of the non-static variables are needed in bytecodeInfo.cpp
  50 // and eventually should be encapsulated in a proper class (gri 8/18/98).
  51 
  52 #ifndef PRODUCT
  53 uint nodes_created             = 0;
  54 uint methods_parsed            = 0;
  55 uint methods_seen              = 0;
  56 uint blocks_parsed             = 0;
  57 uint blocks_seen               = 0;
  58 
  59 uint explicit_null_checks_inserted = 0;
  60 uint explicit_null_checks_elided   = 0;
  61 uint all_null_checks_found         = 0;
  62 uint implicit_null_checks          = 0;

1117   _exits.map()->apply_replaced_nodes(_new_idx);
1118 }
1119 
1120 //-----------------------------create_entry_map-------------------------------
1121 // Initialize our parser map to contain the types at method entry.
1122 // For OSR, the map contains a single RawPtr parameter.
1123 // Initial monitor locking for sync. methods is performed by do_method_entry.
1124 SafePointNode* Parse::create_entry_map() {
1125   // Check for really stupid bail-out cases.
1126   uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack();
1127   if (len >= 32760) {
1128     // Bailout expected, this is a very rare edge case.
1129     C->record_method_not_compilable("too many local variables");
1130     return nullptr;
1131   }
1132 
1133   // clear current replaced nodes that are of no use from here on (map was cloned in build_exits).
1134   _caller->map()->delete_replaced_nodes();
1135 
1136   // If this is an inlined method, we may have to do a receiver null check.
1137   if (_caller->has_method() && is_normal_parse()) {
1138     GraphKit kit(_caller);
1139     if (!method()->is_static()) {
1140       kit.null_check_receiver_before_call(method());
1141     } else if (C->do_clinit_barriers() && C->needs_clinit_barrier(method()->holder(), _caller->method())) {
1142       ciMethod* declared_method = kit.method()->get_method_at_bci(kit.bci());
1143       const int nargs = declared_method->arg_size();
1144       kit.inc_sp(nargs);
1145       Node* holder = makecon(TypeKlassPtr::make(method()->holder(), Type::trust_interfaces));
1146       kit.guard_klass_is_initialized(holder);
1147       kit.dec_sp(nargs);
1148     }
1149     _caller = kit.transfer_exceptions_into_jvms();
1150     if (kit.stopped()) {
1151       _exits.add_exception_states_from(_caller);
1152       _exits.set_jvms(_caller);
1153       return nullptr;
1154     }
1155   }
1156 
1157   assert(method() != nullptr, "parser must have a method");
1158 
1159   // Create an initial safepoint to hold JVM state during parsing
1160   JVMState* jvms = new (C) JVMState(method(), _caller->has_method() ? _caller : nullptr);
1161   set_map(new SafePointNode(len, jvms));
1162 
1163   // Capture receiver info for compiled lambda forms.
1164   if (method()->is_compiled_lambda_form()) {
1165     ciInstance* recv_info = _caller->compute_receiver_info(method());
1166     jvms->set_receiver_info(recv_info);
1167   }
1168 

1188     set_all_memory(reset_memory());
1189   }
1190   assert(merged_memory(), "");
1191 
1192   // Now add the locals which are initially bound to arguments:
1193   uint arg_size = tf()->domain()->cnt();
1194   ensure_stack(arg_size - TypeFunc::Parms);  // OSR methods have funny args
1195   for (i = TypeFunc::Parms; i < arg_size; i++) {
1196     map()->init_req(i, inmap->argument(_caller, i - TypeFunc::Parms));
1197   }
1198 
1199   // Clear out the rest of the map (locals and stack)
1200   for (i = arg_size; i < len; i++) {
1201     map()->init_req(i, top());
1202   }
1203 
1204   SafePointNode* entry_map = stop();
1205   return entry_map;
1206 }
1207 
1208 #if INCLUDE_CDS
1209 static int scale_limit(int64_t limit) {
1210  // To scale invocation limit a hyperbolic saturation curve formula
1211  // is used with upper limit 100K.
1212  return (int)(AOTCodeInvokeBase + limit / (1.0 + limit / (1000000.0 * AOTCodeInvokeScale)));
1213 }
1214 
1215 #define AOT_COUNT_INC 2
1216 #define AOT_RECOMPILE_BIT 1
1217 
1218 void Parse::count_aot_code_calls() {
1219   bool is_aot_compilation = C->env()->is_aot_compile();
1220   if (UseAOTCodeCounters && (depth() == 1) && is_aot_compilation) {
1221     // Clear out dead values from the debug info in following runtime call
1222     kill_dead_locals();
1223 
1224     // Use method invocations count during training run and compare
1225     // to invocations of AOT code during production run to trigger JIT
1226     // compilation and replace AOT code with normal JITed code.
1227     ciMetadata* mcp = method()->ensure_method_counters();
1228     precond(mcp != nullptr);
1229     const TypePtr* mc_type = TypeMetadataPtr::make(TypePtr::Constant, mcp, 0);
1230     Node* mc = makecon(mc_type);
1231 
1232     precond(MethodTrainingData::have_data());
1233     methodHandle mh(Thread::current(), method()->get_Method());
1234     MethodTrainingData* mtd = MethodTrainingData::find_fast(mh);
1235     precond(mtd != nullptr);
1236     int64_t limit = mtd->invocation_count();
1237     int scaled_limit = AOT_COUNT_INC * scale_limit(limit);
1238 
1239     // Count AOT compiled code invocations (use 32 bits because scaled limit fits into 32 bits)
1240     intptr_t offset = in_bytes(MethodCounters::aot_code_invocation_counter_offset());
1241     int step = AOT_COUNT_INC;
1242     Node* cnt_adr = basic_plus_adr(C->top(), mc, offset);
1243     Node* ctrl = control();
1244     Node* cnt  = make_load(ctrl, cnt_adr, TypeInt::INT, T_INT, MemNode::unordered);
1245     Node* incr = _gvn.transform(new AddINode(cnt, intcon(step)));
1246     store_to_memory(ctrl, cnt_adr, incr, T_INT, MemNode::unordered);
1247     // Preserve memory for Phi node below
1248     Node* st_mem = MergeMemNode::make(map()->memory());
1249     _gvn.set_type_bottom(st_mem);
1250 
1251     Node* lim = intcon(scaled_limit);
1252     Node* chk = _gvn.transform( new CmpINode(incr, lim) );
1253     Node* tst = _gvn.transform( new BoolNode(chk, BoolTest::lt) );
1254     IfNode* iff = create_and_map_if(control(), tst, PROB_ALWAYS, (float)limit);
1255 
1256     RegionNode* result_rgn = new RegionNode(4);
1257     record_for_igvn(result_rgn);
1258 
1259     Node*  skip_call = _gvn.transform(new IfTrueNode(iff));
1260     result_rgn->init_req(1, skip_call);
1261 
1262     Node* in1_io  = i_o();
1263     Node* in1_mem = st_mem;
1264     // These two phis are pre-filled with copies of the fast IO and Memory
1265     Node* io_phi   = PhiNode::make(result_rgn, in1_io,  Type::ABIO);
1266     Node* mem_phi  = PhiNode::make(result_rgn, in1_mem, Type::MEMORY, TypePtr::BOTTOM);
1267 
1268     Node* needs_call = _gvn.transform(new IfFalseNode(iff));
1269     set_control(needs_call);
1270 
1271     Node* recomp_bit = intcon(AOT_RECOMPILE_BIT);
1272     Node* rbit = _gvn.transform( new AndINode(incr, recomp_bit) );
1273     Node* chk2 = _gvn.transform( new CmpINode(rbit, intcon(0)) );
1274     Node* tst2 = _gvn.transform( new BoolNode(chk2, BoolTest::ne) );
1275     IfNode* iff2 = create_and_map_if(control(), tst2, PROB_FAIR, COUNT_UNKNOWN);
1276 
1277     Node*  skip_call2 = _gvn.transform(new IfTrueNode(iff2));
1278     result_rgn->init_req(2, skip_call2);
1279 
1280     Node* needs_call2 = _gvn.transform(new IfFalseNode(iff2));
1281     set_control(needs_call2);
1282 
1283     Node* new_val = _gvn.transform(new OrINode(incr, recomp_bit));
1284     store_to_memory(control(), cnt_adr, new_val, T_INT, MemNode::unordered);
1285 
1286     const TypePtr* m_type = TypeMetadataPtr::make(method());
1287     Node* m = makecon(m_type);
1288     Node* call = make_runtime_call(RC_NO_LEAF | RC_UNCOMMON,
1289                           OptoRuntime::compile_method_Type(),
1290                           OptoRuntime::compile_method_Java(),
1291                           "compile_method", TypePtr::BOTTOM, m);
1292 
1293     // State before call
1294     io_phi ->init_req(2, in1_io);
1295     mem_phi->init_req(2, in1_mem);
1296 
1297     // State after call
1298     result_rgn->init_req(3, control());
1299     io_phi ->init_req(3, i_o());
1300     mem_phi->init_req(3, reset_memory());
1301 
1302     set_all_memory( _gvn.transform(mem_phi) );
1303     set_i_o(        _gvn.transform(io_phi) );
1304     set_control(    _gvn.transform(result_rgn) );
1305   }
1306 }
1307 
1308 #undef AOT_COUNT_INC
1309 #undef AOT_RECOMPILE_BIT
1310 
1311 #endif
1312 
1313 //-----------------------------do_method_entry--------------------------------
1314 // Emit any code needed in the pseudo-block before BCI zero.
1315 // The main thing to do is lock the receiver of a synchronized method.
1316 void Parse::do_method_entry() {
1317   set_parse_bci(InvocationEntryBci); // Pseudo-BCP
1318   set_sp(0);                         // Java Stack Pointer
1319 
1320   NOT_PRODUCT( count_compiled_calls(true/*at_method_entry*/, false/*is_inline*/); )
1321 
1322   if (C->env()->dtrace_method_probes()) {
1323     make_dtrace_method_entry(method());
1324   }
1325 
1326   install_on_method_entry_runtime_upcalls(method());
1327 
1328 #ifdef ASSERT
1329   // Narrow receiver type when it is too broad for the method being parsed.
1330   if (!method()->is_static()) {
1331     ciInstanceKlass* callee_holder = method()->holder();
1332     const Type* holder_type = TypeInstPtr::make(TypePtr::BotPTR, callee_holder, Type::trust_interfaces);
1333 
1334     Node* receiver_obj = local(0);
1335     const TypeInstPtr* receiver_type = _gvn.type(receiver_obj)->isa_instptr();
1336 
1337     if (receiver_type != nullptr && !receiver_type->higher_equal(holder_type)) {
1338       // Receiver should always be a subtype of callee holder.
1339       // But, since C2 type system doesn't properly track interfaces,
1340       // the invariant can't be expressed in the type system for default methods.
1341       // Example: for unrelated C <: I and D <: I, (C `meet` D) = Object </: I.
1342       assert(callee_holder->is_interface(), "missing subtype check");
1343 
1344       // Perform dynamic receiver subtype check against callee holder class w/ a halt on failure.
1345       Node* holder_klass = _gvn.makecon(TypeKlassPtr::make(callee_holder, Type::trust_interfaces));
1346       Node* not_subtype_ctrl = gen_subtype_check(receiver_obj, holder_klass);
1347       assert(!stopped(), "not a subtype");

1365     // Setup Object Pointer
1366     Node *lock_obj = nullptr;
1367     if (method()->is_static()) {
1368       ciInstance* mirror = _method->holder()->java_mirror();
1369       const TypeInstPtr *t_lock = TypeInstPtr::make(mirror);
1370       lock_obj = makecon(t_lock);
1371     } else {                  // Else pass the "this" pointer,
1372       lock_obj = local(0);    // which is Parm0 from StartNode
1373     }
1374     // Clear out dead values from the debug info.
1375     kill_dead_locals();
1376     // Build the FastLockNode
1377     _synch_lock = shared_lock(lock_obj);
1378     // Check for bailout in shared_lock
1379     if (failing()) { return; }
1380   }
1381 
1382   // Feed profiling data for parameters to the type system so it can
1383   // propagate it as speculative types
1384   record_profiled_parameters_for_speculation();
1385 
1386   CDS_ONLY( count_aot_code_calls(); )
1387 }
1388 
1389 //------------------------------init_blocks------------------------------------
1390 // Initialize our parser map to contain the types/monitors at method entry.
1391 void Parse::init_blocks() {
1392   // Create the blocks.
1393   _block_count = flow()->block_count();
1394   _blocks = NEW_RESOURCE_ARRAY(Block, _block_count);
1395 
1396   // Initialize the structs.
1397   for (int rpo = 0; rpo < block_count(); rpo++) {
1398     Block* block = rpo_at(rpo);
1399     new(block) Block(this, rpo);
1400   }
1401 
1402   // Collect predecessor and successor information.
1403   for (int rpo = 0; rpo < block_count(); rpo++) {
1404     Block* block = rpo_at(rpo);
1405     block->init_graph(this);
1406   }

1695       // to produce successors for trapping blocks.
1696       int trap_index = block()->flow()->trap_index();
1697       assert(trap_index != 0, "trap index must be valid");
1698       uncommon_trap(trap_index);
1699       break;
1700     }
1701 
1702     NOT_PRODUCT( parse_histogram()->set_initial_state(bc()); );
1703 
1704 #ifdef ASSERT
1705     int pre_bc_sp = sp();
1706     int inputs, depth;
1707     bool have_se = !stopped() && compute_stack_effects(inputs, depth);
1708     assert(!have_se || pre_bc_sp >= inputs, "have enough stack to execute this BC: pre_bc_sp=%d, inputs=%d", pre_bc_sp, inputs);
1709 #endif //ASSERT
1710 
1711     do_one_bytecode();
1712     if (failing()) return;
1713 
1714     assert(!have_se || stopped() || failing() || (sp() - pre_bc_sp) == depth,
1715            "incorrect depth prediction: bc=%s bci=%d, sp=%d, pre_bc_sp=%d, depth=%d", Bytecodes::name(bc()), bci(), sp(), pre_bc_sp, depth);
1716 
1717     do_exceptions();
1718 
1719     NOT_PRODUCT( parse_histogram()->record_change(); );
1720 
1721     if (log != nullptr)
1722       log->clear_context();  // skip marker if nothing was printed
1723 
1724     // Fall into next bytecode.  Each bytecode normally has 1 sequential
1725     // successor which is typically made ready by visiting this bytecode.
1726     // If the successor has several predecessors, then it is a merge
1727     // point, starts a new basic block, and is handled like other basic blocks.
1728   }
1729 }
1730 
1731 
1732 //------------------------------merge------------------------------------------
1733 void Parse::set_parse_bci(int bci) {
1734   set_bci(bci);
1735   Node_Notes* nn = C->default_node_notes();

2277 
2278     Node* fast_io  = call->in(TypeFunc::I_O);
2279     Node* fast_mem = call->in(TypeFunc::Memory);
2280     // These two phis are pre-filled with copies of of the fast IO and Memory
2281     Node* io_phi   = PhiNode::make(result_rgn, fast_io,  Type::ABIO);
2282     Node* mem_phi  = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM);
2283 
2284     result_rgn->init_req(2, control());
2285     io_phi    ->init_req(2, i_o());
2286     mem_phi   ->init_req(2, reset_memory());
2287 
2288     set_all_memory( _gvn.transform(mem_phi) );
2289     set_i_o(        _gvn.transform(io_phi) );
2290   }
2291 
2292   set_control( _gvn.transform(result_rgn) );
2293 }
2294 
2295 // Add check to deoptimize once holder klass is fully initialized.
2296 void Parse::clinit_deopt() {
2297   if (method()->holder()->is_initialized()) {
2298     return; // in case do_clinit_barriers() is true
2299   }
2300   assert(C->has_method(), "only for normal compilations");
2301   assert(depth() == 1, "only for main compiled method");
2302   assert(is_normal_parse(), "no barrier needed on osr entry");
2303   assert(!method()->holder()->is_not_initialized(), "initialization should have been started");
2304 
2305   set_parse_bci(0);
2306 
2307   Node* holder = makecon(TypeKlassPtr::make(method()->holder(), Type::trust_interfaces));
2308   guard_klass_being_initialized(holder);
2309 }
2310 
2311 //------------------------------return_current---------------------------------
2312 // Append current _map to _exit_return
2313 void Parse::return_current(Node* value) {
2314   if (method()->intrinsic_id() == vmIntrinsics::_Object_init) {
2315     call_register_finalizer();
2316   }
2317 
2318   // Do not set_parse_bci, so that return goo is credited to the return insn.
2319   set_bci(InvocationEntryBci);
< prev index next >