[Git][ghc/ghc][wip/sjakobi/mr16259] 2 commits: wasm: untag the Weak# obtained through a StablePtr in rts_promiseThrowTo
Simon Jakobi pushed to branch wip/sjakobi/mr16259 at Glasgow Haskell Compiler / GHC Commits: 201c4864 by Simon Jakobi at 2026-07-11T09:00:05+02:00 wasm: untag the Weak# obtained through a StablePtr in rts_promiseThrowTo Same defect class as the hs_try_putmvar fixes: the Weak# created around a JSFFI export's TSO now carries tag 1 (#23173) and makeStablePtr# stores it tagged, so rts_promiseThrowTo read all StgWeak fields one byte off and crashed in throwToMsg (jsffi/cancel in the second CI run of !16329). The resolve/reject paths were already covered by the hs_try_putmvar_with_value fix. Assisted-by: Claude Fable 5 - - - - - 4dde58bb by Simon Jakobi at 2026-07-11T09:00:05+02:00 Accept remaining compile-time metric increases from enter-taggable enforcement Second CI run of !16329 flagged three more compile-time allocation increases beyond T13960: T20049 (+2.0%, right at the window edge, on x86_64 validate jobs) and, on the wasm cross job only, T6048 (+2.2%) and T16577 (+5.7%). These are the emitEnter tag-test cost of the invariant enforcement (#23173); the wasm numbers suggest the cost is higher without TablesNextToCode. The perf driver reads the Metric Increase block from the HEAD commit only, hence this empty commit at the branch tip; it supersedes the earlier one for T13960. ------------------------- Metric Increase: T13960 T16577 T20049 T6048 ------------------------- Assisted-by: Claude Fable 5 - - - - - 1 changed file: - rts/wasm/JSFFI.c Changes: ===================================== rts/wasm/JSFFI.c ===================================== @@ -297,7 +297,9 @@ __attribute__((export_name("rts_promiseThrowTo"))) void rts_promiseThrowTo(HsStablePtr, HsJSVal); void rts_promiseThrowTo(HsStablePtr sp, HsJSVal js_err) { Capability *cap = &MainCapability; - StgWeak *w = (StgWeak *)deRefStablePtr(sp); + // Weak# pointers carry tag 1; see Note [Pointer tagging of unlifted boxed + // primitives] in GHC.StgToCmm.Prim. (The key field is stored untagged.) + StgWeak *w = (StgWeak *)UNTAG_CLOSURE((StgClosure *)deRefStablePtr(sp)); if (w->header.info == &stg_DEAD_WEAK_info) { return; } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c00b949fbead911ff11b5c4f5e7b67d... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c00b949fbead911ff11b5c4f5e7b67d... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Jakobi (@sjakobi2)