SIGN IN SIGN UP

Fix type updating for indirect call effects (#8874)

Part of #8615. Fixes #8833 which was wrong. The earlier fix never
touched `newTypeEffects` at all. It passed tests and fixed the breakage
only incidentally by being maximally conservative and losing all
indirect call effects in the case of a type update. Fix this logic and
add unit tests to vet this code better.

Drive-by fixes:
* Clear indirectCallEffects during --discard-global-effects, before
recomputing global effects, and if a pass's `addsEffects()` is true.
Clearing it when recomputing global effects is necessary to remove stale
entries for types that no longer exist after type rewriting (although it
should make no difference to optimizations).
* Fix use-after-free in tests due to static storage of HeapTypes / Types
+ destroyAllTypesForTestingPurposesOnly. The static HeapType / Type in
`getMutI8Array` and similar functions referred to an index in
`globalHeapTypeStore` / `globalTupleStore`, which gets cleared in unit
tests with `destroyAllTypesForTestingPurposesOnly()`, causing the index
to refer to garbage. Change these to not use static storage so that
they're always in sync with `globalHeapTypeStore` / `globalTupleStore`.
* More changes to support gmock. #8879 partially addressed this but I
still hit some linker errors when adding new test code using gmock. The
issue is that the earlier PR didn't change anything when BUILD_FUZZTEST
is false.
S
Steven Fontanella committed
cdf3bfc51cbaaf784999c267cb33e09cb188007e
Parent: acf302c
Committed by GitHub <noreply@github.com> on 7/22/2026, 11:20:54 PM