/** * In pass_1(validateRefCountPass1), the Local Index (which is set to the Ref * Count) for each child is decremented for each visit. The second pass is to * make sure that the Local Index is zero by the end of the block. A non-zero * Local Index would indicate that the Ref count was wrong at the start * of the Validation Process. */ void TR::ValidateNodeRefCountWithinBlock::validateRefCountPass1(TR::Node *node) { /* If this is the first time through this node, verify the children. */ if (!_nodeChecklist.isSet(node->getGlobalIndex())) { _nodeChecklist.set(node->getGlobalIndex()); for (int32_t i = node->getNumChildren() - 1; i >= 0; --i) { TR::Node *child = node->getChild(i); if (_nodeChecklist.isSet(child->getGlobalIndex())) { /* If the child has already been visited, decrement its verifyRefCount. */ child->decLocalIndex(); } else { /* If the child has not yet been visited, set its localIndex and visit it. */ child->setLocalIndex(child->getReferenceCount() - 1); validateRefCountPass1(child); } } } }