You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This segfaults, for a good reason: At the point when we do instance.get_typed_func::<(), i32>(&mut store, "entry2")?; the Instance (more precisely: the Store) thinks that we are still running inside the continuation previously called $c. On suspend, it then tries to use the context stored in $c about its parent, trying to suspend itself into a stack frame supposed to be executing the (long dead) entry1.
In general, what needs to happen is that either when a trap occurs while running inside a continuation, or when entering an instance in general, we reset the information about the currently active continuation. However, this is rather subtle, due to the various pieces of information associated with it (e.g., we also need to update the VMRuntimeLimits correctly).
The text was updated successfully, but these errors were encountered:
This PR splits `linking_tags.wast` into two files.
This is a preparation step needed to land fast effect forwarding due to
the following:
`linking_tags.wast` currently has two `assert_suspension` directives. In
the current implementation, we are always on the main stack when we
detect that a tag is unhandled and trap from there. However, in the
presence of fast effect forwarding, we detect the lack of an appropriate
handler at the `suspend` site and trap there (i.e., possibly while still
running on a continuation stack).
As a result, the `assert_suspension` directives in `linking_tags.wast`
trigger the problem described in #253 as soon as fast fowarding lands.
As a workaround, this PR splits the file into two, where the
`assert_suspension` is the very last step in each test (i.e., we avoid
further execution inside the `Store` where we trapped while inside a
continuation). The combined contents of both files is identical to the
original `linking_tags.wast`, but the module `bar` is moved to the end
of the second file.
TL;DR: We currently have some support for trapping inside a continuation, but things fall apart if you want to re-use the instance afterwards.
Consider the following sequence of events:
i
.entry1
insidei
.entry1
runs some code inside a continuation. While doing so, a trap occurs.i
.The following code snippet illustrates this:
This segfaults, for a good reason: At the point when we do
instance.get_typed_func::<(), i32>(&mut store, "entry2")?;
theInstance
(more precisely: theStore
) thinks that we are still running inside the continuation previously called$c
. Onsuspend
, it then tries to use the context stored in$c
about its parent, trying to suspend itself into a stack frame supposed to be executing the (long dead)entry1
.In general, what needs to happen is that either when a trap occurs while running inside a continuation, or when entering an instance in general, we reset the information about the currently active continuation. However, this is rather subtle, due to the various pieces of information associated with it (e.g., we also need to update the
VMRuntimeLimits
correctly).The text was updated successfully, but these errors were encountered: