-
Notifications
You must be signed in to change notification settings - Fork 199
Add initial Cranelift interpreter functionality #1351
Conversation
| #[derive(Clone, Debug, PartialEq)] | ||
| pub enum Value { | ||
| Bool(bool), | ||
| Int(i64), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be u64 instead. In any case it is important to not forget correct zero/sign extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're probably right; let me think some more about this.
45bc345 to
8196344
Compare
This is a WIP version of a Cranelift IR interpreter. Only a small subset of instructions are implemented and (known) missing parts are marked with TODO or FIXME.
With parsing of annotations, e.g. `; test: %add1(1) == 2`, we can now test the interpretation of Cranelift functions within `.clif` files.
8196344 to
70431e0
Compare
| #[derive(Debug)] | ||
| pub struct Frame<'a> { | ||
| /// The currently executing function. | ||
| pub function: &'a Function, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this better as a FuncRef? I used &'a Function here because it was convenient but it may be more consistent and (possibly?) efficient to use a 4-byte FuncRef here instead. (I probably need to look again at how efficient it is to use FuncRef to index into an Environment).
|
Close this? |
TODOorFIXME. This PR is a RFC on the interpreter design; any feedback is welcome.