Skip to content

Commit

Permalink
Fixed simple spectests example compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Feb 10, 2019
1 parent 227d5e2 commit 9fe3e94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions lib/clif-backend/src/func_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<'env, 'module, 'isa> FuncEnv<'env, 'module, 'isa> {
let mut signature = self.env.signatures[Converter(clif_sig_index).into()].clone();

// Add the vmctx parameter type to it
signature.params.push(ir::AbiParam::special(
signature.params.insert(0, ir::AbiParam::special(
self.pointer_type(),
ir::ArgumentPurpose::VMContext,
));
Expand Down Expand Up @@ -559,9 +559,9 @@ impl<'env, 'module, 'isa> FuncEnvironment for FuncEnv<'env, 'module, 'isa> {
let signature = pos.func.import_signature(ir::Signature {
call_conv: self.target_config().default_call_conv,
params: vec![
ir::AbiParam::special(self.pointer_type(), ir::ArgumentPurpose::VMContext),
ir::AbiParam::new(ir::types::I32),
ir::AbiParam::new(ir::types::I32),
ir::AbiParam::special(self.pointer_type(), ir::ArgumentPurpose::VMContext),
],
returns: vec![ir::AbiParam::new(ir::types::I32)],
});
Expand Down Expand Up @@ -623,8 +623,8 @@ impl<'env, 'module, 'isa> FuncEnvironment for FuncEnv<'env, 'module, 'isa> {
let signature = pos.func.import_signature(ir::Signature {
call_conv: self.target_config().default_call_conv,
params: vec![
ir::AbiParam::new(ir::types::I32),
ir::AbiParam::special(self.pointer_type(), ir::ArgumentPurpose::VMContext),
ir::AbiParam::new(ir::types::I32),
],
returns: vec![ir::AbiParam::new(ir::types::I32)],
});
Expand Down
20 changes: 10 additions & 10 deletions lib/runtime-core/src/vmcalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use crate::{
// +****************************+

pub unsafe extern "C" fn local_static_memory_grow(
ctx: &mut vm::Ctx,
memory_index: LocalMemoryIndex,
delta: Pages,
ctx: &mut vm::Ctx,
) -> i32 {
let local_memory = *ctx.memories.add(memory_index.index());
let memory = (*local_memory).memory as *mut StaticMemory;
Expand All @@ -28,8 +28,8 @@ pub unsafe extern "C" fn local_static_memory_grow(
}

pub unsafe extern "C" fn local_static_memory_size(
memory_index: LocalMemoryIndex,
ctx: &vm::Ctx,
memory_index: LocalMemoryIndex,
) -> Pages {
let local_memory = *ctx.memories.add(memory_index.index());
let memory = (*local_memory).memory as *mut StaticMemory;
Expand All @@ -38,9 +38,9 @@ pub unsafe extern "C" fn local_static_memory_size(
}

pub unsafe extern "C" fn local_dynamic_memory_grow(
ctx: &mut vm::Ctx,
memory_index: LocalMemoryIndex,
delta: Pages,
ctx: &mut vm::Ctx,
) -> i32 {
let local_memory = *ctx.memories.add(memory_index.index());
let memory = (*local_memory).memory as *mut DynamicMemory;
Expand All @@ -53,8 +53,8 @@ pub unsafe extern "C" fn local_dynamic_memory_grow(
}

pub unsafe extern "C" fn local_dynamic_memory_size(
memory_index: LocalMemoryIndex,
ctx: &vm::Ctx,
memory_index: LocalMemoryIndex,
) -> Pages {
let local_memory = *ctx.memories.add(memory_index.index());
let memory = (*local_memory).memory as *mut DynamicMemory;
Expand All @@ -67,9 +67,9 @@ pub unsafe extern "C" fn local_dynamic_memory_size(
// +****************************+

pub unsafe extern "C" fn imported_static_memory_grow(
ctx: &mut vm::Ctx,
import_memory_index: ImportedMemoryIndex,
delta: Pages,
ctx: &mut vm::Ctx,
) -> i32 {
let local_memory = *ctx.imported_memories.add(import_memory_index.index());
let memory = (*local_memory).memory as *mut StaticMemory;
Expand All @@ -82,8 +82,8 @@ pub unsafe extern "C" fn imported_static_memory_grow(
}

pub unsafe extern "C" fn imported_static_memory_size(
import_memory_index: ImportedMemoryIndex,
ctx: &vm::Ctx,
import_memory_index: ImportedMemoryIndex,
) -> Pages {
let local_memory = *ctx.imported_memories.add(import_memory_index.index());
let memory = (*local_memory).memory as *mut StaticMemory;
Expand All @@ -92,9 +92,9 @@ pub unsafe extern "C" fn imported_static_memory_size(
}

pub unsafe extern "C" fn imported_dynamic_memory_grow(
ctx: &mut vm::Ctx,
memory_index: ImportedMemoryIndex,
delta: Pages,
ctx: &mut vm::Ctx,
) -> i32 {
let local_memory = *ctx.imported_memories.add(memory_index.index());
let memory = (*local_memory).memory as *mut DynamicMemory;
Expand All @@ -107,8 +107,8 @@ pub unsafe extern "C" fn imported_dynamic_memory_grow(
}

pub unsafe extern "C" fn imported_dynamic_memory_size(
memory_index: ImportedMemoryIndex,
ctx: &vm::Ctx,
memory_index: ImportedMemoryIndex,
) -> Pages {
let local_memory = *ctx.imported_memories.add(memory_index.index());
let memory = (*local_memory).memory as *mut DynamicMemory;
Expand All @@ -121,17 +121,17 @@ pub unsafe extern "C" fn imported_dynamic_memory_size(
// +****************************+

pub unsafe extern "C" fn local_table_grow(
ctx: &mut vm::Ctx,
table_index: LocalTableIndex,
delta: u32,
ctx: &mut vm::Ctx,
) -> i32 {
let _ = table_index;
let _ = delta;
let _ = ctx;
unimplemented!()
}

pub unsafe extern "C" fn local_table_size(table_index: LocalTableIndex, ctx: &vm::Ctx) -> u32 {
pub unsafe extern "C" fn local_table_size(ctx: &vm::Ctx, table_index: LocalTableIndex) -> u32 {
let _ = table_index;
let _ = ctx;
unimplemented!()
Expand Down
2 changes: 1 addition & 1 deletion lib/spectests/examples/simple/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn main() -> error::Result<()> {
Ok(())
}

fn print_num(n: i32, ctx: &mut vm::Ctx) -> Result<i32, ()> {
fn print_num(ctx: &mut vm::Ctx, n: i32) -> Result<i32, ()> {
println!("print_num({})", n);

let memory: &Memory = ctx.memory(0);
Expand Down

0 comments on commit 9fe3e94

Please sign in to comment.