Comments (1)
An analysis of goals:
- We want the
Slot
s (unbounded in number) to be on the stack. - We want the
Register
s andSlot
s to be dead when Mijit is not running. - We want some
Register
s andSlot
s to be live in the rootMachine::State
s, and we want to specify the live set in an ergonomic way. - We want to allow the
Machine
to choose theSave
data structure used to persist the state of the VM when Mijit is not running. - We want to minimise the marshalling code that gets run on entry to and exit from Mijit.
Goal 1 deserves an issue of its own (#26) which also covers goal 2.
The combination of goals 2 and 3 motivates the prologue and epilogue code, whose purpose it to marshal data between the persistent state and the live set.
Goal 4 does not require any support from Mijit beyond providing a single persistent pointer to the prologue and epilogue code. The Machine
can use it as a pointer to a Save
if it wants; Mijit does not need to understand. So Machine::Save
is an unnecessary concept.
Goal 5 essentially boils down to sharing between the persistent state and the live set. This can be done by reference, e.g. via the pointer to the Save
. However, it is cheap and probably useful to provide some state that is shared "by value" too. I propose a constant-sized array of words (Global
s?) that can be accessed as Value
s (alongside Register
s and Slot
s) but which are always live and which persist when Mijit is not running. This is a mild generalisation of the single persistent pointer required by goal 4.
In summary, I propose the following design:
- Add a case
Global
tocode::Value
, alongsideRegister
andSlot
, to represent a 64-bit word that persists when Mijit is not running. This deserves its own issue (#27). Machine::Save
does not exist.Machine::values()
does not exist. Instead Mijit defines a set of 64Value
s: the first 12Register
s and the first 52Slot
s. It is not necessary to includeGlobal
s, which are always live.Machine::num_globals()
returns the number ofGlobal
s that theMachine
would like to use. This resurrects an earlier Mijit feature, with the difference that theGlobal
s are not considered to be a subset of theSlot
s.Machine::get_code(state)
returns (among other things) a 64-bit mask indicating theValue
s that are live instate
. The bitmask selects from the Mijit-defined set.Machine::prologue()
returns a list of MijitAction
s to marshal data from theGlobal
s to the live values. It is not passed anything on entry. On exit it must have initialised allValue
s that are live in anyState
.Machine::epilogue()
returns a list of MijitAction
s to marshal data from the live values back to theGlobal
s. On entry, it gets allValue
s that are live in anyState
; those that are dead are set to a dummy value (0xdeaddeaddeaddead
). On exit nothing is live.
from mijit.
Related Issues (20)
- Spin off Beetle as a separate project that depends on Mijit HOT 1
- ARM backend HOT 1
- Extend the target abstraction layer to cover optimization
- Add profiling counters HOT 3
- Write tests for high register pressure
- `optimizer::Simulation` should understand `Push` and `Pop` instructions
- Exceptions
- Rename `is_true` to `invert` in conditionals HOT 1
- Changes to trait Lower HOT 1
- Test Lower HOT 1
- Make `Action::Push` and `Action::Pop` operate on pairs of words.
- `aarch64::Assembler::mem()` should take an `enum Address` HOT 1
- Rename `code::Value` to `code::Variable`.
- Examples of bad code
- Cannot build mijit 0.1.1 with rustc 1.51 HOT 3
- Store code in a more abstract form
- Redesign JIT API: Expose EBB HOT 1
- Do not call mprotect unnecessarily
- Peephole optimize code as it is added to `Dataflow`
- Separate `new_exit()`, `new_label()` and `new_entry()`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mijit.