State representation.

This commit is contained in:
losfair
2019-06-09 21:21:18 +08:00
parent bea3ebd2f3
commit 082b8376ae
5 changed files with 87 additions and 34 deletions

View File

@ -1,4 +1,5 @@
#![allow(clippy::forget_copy)] // Used by dynasm.
#![warn(unused_imports)]
use crate::emitter_x64::*;
use crate::machine::*;
@ -28,6 +29,7 @@ use wasmer_runtime_core::{
TableIndex, Type,
},
vm::{self, LocalGlobal, LocalTable, INTERNALS_SIZE},
state::{FunctionStateMap, StateDiff, x64::X64Register, Location as StateLocation},
};
use wasmparser::{Operator, Type as WpType};
@ -139,6 +141,7 @@ enum LocalOrTemp {
pub struct X64FunctionCode {
signatures: Arc<Map<SigIndex, FuncSig>>,
function_signatures: Arc<Map<FuncIndex, SigIndex>>,
state_map: FunctionStateMap,
assembler: Option<Assembler>,
function_labels: Option<HashMap<usize, (DynamicLabel, Option<AssemblyOffset>)>>,
@ -356,6 +359,7 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
let code = X64FunctionCode {
signatures: self.signatures.as_ref().unwrap().clone(),
function_signatures: self.function_signatures.as_ref().unwrap().clone(),
state_map: FunctionStateMap::default(),
assembler: Some(assembler),
function_labels: Some(function_labels),

View File

@ -1,38 +1,5 @@
use dynasmrt::{x64::Assembler, AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi};
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum GPR {
RAX,
RCX,
RDX,
RBX,
RSP,
RBP,
RSI,
RDI,
R8,
R9,
R10,
R11,
R12,
R13,
R14,
R15,
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum XMM {
XMM0,
XMM1,
XMM2,
XMM3,
XMM4,
XMM5,
XMM6,
XMM7,
}
pub use wasmer_runtime_core::state::x64::{GPR, XMM};
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum Location {