fst-crenshaw opened Issue #2418:
Feature
The
wasmtime
andlucet
runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects aErr(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:
- 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>; }
- 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 aResult
means that runtimes may customize their reaction to a fatal error inside of a hostcall.
fst-crenshaw edited Issue #2418:
Feature
The
wasmtime
andlucet
runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects aErr(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:
- 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>; }
- 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 aResult
means that runtimes may customize their reaction to a fatal error inside of a hostcall.
peterhuene labeled Issue #2418:
Feature
The
wasmtime
andlucet
runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects aErr(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:
- 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>; }
- 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 aResult
means that runtimes may customize their reaction to a fatal error inside of a hostcall.
peterhuene assigned Issue #2418 (assigned to fst-crenshaw):
Feature
The
wasmtime
andlucet
runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects aErr(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:
- 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>; }
- 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 aResult
means that runtimes may customize their reaction to a fatal error inside of a hostcall.
peterhuene labeled Issue #2418 (assigned to fst-crenshaw):
Feature
The
wasmtime
andlucet
runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects aErr(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:
- 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>; }
- 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 aResult
means that runtimes may customize their reaction to a fatal error inside of a hostcall.
alexcrichton closed Issue #2418 (assigned to fst-crenshaw):
Feature
The
wasmtime
andlucet
runtimes take different approaches when a hostcall reaches a fatal error. Wasmtime expects aErr(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:
- 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>; }
- 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 aResult
means that runtimes may customize their reaction to a fatal error inside of a hostcall.
Last updated: Dec 23 2024 at 12:05 UTC