-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jit #134
Draft
b-studios
wants to merge
157
commits into
master
Choose a base branch
from
jit
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
Copied from implementation based on old machine, with new Transformer and minor changes.
Also, collect all used datatypes over program
since all locals are positional in machine, we can just use those positions as register numbers. Removes the now unnecessary `RegisterAllocation` analysis on JIT code
Generate information on the used datatypes (which alternatives there are, with how many fields of what types) into the output for the JIT.
* the main statement is run in an empty environment * `BlockLabel` does not need to be a `Tree`
Allows easier extension with more register types and handling of registers
Clauses describe the values closed over explicitly, passed parameters are implicit. This is now reflected in the name.
The Environment describes the variables currently in scope. The FrameDescriptor describes merely their numbers (i.e. how many registers are needed).
There are two ways a clause may be compiled: As a "closure": only free variables of the clause are copied over, a new frame is generated. "inlined": All variables in the current environment survive, the enclosing frame is extended to leave enough space for the new locals.
For now. Later, maybe add additional Bool registers.
The substitutions generated in machine do not necessarily list all live variables
Make the frame big enough to fit locals of inline clause
Now also using `transformInline` for consistency
Leave this to the jit executable, which has the frame sizes
we can now run programs using the JIT backend with `--backend jit --lib libraries/jit <source file>`. This adds the 5.7M executable to the repository for now. In the future, we should find a different solution to this.
* Use numbered register for output of Let * Use `ListMap`s in `PrettyPrinter` (preserve order)
Implement SWITCH for Unit
This is a first step, reusing registers when choosing the names of the parameters of clauses transformed inline. Registers are reused if they are not free in the clause.
Currently just throwing an error
* `Let` would not get a new register for the result * `Switch` would reuse registers, which is not possible with the current semantics of the `Match` instruction
i.e. Return *pre*pends the value to the environment, as does Invoke.
…vention JIT: New calling convention
Also changes findJITBinary to make this easier
This requires a version of the jit binary after 46005416a819a850cd342a7447a7f05e21163e87.
So it can find the data type declarations. We need a better solution for this.
Breaking change in the output format! Corresponds to ca28a1f4d030b2bf26700912510666468396699b in jitting-effects.
Namely: MUL, PRINT, ISZERO, RESUME, RESET
Codata (including closures) will now only capture what's free in at least one of the clauses.
This drops the spurious 'ev_zero = 0; ev_acc = ev0 + ev_zero; ...' in evidence composition, simplifying generated code.
block labels for generated blocks are now based on where they are generated from: - match: m0,m1,...,m* - push: p - if: ?t,?f - new stack (in reset): r - codata/effects: c0,c1,...
For now, just use the evidence in Allocate. This requires the smallest change in the actual jit implementation. TODO We should evaluate what's the best implementation strategy here.
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 is only for discussion and keeping track of the changes in JIT.