Do not count injector references in removeUnreachableGenesFromRoot#788
Merged
Conversation
An injector's gene reference is a payload for a foreign creature, not part of this creature's own construction graph, so it must not keep the referenced gene alive during root-reachability pruning. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
removeUnreachableGenesFromRootused to treat an Injector node'sgeneIndexas a reachability edge, so any gene it targeted (and everything reachable from that gene via constructor chains) was kept alive even if unrelated to the creature's own body.D:/dev/claude/examples/UnusedGenes.genomehas 5 genes only bridged in via an injector reference; before this change,removeUnreachableGenesFromRootkept all 13 genes instead of pruning the 5 unreachable ones.Changes
MutationProcessor.cuh: reachability marking (removeUnreachableGenesFromRoot) now only follows constructor references, not injector references. The remap step now falls back to gene 0 if an injector ends up pointing at a removed gene.UnusedGeneRemovalTests.cpp: invertedkeepsGeneReferencedByInjectorintoremovesGeneOnlyReferencedByInjector, and addedkeepsGeneReferencedByInjectorAndConstructorto confirm a constructor reference still keeps a gene alive independent of any injector reference to it.Test plan
EngineTests.exe --gtest_filter=UnusedGeneRemovalTests.*(7/7 pass)EngineTests.exesuite (3074 passed, 3 pre-existing unrelated skips)clang-format --dry-run --Werrorclean on both touched files🤖 Generated with Claude Code