468 st->print("[%d]", spobj->n_fields());
469 } else if (cik->is_obj_array_klass()) {
470 ciKlass* cie = cik->as_obj_array_klass()->base_element_klass();
471 if (cie->is_instance_klass()) {
472 cie->print_name_on(st);
473 } else if (cie->is_type_array_klass()) {
474 cie->as_array_klass()->base_element_type()->print_name_on(st);
475 } else {
476 ShouldNotReachHere();
477 }
478 st->print("[%d]", spobj->n_fields());
479 int ndim = cik->as_array_klass()->dimension() - 1;
480 while (ndim-- > 0) {
481 st->print("[]");
482 }
483 }
484 st->print("={");
485 uint nf = spobj->n_fields();
486 if (nf > 0) {
487 uint first_ind = spobj->first_index(mcall->jvms());
488 Node* fld_node = mcall->in(first_ind);
489 ciField* cifield;
490 if (iklass != NULL) {
491 st->print(" [");
492 cifield = iklass->nonstatic_field_at(0);
493 cifield->print_name_on(st);
494 format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
495 } else {
496 format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
497 }
498 for (uint j = 1; j < nf; j++) {
499 fld_node = mcall->in(first_ind+j);
500 if (iklass != NULL) {
501 st->print(", [");
502 cifield = iklass->nonstatic_field_at(j);
503 cifield->print_name_on(st);
504 format_helper(regalloc, st, fld_node, ":", j, &scobjs);
505 } else {
506 format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
507 }
508 }
509 }
510 st->print(" }");
511 }
512 }
513 st->cr();
514 if (caller() != NULL) caller()->format(regalloc, n, st);
515 }
516
517
518 void JVMState::dump_spec(outputStream *st) const {
519 if (_method != NULL) {
520 bool printed = false;
521 if (!Verbose) {
522 // The JVMS dumps make really, really long lines.
523 // Take out the most boring parts, which are the package prefixes.
524 char buf[500];
525 stringStream namest(buf, sizeof(buf));
526 _method->print_short_name(&namest);
944 set_generator(NULL);
945 }
946 } else {
947 assert(callee->has_member_arg(), "wrong type of call?");
948 if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) {
949 phase->C->prepend_late_inline(cg);
950 set_generator(NULL);
951 }
952 }
953 }
954 return SafePointNode::Ideal(phase, can_reshape);
955 }
956
957 bool CallNode::is_call_to_arraycopystub() const {
958 if (_name != NULL && strstr(_name, "arraycopy") != 0) {
959 return true;
960 }
961 return false;
962 }
963
964 //=============================================================================
965 uint CallJavaNode::size_of() const { return sizeof(*this); }
966 bool CallJavaNode::cmp( const Node &n ) const {
967 CallJavaNode &call = (CallJavaNode&)n;
968 return CallNode::cmp(call) && _method == call._method &&
969 _override_symbolic_info == call._override_symbolic_info;
970 }
971 #ifdef ASSERT
972 bool CallJavaNode::validate_symbolic_info() const {
973 if (method() == NULL) {
974 return true; // call into runtime or uncommon trap
975 }
976 ciMethod* symbolic_info = jvms()->method()->get_method_at_bci(_bci);
977 ciMethod* callee = method();
978 if (symbolic_info->is_method_handle_intrinsic() && !callee->is_method_handle_intrinsic()) {
979 assert(override_symbolic_info(), "should be set");
980 }
981 assert(ciMethod::is_consistent_info(symbolic_info, callee), "inconsistent info");
982 return true;
983 }
1285 }
1286
1287 void SafePointNode::disconnect_from_root(PhaseIterGVN *igvn) {
1288 assert(Opcode() == Op_SafePoint, "only value for safepoint in loops");
1289 int nb = igvn->C->root()->find_prec_edge(this);
1290 if (nb != -1) {
1291 igvn->C->root()->rm_prec(nb);
1292 }
1293 }
1294
1295 //============== SafePointScalarObjectNode ==============
1296
1297 SafePointScalarObjectNode::SafePointScalarObjectNode(const TypeOopPtr* tp,
1298 #ifdef ASSERT
1299 AllocateNode* alloc,
1300 #endif
1301 uint first_index,
1302 uint n_fields) :
1303 TypeNode(tp, 1), // 1 control input -- seems required. Get from root.
1304 _first_index(first_index),
1305 _n_fields(n_fields)
1306 #ifdef ASSERT
1307 , _alloc(alloc)
1308 #endif
1309 {
1310 init_class_id(Class_SafePointScalarObject);
1311 }
1312
1313 // Do not allow value-numbering for SafePointScalarObject node.
1314 uint SafePointScalarObjectNode::hash() const { return NO_HASH; }
1315 bool SafePointScalarObjectNode::cmp( const Node &n ) const {
1316 return (&n == this); // Always fail except on self
1317 }
1318
1319 uint SafePointScalarObjectNode::ideal_reg() const {
1320 return 0; // No matching to machine instruction
1321 }
1322
1323 const RegMask &SafePointScalarObjectNode::in_RegMask(uint idx) const {
1324 return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
1325 }
1347 #ifndef PRODUCT
1348 void SafePointScalarObjectNode::dump_spec(outputStream *st) const {
1349 st->print(" # fields@[%d..%d]", first_index(),
1350 first_index() + n_fields() - 1);
1351 }
1352
1353 #endif
1354
1355 //=============================================================================
1356 uint AllocateNode::size_of() const { return sizeof(*this); }
1357
1358 AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype,
1359 Node *ctrl, Node *mem, Node *abio,
1360 Node *size, Node *klass_node, Node *initial_test)
1361 : CallNode(atype, NULL, TypeRawPtr::BOTTOM)
1362 {
1363 init_class_id(Class_Allocate);
1364 init_flags(Flag_is_macro);
1365 _is_scalar_replaceable = false;
1366 _is_non_escaping = false;
1367 _is_allocation_MemBar_redundant = false;
1368 Node *topnode = C->top();
1369
1370 init_req( TypeFunc::Control , ctrl );
1371 init_req( TypeFunc::I_O , abio );
1372 init_req( TypeFunc::Memory , mem );
1373 init_req( TypeFunc::ReturnAdr, topnode );
1374 init_req( TypeFunc::FramePtr , topnode );
1375 init_req( AllocSize , size);
1376 init_req( KlassNode , klass_node);
1377 init_req( InitialTest , initial_test);
1378 init_req( ALength , topnode);
1379 C->add_macro_node(this);
1380 }
1381
1382 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1383 {
1384 assert(initializer != NULL &&
1385 initializer->is_initializer() &&
1386 !initializer->is_static(),
|
468 st->print("[%d]", spobj->n_fields());
469 } else if (cik->is_obj_array_klass()) {
470 ciKlass* cie = cik->as_obj_array_klass()->base_element_klass();
471 if (cie->is_instance_klass()) {
472 cie->print_name_on(st);
473 } else if (cie->is_type_array_klass()) {
474 cie->as_array_klass()->base_element_type()->print_name_on(st);
475 } else {
476 ShouldNotReachHere();
477 }
478 st->print("[%d]", spobj->n_fields());
479 int ndim = cik->as_array_klass()->dimension() - 1;
480 while (ndim-- > 0) {
481 st->print("[]");
482 }
483 }
484 st->print("={");
485 uint nf = spobj->n_fields();
486 if (nf > 0) {
487 uint first_ind = spobj->first_index(mcall->jvms());
488 Node* fld_node = NULL;
489 ciField* cifield;
490 if (iklass != NULL) {
491 st->print(" [");
492 cifield = iklass->nonstatic_field_at(0);
493 cifield->print_name_on(st);
494 if(spobj->stack_allocated()) {
495 st->print(":*0]");
496 } else {
497 fld_node = mcall->in(first_ind);
498 format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
499 }
500 } else {
501 if(spobj->stack_allocated()) {
502 st->print("[*0]");
503 } else {
504 fld_node = mcall->in(first_ind);
505 format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
506 }
507 }
508 for (uint j = 1; j < nf; j++) {
509 if (iklass != NULL) {
510 st->print(", [");
511 cifield = iklass->nonstatic_field_at(j);
512 cifield->print_name_on(st);
513 if(spobj->stack_allocated()) {
514 st->print(":*%d]", j);
515 } else {
516 fld_node = mcall->in(first_ind+j);
517 format_helper(regalloc, st, fld_node, ":", j, &scobjs);
518 }
519 } else {
520 if(spobj->stack_allocated()) {
521 st->print(", [*%d]", j);
522 } else {
523 fld_node = mcall->in(first_ind+j);
524 format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
525 }
526 }
527 }
528 }
529 st->print(" }");
530 }
531 }
532 st->cr();
533 if (caller() != NULL) caller()->format(regalloc, n, st);
534 }
535
536
537 void JVMState::dump_spec(outputStream *st) const {
538 if (_method != NULL) {
539 bool printed = false;
540 if (!Verbose) {
541 // The JVMS dumps make really, really long lines.
542 // Take out the most boring parts, which are the package prefixes.
543 char buf[500];
544 stringStream namest(buf, sizeof(buf));
545 _method->print_short_name(&namest);
963 set_generator(NULL);
964 }
965 } else {
966 assert(callee->has_member_arg(), "wrong type of call?");
967 if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) {
968 phase->C->prepend_late_inline(cg);
969 set_generator(NULL);
970 }
971 }
972 }
973 return SafePointNode::Ideal(phase, can_reshape);
974 }
975
976 bool CallNode::is_call_to_arraycopystub() const {
977 if (_name != NULL && strstr(_name, "arraycopy") != 0) {
978 return true;
979 }
980 return false;
981 }
982
983 bool CallNode::is_call_to_osr_migration_end() const {
984 if (_name != NULL && strstr(_name, "OSR_migration_end") != 0) {
985 return true;
986 }
987 return false;
988 }
989
990 //=============================================================================
991 uint CallJavaNode::size_of() const { return sizeof(*this); }
992 bool CallJavaNode::cmp( const Node &n ) const {
993 CallJavaNode &call = (CallJavaNode&)n;
994 return CallNode::cmp(call) && _method == call._method &&
995 _override_symbolic_info == call._override_symbolic_info;
996 }
997 #ifdef ASSERT
998 bool CallJavaNode::validate_symbolic_info() const {
999 if (method() == NULL) {
1000 return true; // call into runtime or uncommon trap
1001 }
1002 ciMethod* symbolic_info = jvms()->method()->get_method_at_bci(_bci);
1003 ciMethod* callee = method();
1004 if (symbolic_info->is_method_handle_intrinsic() && !callee->is_method_handle_intrinsic()) {
1005 assert(override_symbolic_info(), "should be set");
1006 }
1007 assert(ciMethod::is_consistent_info(symbolic_info, callee), "inconsistent info");
1008 return true;
1009 }
1311 }
1312
1313 void SafePointNode::disconnect_from_root(PhaseIterGVN *igvn) {
1314 assert(Opcode() == Op_SafePoint, "only value for safepoint in loops");
1315 int nb = igvn->C->root()->find_prec_edge(this);
1316 if (nb != -1) {
1317 igvn->C->root()->rm_prec(nb);
1318 }
1319 }
1320
1321 //============== SafePointScalarObjectNode ==============
1322
1323 SafePointScalarObjectNode::SafePointScalarObjectNode(const TypeOopPtr* tp,
1324 #ifdef ASSERT
1325 AllocateNode* alloc,
1326 #endif
1327 uint first_index,
1328 uint n_fields) :
1329 TypeNode(tp, 1), // 1 control input -- seems required. Get from root.
1330 _first_index(first_index),
1331 _n_fields(n_fields),
1332 _is_stack_allocated(false)
1333 #ifdef ASSERT
1334 , _alloc(alloc)
1335 #endif
1336 {
1337 init_class_id(Class_SafePointScalarObject);
1338 }
1339
1340 // Do not allow value-numbering for SafePointScalarObject node.
1341 uint SafePointScalarObjectNode::hash() const { return NO_HASH; }
1342 bool SafePointScalarObjectNode::cmp( const Node &n ) const {
1343 return (&n == this); // Always fail except on self
1344 }
1345
1346 uint SafePointScalarObjectNode::ideal_reg() const {
1347 return 0; // No matching to machine instruction
1348 }
1349
1350 const RegMask &SafePointScalarObjectNode::in_RegMask(uint idx) const {
1351 return *(Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]);
1352 }
1374 #ifndef PRODUCT
1375 void SafePointScalarObjectNode::dump_spec(outputStream *st) const {
1376 st->print(" # fields@[%d..%d]", first_index(),
1377 first_index() + n_fields() - 1);
1378 }
1379
1380 #endif
1381
1382 //=============================================================================
1383 uint AllocateNode::size_of() const { return sizeof(*this); }
1384
1385 AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype,
1386 Node *ctrl, Node *mem, Node *abio,
1387 Node *size, Node *klass_node, Node *initial_test)
1388 : CallNode(atype, NULL, TypeRawPtr::BOTTOM)
1389 {
1390 init_class_id(Class_Allocate);
1391 init_flags(Flag_is_macro);
1392 _is_scalar_replaceable = false;
1393 _is_non_escaping = false;
1394 _is_stack_allocateable = false;
1395 _is_referenced_stack_allocation = false;
1396 _is_allocation_MemBar_redundant = false;
1397 Node *topnode = C->top();
1398
1399 init_req( TypeFunc::Control , ctrl );
1400 init_req( TypeFunc::I_O , abio );
1401 init_req( TypeFunc::Memory , mem );
1402 init_req( TypeFunc::ReturnAdr, topnode );
1403 init_req( TypeFunc::FramePtr , topnode );
1404 init_req( AllocSize , size);
1405 init_req( KlassNode , klass_node);
1406 init_req( InitialTest , initial_test);
1407 init_req( ALength , topnode);
1408 C->add_macro_node(this);
1409 }
1410
1411 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1412 {
1413 assert(initializer != NULL &&
1414 initializer->is_initializer() &&
1415 !initializer->is_static(),
|