Repository navigation
Commit 23a242a
committed
[wasm] Make the finalizer slot's portable entrypoint callable from R2R
On FEATURE_PORTABLE_ENTRYPOINTS (wasm) targets, System.GC.RunFinalizers
invokes each object's Finalize via a typed call_indirect on the finalizer
method's portable entrypoint (PEP). GCInterface_GetNextFinalizableObject
returned the raw GetRestoredSlot result, which for a not-yet-prepared method
is a cold PEP (_pActualCode == 0, prefers the interpreter). A call_indirect on
a cold PEP targets wasm table slot 0 (the reserved null slot) and traps with
"null function or function signature mismatch".
Make the slot callable explicitly, mirroring the class-constructor slot in
MethodTable::CallClassConstructor. EnsurePortableEntryPointIsCallableFromR2R
wires the R2R->interpreter thunk (or leaves already-published native code in
place) so the call_indirect resolves to real code. This adds the finalizer
QCall to the documented "call site makes the target callable before an R2R
call_indirect" pattern used by GetMultiCallableAddrOfCode, the cctor slot, the
managed main entry, the default ctor, P/Invoke, ExternalMethodFixupWorker, and
EnC.
Fixes the browser-wasm R2R crash in JIT/Regression b12795 and b38269 in both
R2R-corelib mode (interpreted finalizer, wired via the R2R->interpreter thunk)
and R2R-full mode (crossgen'd finalizer); the interpreter is unaffected. Same
cold-first-call family as dotnet#130634.
Fixes dotnet#130839.1 parent f2281d5 commit 23a242a
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
789 | 798 | | |
790 | 799 | | |
791 | 800 | | |
| |||
0 commit comments