Repository navigation
s2c: effect rows (E1) - #33
Merged
Merged
Conversation
…'s row is inferred by Datalog (s2/eff.srs: requests, constructors as Region requests, explicit protocol binders, and callee rows minus handled scopes) and becomes implicit {eff.P} capabilities; requests, constructors and inferred caps take the innermost handler; a def named main gets no row, so an escaping effect is error[unhandled-effect]; Flow steps requests, Pure counts rows as effects; types test checks the self lib once
…m: +1.0% instr on the frozen corpus)
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.
E1 of the effects epic. A request names its protocol (
Log.say(n)). No fn writes its effect row: the compiler infers it.What changes
s2/eff.srs(new) computes each def's row with Datalog, in the same shape ass2/pure.srs. A request, a constructor (a request onRegion), a written{}binder of a protocol, and the row of each callee add to the row. Ahandleremoves its protocol from the row of the rest of its block.Pan implicit capabilityeff.P. In C this is a param after the written capabilities (p_eff__P).{}binders keep the old rule: exactly one in scope.maingets no row. So an effect that would escapemainiserror[unhandled-effect]at the line that needs it.P.opas a call name. Flow tracks a request as an op step on the innermost capability. Pure counts a row as an effect, so aspec defcannot call such a def.Tests
tests/s2/prog/eff_row.srsandtests/s2/prog/eff_inner.srscheck inferred rows and the innermost handler.tests/s2/neg/eff_unhandled.srschecks the escape errors inmainat lines 19, 20 and 22.tests/s2/neg/eff_pure.srsandtests/s2/neg/eff_flow.srscheck purity and the protocol state of requests.Speed
tests/bench.shon the frozen corpus: wall time ok. Instructions +1.0% (corpus-self) and +1.1% (corpus-tests), peak memory +1.1%. The script flags these as SLOWER. The cost is one Datalog solve over the whole program, about 38M instructions per run for the s2 sources. The baseline is not updated in this PR.