Update to new runtime

This commit is contained in:
Brandon Fish
2019-01-23 01:27:13 -06:00
parent 3e9ef57d9d
commit 157183d212
17 changed files with 397 additions and 414 deletions

View File

@ -1,5 +1,5 @@
use std::mem;
use wasmer_runtime_core::Instance;
use wasmer_runtime_core::vm::Ctx;
#[repr(transparent)]
pub struct VarArgs {
@ -7,8 +7,8 @@ pub struct VarArgs {
}
impl VarArgs {
pub fn get<T: Sized>(&mut self, instance: &mut Instance) -> T {
let ptr = instance.memory_offset_addr(0, self.pointer as usize);
pub fn get<T: Sized>(&mut self, vmctx: &mut Ctx) -> T {
let ptr = vmctx.memory(0)[self.pointer as usize];
self.pointer += mem::size_of::<T>() as u32;
unsafe { (ptr as *const T).read() }
}