1418 return node->in(LoadBarrierNode::Oop);
1419 }
1420
1421 // 3. This step checks for the phi corresponding to an optimized load barrier expansion
1422 if (node->is_Phi()) {
1423 PhiNode* phi = node->as_Phi();
1424 Node* n = phi->in(1);
1425 if (n != NULL && (n->is_LoadBarrierSlowReg() || n->is_LoadBarrierWeakSlowReg())) {
1426 assert(c == node, "projections from step 1 should only be seen before macro expansion");
1427 return phi->in(2);
1428 }
1429 }
1430
1431 return c;
1432 }
1433
1434 bool ZBarrierSetC2::array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const {
1435 return type == T_OBJECT || type == T_ARRAY;
1436 }
1437
1438 // == Verification ==
1439
1440 #ifdef ASSERT
1441
1442 static bool look_for_barrier(Node* n, bool post_parse, VectorSet& visited) {
1443 if (visited.test_set(n->_idx)) {
1444 return true;
1445 }
1446
1447 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1448 Node* u = n->fast_out(i);
1449 if (u->is_LoadBarrier()) {
1450 } else if ((u->is_Phi() || u->is_CMove()) && !post_parse) {
1451 if (!look_for_barrier(u, post_parse, visited)) {
1452 return false;
1453 }
1454 } else if (u->Opcode() == Op_EncodeP || u->Opcode() == Op_DecodeN) {
1455 if (!look_for_barrier(u, post_parse, visited)) {
1456 return false;
1457 }
|
1418 return node->in(LoadBarrierNode::Oop);
1419 }
1420
1421 // 3. This step checks for the phi corresponding to an optimized load barrier expansion
1422 if (node->is_Phi()) {
1423 PhiNode* phi = node->as_Phi();
1424 Node* n = phi->in(1);
1425 if (n != NULL && (n->is_LoadBarrierSlowReg() || n->is_LoadBarrierWeakSlowReg())) {
1426 assert(c == node, "projections from step 1 should only be seen before macro expansion");
1427 return phi->in(2);
1428 }
1429 }
1430
1431 return c;
1432 }
1433
1434 bool ZBarrierSetC2::array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const {
1435 return type == T_OBJECT || type == T_ARRAY;
1436 }
1437
1438 bool ZBarrierSetC2::final_graph_reshaping(Compile* compile, Node* n, uint opcode) const {
1439 bool handled;
1440 switch (opcode) {
1441 case Op_LoadBarrierSlowReg:
1442 case Op_LoadBarrierWeakSlowReg:
1443 #ifdef ASSERT
1444 if (VerifyOptoOopOffsets) {
1445 MemNode* mem = n->as_Mem();
1446 // Check to see if address types have grounded out somehow.
1447 const TypeInstPtr* tp = mem->in(MemNode::Address)->bottom_type()->isa_instptr();
1448 ciInstanceKlass* k = tp->klass()->as_instance_klass();
1449 bool oop_offset_is_sane = k->contains_field_offset(tp->offset());
1450 assert(!tp || oop_offset_is_sane, "");
1451 }
1452 #endif
1453 handled = true;
1454 break;
1455 default:
1456 handled = false;
1457 }
1458 return handled;
1459 }
1460
1461 // == Verification ==
1462
1463 #ifdef ASSERT
1464
1465 static bool look_for_barrier(Node* n, bool post_parse, VectorSet& visited) {
1466 if (visited.test_set(n->_idx)) {
1467 return true;
1468 }
1469
1470 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1471 Node* u = n->fast_out(i);
1472 if (u->is_LoadBarrier()) {
1473 } else if ((u->is_Phi() || u->is_CMove()) && !post_parse) {
1474 if (!look_for_barrier(u, post_parse, visited)) {
1475 return false;
1476 }
1477 } else if (u->Opcode() == Op_EncodeP || u->Opcode() == Op_DecodeN) {
1478 if (!look_for_barrier(u, post_parse, visited)) {
1479 return false;
1480 }
|