Stream: git-wasmtime

Topic: wasmtime / Issue #2418 Enhance wiggle to permit WebAssemb...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2020 at 19:12):

fst-crenshaw opened Issue #2418:

Feature

The wasmtime and lucet runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects a Err(wasmtime::Trap::new()) from the hostcall indicating that an instance ought to be terminated. The lucet runtime uses a panic!() to indicate a fatal error. To allow for an agnostic support of these two different approaches, wiggle requires an enhancement that allows each of these runtimes to customize their reaction to a fatal error.

Implementation

Currently, the wiggle procedural macro generates a UserErrorConversion trait that, when implemented, specifies how to transform a hostcall error into an abi error, or i32. For wasmtime, that trait is generated by wiggle like so:

pub trait UserErrorConversion {
    fn errno_from_error(&self, e: Error) -> Errno;
}

One approach to enhance wiggle so that runtimes to react to fatal errors in a custom way follows:

  1. Wiggle generates its UserErrorConversion trait to return a Result instead of an i32. The FatalError portion of the result must contain info describing the nature of the fatal error.
pub trait UserErrorConversion {
            fn errno_from_error(&self, e: Error) ->
Result<Errno, FatalError>;
}
  1. Wasmtime alters its wiggle integration to handle a Result instead of an i32. When a FatalError is received, it must Trap(“info”).

Benefit

Enhancing the UserErrorConversion trait to return a Result means that runtimes may customize their reaction to a fatal error inside of a hostcall.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2020 at 19:12):

fst-crenshaw edited Issue #2418:

Feature

The wasmtime and lucet runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects a Err(wasmtime::Trap::new()) from the hostcall indicating that an instance ought to be terminated. The lucet runtime uses a panic!() to indicate a fatal error. To allow for an agnostic support of these two different approaches, wiggle requires an enhancement that allows each of these runtimes to customize their reaction to a fatal error.

Implementation

Currently, the wiggle procedural macro generates a UserErrorConversion trait that, when implemented, specifies how to transform a hostcall error into an abi error, or i32. For wasmtime, that trait is generated by wiggle like so:

pub trait UserErrorConversion {
    fn errno_from_error(&self, e: Error) -> Errno;
}

One approach to enhance wiggle so that runtimes to react to fatal errors in a custom way follows:

  1. Wiggle generates its UserErrorConversion trait to return a Result instead of an i32. The FatalError portion of the result must contain info describing the nature of the fatal error.
pub trait UserErrorConversion {
            fn errno_from_error(&self, e: Error) -> Result<Errno, FatalError>;
}
  1. Wasmtime alters its wiggle integration to handle a Result instead of an i32. When a FatalError is received, it must Trap(“info”).

Benefit

Enhancing the UserErrorConversion trait to return a Result means that runtimes may customize their reaction to a fatal error inside of a hostcall.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 14 2020 at 01:37):

peterhuene labeled Issue #2418:

Feature

The wasmtime and lucet runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects a Err(wasmtime::Trap::new()) from the hostcall indicating that an instance ought to be terminated. The lucet runtime uses a panic!() to indicate a fatal error. To allow for an agnostic support of these two different approaches, wiggle requires an enhancement that allows each of these runtimes to customize their reaction to a fatal error.

Implementation

Currently, the wiggle procedural macro generates a UserErrorConversion trait that, when implemented, specifies how to transform a hostcall error into an abi error, or i32. For wasmtime, that trait is generated by wiggle like so:

pub trait UserErrorConversion {
    fn errno_from_error(&self, e: Error) -> Errno;
}

One approach to enhance wiggle so that runtimes to react to fatal errors in a custom way follows:

  1. Wiggle generates its UserErrorConversion trait to return a Result instead of an i32. The FatalError portion of the result must contain info describing the nature of the fatal error.
pub trait UserErrorConversion {
            fn errno_from_error(&self, e: Error) -> Result<Errno, FatalError>;
}
  1. Wasmtime alters its wiggle integration to handle a Result instead of an i32. When a FatalError is received, it must Trap(“info”).

Benefit

Enhancing the UserErrorConversion trait to return a Result means that runtimes may customize their reaction to a fatal error inside of a hostcall.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 14 2020 at 01:38):

peterhuene assigned Issue #2418 (assigned to fst-crenshaw):

Feature

The wasmtime and lucet runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects a Err(wasmtime::Trap::new()) from the hostcall indicating that an instance ought to be terminated. The lucet runtime uses a panic!() to indicate a fatal error. To allow for an agnostic support of these two different approaches, wiggle requires an enhancement that allows each of these runtimes to customize their reaction to a fatal error.

Implementation

Currently, the wiggle procedural macro generates a UserErrorConversion trait that, when implemented, specifies how to transform a hostcall error into an abi error, or i32. For wasmtime, that trait is generated by wiggle like so:

pub trait UserErrorConversion {
    fn errno_from_error(&self, e: Error) -> Errno;
}

One approach to enhance wiggle so that runtimes to react to fatal errors in a custom way follows:

  1. Wiggle generates its UserErrorConversion trait to return a Result instead of an i32. The FatalError portion of the result must contain info describing the nature of the fatal error.
pub trait UserErrorConversion {
            fn errno_from_error(&self, e: Error) -> Result<Errno, FatalError>;
}
  1. Wasmtime alters its wiggle integration to handle a Result instead of an i32. When a FatalError is received, it must Trap(“info”).

Benefit

Enhancing the UserErrorConversion trait to return a Result means that runtimes may customize their reaction to a fatal error inside of a hostcall.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 14 2020 at 01:40):

peterhuene labeled Issue #2418 (assigned to fst-crenshaw):

Feature

The wasmtime and lucet runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects a Err(wasmtime::Trap::new()) from the hostcall indicating that an instance ought to be terminated. The lucet runtime uses a panic!() to indicate a fatal error. To allow for an agnostic support of these two different approaches, wiggle requires an enhancement that allows each of these runtimes to customize their reaction to a fatal error.

Implementation

Currently, the wiggle procedural macro generates a UserErrorConversion trait that, when implemented, specifies how to transform a hostcall error into an abi error, or i32. For wasmtime, that trait is generated by wiggle like so:

pub trait UserErrorConversion {
    fn errno_from_error(&self, e: Error) -> Errno;
}

One approach to enhance wiggle so that runtimes to react to fatal errors in a custom way follows:

  1. Wiggle generates its UserErrorConversion trait to return a Result instead of an i32. The FatalError portion of the result must contain info describing the nature of the fatal error.
pub trait UserErrorConversion {
            fn errno_from_error(&self, e: Error) -> Result<Errno, FatalError>;
}
  1. Wasmtime alters its wiggle integration to handle a Result instead of an i32. When a FatalError is received, it must Trap(“info”).

Benefit

Enhancing the UserErrorConversion trait to return a Result means that runtimes may customize their reaction to a fatal error inside of a hostcall.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 24 2020 at 20:07):

alexcrichton closed Issue #2418 (assigned to fst-crenshaw):

Feature

The wasmtime and lucet runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects a Err(wasmtime::Trap::new()) from the hostcall indicating that an instance ought to be terminated. The lucet runtime uses a panic!() to indicate a fatal error. To allow for an agnostic support of these two different approaches, wiggle requires an enhancement that allows each of these runtimes to customize their reaction to a fatal error.

Implementation

Currently, the wiggle procedural macro generates a UserErrorConversion trait that, when implemented, specifies how to transform a hostcall error into an abi error, or i32. For wasmtime, that trait is generated by wiggle like so:

pub trait UserErrorConversion {
    fn errno_from_error(&self, e: Error) -> Errno;
}

One approach to enhance wiggle so that runtimes to react to fatal errors in a custom way follows:

  1. Wiggle generates its UserErrorConversion trait to return a Result instead of an i32. The FatalError portion of the result must contain info describing the nature of the fatal error.
pub trait UserErrorConversion {
            fn errno_from_error(&self, e: Error) -> Result<Errno, FatalError>;
}
  1. Wasmtime alters its wiggle integration to handle a Result instead of an i32. When a FatalError is received, it must Trap(“info”).

Benefit

Enhancing the UserErrorConversion trait to return a Result means that runtimes may customize their reaction to a fatal error inside of a hostcall.


Last updated: Oct 23 2024 at 20:03 UTC