pchickey opened PR #2952 from pch/limiter_in_store_data
to main
:
Based on #2897 - draft until that PR lands.
This PR does two things:
- The
ResourceLimiter
trait is now implemented on the data inside aStore
rather than as a standalone owned type. This change required changing the structure of the Store internals a bunch. Additionally, the trait is now defined inwasmtime_runtime
and re-exported bywasmtime
.- Two new functions,
entering_native_code_hook
andexiting_native_code_hook
, are added toStore
. These functions get to operate on the data inside aStore
much like resource limiter's mut methods. These functions give embedding the opportunity to measure time (or other resources) and trap before entering any native code (i.e. aFunc
) linked into theStore
, and again before returning from that native code.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
pchickey requested alexcrichton for a review on PR #2952.
pchickey updated PR #2952 from pch/limiter_in_store_data
to main
.
pchickey has marked PR #2952 as ready for review.
alexcrichton submitted PR review.
pchickey updated PR #2952 from pch/limiter_in_store_data
to main
.
pchickey updated PR #2952 from pch/limiter_in_store_data
to main
.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Is the
as &mut dyn ResourceLimiter
required here in that rustc can't infer it?
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Oh how come this change was necessary? I didn't think we even gave access to the
Store
...
bjorn3 submitted PR review.
bjorn3 created PR review comment:
|s| s
doesn't attempt to coerces
AFAIK.
pchickey created PR review comment:
This is used over in the fuzzing crate, which uses a resource limiter. So, while previously the store could have a
()
data and also own adyn ResourceLimiter
, now the store has to contain thedyn ResourceLimiter
.
pchickey submitted PR review.
pchickey updated PR #2952 from pch/limiter_in_store_data
to main
.
pchickey updated PR #2952 from pch/limiter_in_store_data
to main
.
pchickey updated PR #2952 from pch/limiter_in_store_data
to main
.
alexcrichton merged PR #2952.
Last updated: Nov 22 2024 at 16:03 UTC