Skip to content

Commit

Permalink
fix(c-api) Cherry-pick manually from wasmerio#1657.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Oct 1, 2020
1 parent ecb79e2 commit 9062108
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## **[Unreleased]**
- [#1657](https://github.com/wasmerio/wasmer/pull/1657) Implement `wasm_trap_t` and `wasm_frame_t` for Wasm C API; add examples in Rust and C of exiting early with a host function.
- [#1645](https://github.com/wasmerio/wasmer/pull/1645) Move the install script to https://github.com/wasmerio/wasmer-install

## 1.0.0-alpha3 - 2020-09-14
Expand Down
8 changes: 4 additions & 4 deletions examples/early_exit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn main() -> anyhow::Result<()> {
};
let instance = Instance::new(&module, &import_object)?;

// get the `run` function which we'll use as our entrypoint.
// Get the `run` function which we'll use as our entrypoint.
let run_func: NativeFunc<(i32, i32), i32> =
instance.exports.get_native_function("run").unwrap();

Expand All @@ -66,10 +66,10 @@ fn main() -> anyhow::Result<()> {
result
);
}
// we're expecting it to fail.
// we attempt to downcast the error into the error type that we were expecting.
// We're expecting it to fail.
// We attempt to downcast the error into the error type that we were expecting.
Err(e) => match e.downcast::<ExitCode>() {
// we found the exit code used to terminate execution.
// We found the exit code used to terminate execution.
Ok(exit_code) => {
println!("Exited early with exit code: {}", exit_code);
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions lib/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub use wasmer_compiler::{
};
pub use wasmer_compiler::{CpuFeature, Features, Target};
pub use wasmer_engine::{
ChainableNamedResolver, DeserializeError, Engine, InstantiationError, LinkError, NamedResolver,
NamedResolverChain, Resolver, RuntimeError, SerializeError,
ChainableNamedResolver, DeserializeError, Engine, FrameInfo, InstantiationError, LinkError,
NamedResolver, NamedResolverChain, Resolver, RuntimeError, SerializeError,
};
pub use wasmer_types::{
Atomically, Bytes, GlobalInit, LocalFunctionIndex, MemoryView, Pages, ValueType,
Expand Down
2 changes: 1 addition & 1 deletion lib/engine/src/trap/frame_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ pub fn register(
/// each frame is described by this structure.
///
/// [`Trap`]: crate::Trap
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct FrameInfo {
module_name: String,
func_index: u32,
Expand Down

0 comments on commit 9062108

Please sign in to comment.