1492 1493 //============================================================================= 1494 // 1495 // parser factory methods for MemNodes 1496 // 1497 // These are layered on top of the factory methods in LoadNode and StoreNode, 1498 // and integrate with the parser's memory state and _gvn engine. 1499 // 1500 1501 // factory methods in "int adr_idx" 1502 Node* GraphKit::make_load(Node* ctl, Node* adr, const Type* t, BasicType bt, 1503 int adr_idx, 1504 MemNode::MemOrd mo, bool require_atomic_access) { 1505 assert(adr_idx != Compile::AliasIdxTop, "use other make_load factory" ); 1506 const TypePtr* adr_type = NULL; // debug-mode-only argument 1507 debug_only(adr_type = C->get_adr_type(adr_idx)); 1508 Node* mem = memory(adr_idx); 1509 Node* ld; 1510 if (require_atomic_access && bt == T_LONG) { 1511 ld = LoadLNode::make_atomic(C, ctl, mem, adr, adr_type, t, mo); 1512 } else { 1513 ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt, mo); 1514 } 1515 ld = _gvn.transform(ld); 1516 if ((bt == T_OBJECT) && C->do_escape_analysis() || C->eliminate_boxing()) { 1517 // Improve graph before escape analysis and boxing elimination. 1518 record_for_igvn(ld); 1519 } 1520 return ld; 1521 } 1522 1523 Node* GraphKit::store_to_memory(Node* ctl, Node* adr, Node *val, BasicType bt, 1524 int adr_idx, 1525 MemNode::MemOrd mo, 1526 bool require_atomic_access) { 1527 assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" ); 1528 const TypePtr* adr_type = NULL; 1529 debug_only(adr_type = C->get_adr_type(adr_idx)); 1530 Node *mem = memory(adr_idx); 1531 Node* st; 1532 if (require_atomic_access && bt == T_LONG) { 1533 st = StoreLNode::make_atomic(C, ctl, mem, adr, adr_type, val, mo); 1534 } else { 1535 st = StoreNode::make(_gvn, ctl, mem, adr, adr_type, val, bt, mo); 1536 } 1537 st = _gvn.transform(st); 1538 set_memory(st, adr_idx); 1539 // Back-to-back stores can only remove intermediate store with DU info 1540 // so push on worklist for optimizer. 1541 if (mem->req() > MemNode::Address && adr == mem->in(MemNode::Address)) 1542 record_for_igvn(st); 1543 1544 return st; 1545 } 1546 1547 1548 void GraphKit::pre_barrier(bool do_load, 1549 Node* ctl, 1550 Node* obj, 1551 Node* adr, 1552 uint adr_idx, 1553 Node* val, | 1492 1493 //============================================================================= 1494 // 1495 // parser factory methods for MemNodes 1496 // 1497 // These are layered on top of the factory methods in LoadNode and StoreNode, 1498 // and integrate with the parser's memory state and _gvn engine. 1499 // 1500 1501 // factory methods in "int adr_idx" 1502 Node* GraphKit::make_load(Node* ctl, Node* adr, const Type* t, BasicType bt, 1503 int adr_idx, 1504 MemNode::MemOrd mo, bool require_atomic_access) { 1505 assert(adr_idx != Compile::AliasIdxTop, "use other make_load factory" ); 1506 const TypePtr* adr_type = NULL; // debug-mode-only argument 1507 debug_only(adr_type = C->get_adr_type(adr_idx)); 1508 Node* mem = memory(adr_idx); 1509 Node* ld; 1510 if (require_atomic_access && bt == T_LONG) { 1511 ld = LoadLNode::make_atomic(C, ctl, mem, adr, adr_type, t, mo); 1512 } else if (require_atomic_access && bt == T_DOUBLE) { 1513 ld = LoadDNode::make_atomic(C, ctl, mem, adr, adr_type, t, mo); 1514 } else { 1515 ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt, mo); 1516 } 1517 ld = _gvn.transform(ld); 1518 if ((bt == T_OBJECT) && C->do_escape_analysis() || C->eliminate_boxing()) { 1519 // Improve graph before escape analysis and boxing elimination. 1520 record_for_igvn(ld); 1521 } 1522 return ld; 1523 } 1524 1525 Node* GraphKit::store_to_memory(Node* ctl, Node* adr, Node *val, BasicType bt, 1526 int adr_idx, 1527 MemNode::MemOrd mo, 1528 bool require_atomic_access) { 1529 assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" ); 1530 const TypePtr* adr_type = NULL; 1531 debug_only(adr_type = C->get_adr_type(adr_idx)); 1532 Node *mem = memory(adr_idx); 1533 Node* st; 1534 if (require_atomic_access && bt == T_LONG) { 1535 st = StoreLNode::make_atomic(C, ctl, mem, adr, adr_type, val, mo); 1536 } else if (require_atomic_access && bt == T_DOUBLE) { 1537 st = StoreDNode::make_atomic(C, ctl, mem, adr, adr_type, val, mo); 1538 } else { 1539 st = StoreNode::make(_gvn, ctl, mem, adr, adr_type, val, bt, mo); 1540 } 1541 st = _gvn.transform(st); 1542 set_memory(st, adr_idx); 1543 // Back-to-back stores can only remove intermediate store with DU info 1544 // so push on worklist for optimizer. 1545 if (mem->req() > MemNode::Address && adr == mem->in(MemNode::Address)) 1546 record_for_igvn(st); 1547 1548 return st; 1549 } 1550 1551 1552 void GraphKit::pre_barrier(bool do_load, 1553 Node* ctl, 1554 Node* obj, 1555 Node* adr, 1556 uint adr_idx, 1557 Node* val, |