Repository navigation
mem: intern builds a node fact only for a new int-keyed node, and reads var names from a sorted build - #70
Merged
Merged
Conversation
…es from a sorted build
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.
Three costs in the intern step of
--mem, measured with callgrind on s2c compiling itself:Mem.idOfbuilt theenodefact of a node on every lookup, also when the node was already known (106,936 calls, 15,927 new var nodes).enodefact.Mem.ofKind(the only reader ofenode) reads site and call kinds only, andMem.nVaris the only node keyed by a name, so these 15,927 facts were dead input to the solve.Now the
enodefact is built only for a new int-keyed node, and the var map is a list consed in id order, built once into a BMap (Coll.bFromSorted, one run) before the sharing pass reads it.Measured on s2c compiling itself, both compilers on the same input (
perf stat -e instructions:u):--memChecks:
--memoutput on s2c is byte-identical between the two compilers, and everytests/s2/memtest matches its.out.Mutant (one line, builds): the var map keyed
next + 1instead ofnextchanges the reuse lines of s2c--mem(5 extra reuses), but notests/s2/memtest catches it: whether the off-by-one name hits a shared var depends on which node gets the next id. Three test shapes did not catch it. The class (a wrong shared set gives an unsound reuse) is caught at run time by the M7b differential and poison oracles, which come with the codegen.