Repository navigation
mem: --mem gives each var node the regions whose boxes it can hold, and whether and why it is shared - #75
Merged
Conversation
…nd whether and why it is shared
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.
--memnow says, for every var node, which regions its boxes can come from, and whether and why it is shared.rin(N, R): node N can hold a box of handled region R. A site node gets the regions of its site (esmjoins the escape walk's site to the M1 walk's site by def, line and ctor;fillsgives the regions). Then it spreads over the same edges asshared: flow, arg into param, a callee's result into its call.callOf(C, G)for every call to a def whose result can hold a box. The result rules (sharedr5 andrin) read it. Before, they found the call only throughargOf, so a call whose args are all scalars (RG.make(2)) never got its callee's result: its regions were lost, and its sharing too. That was a soundness gap in the M7a sharing pass: on s2c it removes 2 reuse candidates that were wrong to report (s2/flow.srs:1815,s2/names.srs:417).vars[]={id, def, name, regions, shared: false | "multi" | "unknown" | "flow"}. Region ids are now Mem's own region ids, sovars[].regions,sites[].regionandfrees[].regionagree (a region that is not live is skipped, so ids can have gaps:mem/inner).New test
tests/s2/mem/regions.srs: a box (seed), a val of it (flow), the result of a scalar-arg call (ret, throughcallOf), a param (arg), arg then ret; a param given boxes of two regions. Checked by hand.Checks:
--mem1.42 G -> 1.70 G (+19.5%): therinrules cost 193 M (ablation without them: 1.506 G), andcallOf,varsand the wider r5 cost 84 M. A first version cost 7.8 G: in the seed rule, D probes in written order andesiteNodecame first, so each newfillsrow scanned every site node. Orderesm, fills, esiteNodegives every delta a bound column.Mutants (each builds):
argOf--memoutput (2 reuses): survives the mem testsOpen: the last mutant survives the tests. Three small programs with that shape did not catch it (another edge already makes the var shared in each). Like the var-map mutant of #70, the M7b run-time oracle has to cover it. Scalar pattern vars (an I64 field) list regions too, because flow is untyped.