Various cranelift interpreter improvements (#6176)

* Remove the validate_address State trait method

It isn't used anywhere

* Expose the inner Function of a Frame

This is necessary to create your own interpreter that reuses most of
cranelift-interpreter. For example to use a different State
implementation.

* Support the symbol_value and tls_value instructions in the interpreter
This commit is contained in:
bjorn3
2023-04-07 17:22:13 +02:00
committed by GitHub
parent e1777710b1
commit bada17beab
4 changed files with 16 additions and 38 deletions

View File

@@ -12,7 +12,7 @@ pub(crate) type Entries = Vec<Option<DataValue>>;
#[derive(Debug)]
pub struct Frame<'a> {
/// The currently executing function.
pub(crate) function: &'a Function,
function: &'a Function,
/// The current mapping of SSA value-references to their actual values. For efficiency, each SSA value is used as an
/// index into the Vec, meaning some slots may be unused.
registers: Entries,
@@ -100,6 +100,11 @@ impl<'a> Frame<'a> {
pub fn entries_mut(&mut self) -> &mut [Option<DataValue>] {
&mut self.registers
}
/// Accessor for the [`Function`] of this frame.
pub fn function(&self) -> &'a Function {
self.function
}
}
#[cfg(test)]