Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Typos and cosmetic changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimpo committed Oct 25, 2019
1 parent 3699453 commit 381a5b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 7 additions & 5 deletions core/executor/src/wasmtime/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ fn call_method(
.map_err(Error::Wasmtime)?;

// Ideally there would be a way to set the heap pages during instantiation rather than
// growing the memory after the fact. Current this may require an additional mmap and copy.
// growing the memory after the fact. Currently this may require an additional mmap and copy.
// However, the wasmtime API doesn't support modifying the size of memory on instantiation
// at this time.
grow_memory(&mut instance, heap_pages)?;

// Initialize the function executor state.
let heap_base = get_heap_base(&instance)?;
let executor_state = FunctionExecutorState::new(heap_base);
reset_env_state(context, Some(executor_state))?;
reset_env_state_and_take_trap(context, Some(executor_state))?;

// Write the input data into guest memory.
let (data_ptr, data_len) = inject_input_data(context, &mut instance, data)?;
Expand All @@ -190,7 +190,7 @@ fn call_method(
.invoke(&mut instance, method, &args[..])
.map_err(Error::Wasmtime)
})?;
let trap_error = reset_env_state(context, None)?;
let trap_error = reset_env_state_and_take_trap(context, None)?;
let (output_ptr, output_len) = match outcome {
ActionOutcome::Returned { values } => match values.as_slice() {
[RuntimeValue::I64(retval)] =>
Expand Down Expand Up @@ -310,8 +310,10 @@ fn get_env_state(context: &mut Context) -> Result<&mut EnvState> {
.ok_or_else(|| "cannot get \"env\" module host state".into())
}

fn reset_env_state(context: &mut Context, executor_state: Option<FunctionExecutorState>)
-> Result<Option<Error>>
fn reset_env_state_and_take_trap(
context: &mut Context,
executor_state: Option<FunctionExecutorState>,
) -> Result<Option<Error>>
{
let env_state = get_env_state(context)?;
env_state.executor_state = executor_state;
Expand Down
1 change: 0 additions & 1 deletion core/executor/src/wasmtime/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use cranelift_codegen::{ir, isa};
use std::ops::Range;
use wasm_interface::{Pointer, Signature, ValueType};


/// Read data from a slice of memory into a destination buffer.
///
/// Returns an error if the read would go out of the memory bounds.
Expand Down

0 comments on commit 381a5b2

Please sign in to comment.