Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the region/storage-mode analysis to better support modular compilation (allowing some region arguments to remain atbot across compilation-unit boundaries for “simple” functions) and addresses the storage-mode analysis miscompilation described in issue #208.
Changes:
- Refactors effect “representation” queries by splitting
representsintorepresents_no_getsvsrepresents_with_gets, and adjusts flow/analysis consumers accordingly. - Updates region-flow graph construction to incorporate GET effects (key to fixing the #208 scenario) and adjusts storage-mode inference for non-local function calls.
- Replaces the removed
EffVarEnvmodule usage withEffect.Mapacross several compiler components and updates theEFFECTAPI.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/Compiler/regions.mlb |
Removes Regions/EffVarEnv.sml from the regions MLB build. |
src/Compiler/Regions/RegionStatEnv.sml |
Switches cone-closure traversal to represents_no_gets. |
src/Compiler/Regions/RegFlow.sml |
Changes region-flow graph construction to use represents_with_gets and normalizes GET/PUT/MUT to regions. |
src/Compiler/Regions/PhysSizeInf.sml |
Replaces EffVarEnv with Effect.Map. |
src/Compiler/Regions/MulInf.sml |
Uses represents_no_gets when building multiplicity Phi. |
src/Compiler/Regions/Mul.sml |
Uses Eff.Map and represents_no_gets for initial multiplicity data. |
src/Compiler/Regions/LocallyLiveVariables.sml |
Removes no-op normalization plumbing; propagates livesets directly. |
src/Compiler/Regions/Effect.sml |
Renames map type to Map; implements represents_no_gets / represents_with_gets; includes GET nodes in relevant traversals. |
src/Compiler/Regions/EffVarEnv.sml |
Deletes the standalone EffVarEnv map module. |
src/Compiler/Regions/EFFECT.sig |
Updates API: adds represents_no_gets/represents_with_gets, renames PlaceOrEffectMap to Map. |
src/Compiler/Regions/DropRegions.sml |
Updates map usage to Eff.Map and uses represents_no_gets. |
src/Compiler/Regions/AtInf.sml |
Adjusts non-local call handling to allow selective atbot across units; switches internal env maps to Eff.Map/Lvars.Map. |
src/Compiler/Backend/SubstAndSimplify.sml |
Replaces EffVarEnv with Effect.Map. |
src/Compiler/Backend/ClosConvEnv.sml |
Replaces EffVarEnv with Effect.Map. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
This PR provides a modular version of the storage mode analysis where simple functions may be passed regions with storage mode
atbotacross compilation unit boundaries.Instead of penalising all functions that are exported (by linking their region parameters to global regions in the region flow graph), we make it up to the caller to pass the appropriate storage mode ($\rho$ if $\rho$ is not locally live and if $\rho$ is not aliased with another parameter. Notice that the "not-aliased" property can be assured across multiple compilation units because top-level region type schemes (those for possibly exported functions) are closed wrt region and effect variables.
attop,atbot, orsat). When a call is made to a function in another program unit, we do not have detailed knowledge about the region flow graph related to the body of the function being called. Instead of querying the region flow graph, we shall be less precise in the determination and make use of the instantiation data available at the call site along with a few simple observations. Whereas it is always safe to passattopfor all region parameters, for simple functions that are not higher-order, we can passatbotfor a region parameterThe PR also fixes issue #208 .