void TR::ILValidator::validateEndOfExtendedBlock(Location &location) { // Ensure there are no nodes live across the end of a block // for (LiveNodeWindow::Iterator lnwi(_liveNodes); lnwi.currentNode(); ++lnwi) validityRule(location, false, "Node cannot live across block boundary at n%dn", lnwi.currentNode()->getGlobalIndex()); // At the end of an extended block, no node we've already seen could ever be seen again. // Slide the live node window to keep its bitvector compact. // if (_liveNodes.isEmpty()) _liveNodes.startNewWindow(); }
void TR::ValidateLivenessBoundaries::updateNodeState(TR::Node *node, TR::NodeSideTable<TR::NodeState> &nodeStates, TR::LiveNodeWindow &liveNodes) { TR::NodeState &state = nodeStates[node]; if (node->getReferenceCount() == state._futureReferenceCount) { /* First occurrence -- do some bookkeeping */ if (node->getReferenceCount() == 0) { TR::checkILCondition(node, node->getOpCode().isTreeTop(), comp(), "Only nodes with isTreeTop opcodes can have refcount == 0"); } else { liveNodes.add(node); } } if (liveNodes.contains(node)) { TR::checkILCondition(node, state._futureReferenceCount >= 1, comp(), "Node already has reference count 0"); if (--state._futureReferenceCount == 0) { liveNodes.remove(node); } } else { TR::checkILCondition(node, node->getOpCode().isTreeTop(), comp(), "Node has already gone dead"); } if (TR::isILValidationLoggingEnabled(comp())) { if (!liveNodes.isEmpty()) { traceMsg(comp(), " -- Live nodes: {"); char *separator = ""; for (TR::LiveNodeWindow::Iterator lnwi(liveNodes); lnwi.currentNode(); ++lnwi) { traceMsg(comp(), "%sn%dn", separator, lnwi.currentNode()->getGlobalIndex()); separator = ", "; } traceMsg(comp(), "}\n"); } } }
void TR::ILValidator::updateNodeState(Location &newLocation) { TR::Node *node = newLocation.currentNode(); NodeState &state = _nodeStates[node]; if (node->getReferenceCount() == state._futureReferenceCount) { // First occurrence -- do some bookkeeping // if (node->getReferenceCount() == 0) { validityRule(newLocation, node->getOpCode().isTreeTop(), "Only nodes with isTreeTop opcodes can have refcount == 0"); } else { _liveNodes.add(node); } } if (_liveNodes.contains(node)) { validityRule(newLocation, state._futureReferenceCount >= 1, "Node already has reference count 0"); if (--state._futureReferenceCount == 0) { _liveNodes.remove(node); } } else { validityRule(newLocation, node->getOpCode().isTreeTop(), "Node has already gone dead"); } if (isLoggingEnabled()) { static const char *traceLiveNodesDuringValidation = feGetEnv("TR_traceLiveNodesDuringValidation"); if (traceLiveNodesDuringValidation && !_liveNodes.isEmpty()) { traceMsg(comp(), " -- Live nodes: {"); char *separator = ""; for (LiveNodeWindow::Iterator lnwi(_liveNodes); lnwi.currentNode(); ++lnwi) { traceMsg(comp(), "%sn%dn", separator, lnwi.currentNode()->getGlobalIndex()); separator = ", "; } traceMsg(comp(), "}\n"); } } }
void TR::ValidateLivenessBoundaries::validateEndOfExtendedBlockBoundary(TR::Node *node, TR::LiveNodeWindow &liveNodes) { for (LiveNodeWindow::Iterator lnwi(liveNodes); lnwi.currentNode(); ++lnwi) { TR::checkILCondition(node, false, comp(), "Node cannot live across block boundary at n%dn", lnwi.currentNode()->getGlobalIndex()); } /** * At the end of an extended block, no node we've already seen could ever be seen again. * Slide the live node window to keep its bitvector compact. */ if (liveNodes.isEmpty()) { liveNodes.startNewWindow(); } }