Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Conversation

@abrown
Copy link
Member

@abrown abrown commented Jan 15, 2020

  • This has been discussed in meetings and chat messages.
  • A short description of what this does, why it is needed: this implements a rudimentary interpreter for Cranelift IR; only a subset of instructions are currently implemented and implementation gaps are marked with TODO or FIXME. This PR is a RFC on the interpreter design; any feedback is welcome.
  • This PR contains test cases, if meaningful.
  • A reviewer from the core maintainer team has been assigned for this PR.

#[derive(Clone, Debug, PartialEq)]
pub enum Value {
Bool(bool),
Int(i64),
Copy link
Contributor

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.

Copy link
Member Author

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.

@abrown abrown force-pushed the upstream-interpreter branch from 45bc345 to 8196344 Compare January 15, 2020 18:10
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.
@abrown abrown force-pushed the upstream-interpreter branch from 8196344 to 70431e0 Compare January 22, 2020 04:16
#[derive(Debug)]
pub struct Frame<'a> {
/// The currently executing function.
pub function: &'a Function,
Copy link
Member Author

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).

@bjorn3
Copy link
Contributor

bjorn3 commented Mar 4, 2020

Close this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants