Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Read-only access to numeric globals from epoch/call hooks (`StoreHookState`)

オープン
#14,965 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@smarcd がすでに取り組んでいます。

2026年10月24日 から。

  • #14979 @smarcd による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust
領域
api, backend

調査の方向性

Read the Global::get implementation and StoreHookState/AsContext APIs, then review the linked pull request #14979 and the rationale in #14386. Determine whether a read-only numeric global getter fits the callback safety constraints and identify suitable coverage for numeric and reference globals; done means the API decision is resolved and the behavior is covered.

索引モデルが issue の本文から書いたものです。

説明

enhancement wasmtime:api

#14386 narrowed epoch-deadline and call-hook callbacks to StoreHookState, which implements AsContext and gives &mut T. We agree with the rationale: mutating wasm-visible state between instructions is wrong.

That change leaves one read-only use case with no API: reading the current value of a mutable numeric global from inside the callback.

Global::get takes impl AsContextMut. As far as I can tell that is because the Ref arms clone GC refs (clone_gc_ref, ExternRef::from_cloned_gc_ref) and need AutoAssertNoGc. For i32/i64/f32/f64 (and v128) it is a plain load from the VMGlobalDefinition and mutates nothing. So there is no way to read a numeric global with only an AsContext.

Our use case: an embedder that snapshots a suspended guest thread reads the guest's mutable globals (such as the shadow stack pointer) at the moment an epoch tick parks the thread, while the wasm frames are still live on the stack. The thread is paused at a safe point; nothing is mutated, and we do not call back into wasm.

Proposal: a getter that takes impl AsContext and returns Option<Val>/Result<Val> for non-reference global types (returning None/Err for Ref types), e.g. Global::get_numeric. It would be safe to expose from StoreHookState for the same reason Memory::data(&store) already is.

If you would rather not add API surface, is there an intended way for an embedder to observe global values from an epoch callback now? The DebugHandler route (DebugEvent::EpochYield) seems to require guest_debug and async, which is heavier than we want for this.

Happy to send a PR if this direction is acceptable.

主要言語
Rust
スター
18.7k
フォーク
1.9k
平均マージ
23時間
マージ済み PR(30日)
361

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/wasmtime のほかの issue

bytecodealliance/wasmtime の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。