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

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr committed Sep 29, 2021
1 parent 0531852 commit 89b30f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions client/executor/wasmtime/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ fn call_static<'a>(
.host_state()
.expect(
"host functions can be called only from wasm instance;
wasm instance is always called initializing context;
therefore host_ctx cannot be None;
qed
",
wasm instance is always called initializing context;
therefore host_ctx cannot be None;
qed
",
)
.clone();

Expand Down
9 changes: 6 additions & 3 deletions client/executor/wasmtime/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ use std::{
use wasmtime::{AsContext, AsContextMut, Engine, StoreLimits};

pub(crate) struct StoreData {
/// The limits we aply to the store. We need to store it here to return a reference to this
/// object when we have the limits enabled.
limits: StoreLimits,
/// This will only be set when we call into the runtime.
host_state: Option<Rc<HostState>>,
}

Expand Down Expand Up @@ -618,10 +621,10 @@ fn perform_call(

let ret = entrypoint
.call(&mut ctx, data_ptr, data_len)
.and_then(|r| Ok(unpack_ptr_and_len(r)));
.map(unpack_ptr_and_len);

// Take the host state
ctx.as_context_mut().data_mut().host_state.take();
// Reset the host state
ctx.as_context_mut().data_mut().host_state = None;

let (output_ptr, output_len) = ret?;
let output = extract_output_data(ctx, &instance_wrapper, output_ptr, output_len)?;
Expand Down

0 comments on commit 89b30f7

Please sign in to comment.