interp: correctly mark functions as modifying memory

Previously, if a function couldn't be interpreted in the interp pass, it
would just be run at runtime and the parameters would be marked as
potentially being modified. However, this is incorrect: the function
itself can also modify memory. So the function itself also needs to be
marked (recursively).

This fixes a number of regressions while upgrading to Go 1.24.

This results in a significant size regression that is mostly worked
around in the next commit.
This commit is contained in:
Ayke van Laethem
2025-02-18 13:59:28 +01:00
committed by Ron Evans
parent 6e97079367
commit 811b13a9d3
+3 -3
View File
@@ -970,9 +970,9 @@ func (r *runner) runAtRuntime(fn *function, inst instruction, locals []value, me
case llvm.Call:
llvmFn := operands[len(operands)-1]
args := operands[:len(operands)-1]
for _, arg := range args {
if arg.Type().TypeKind() == llvm.PointerTypeKind {
err := mem.markExternalStore(arg)
for _, op := range operands {
if op.Type().TypeKind() == llvm.PointerTypeKind {
err := mem.markExternalStore(op)
if err != nil {
return r.errorAt(inst, err)
}