Skip to content

Commit 811b13a

Browse files
aykevldeadprogram
authored andcommitted
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.
1 parent 6e97079 commit 811b13a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

interp/interpreter.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -970,9 +970,9 @@ func (r *runner) runAtRuntime(fn *function, inst instruction, locals []value, me
970970
case llvm.Call:
971971
llvmFn := operands[len(operands)-1]
972972
args := operands[:len(operands)-1]
973-
for _, arg := range args {
974-
if arg.Type().TypeKind() == llvm.PointerTypeKind {
975-
err := mem.markExternalStore(arg)
973+
for _, op := range operands {
974+
if op.Type().TypeKind() == llvm.PointerTypeKind {
975+
err := mem.markExternalStore(op)
976976
if err != nil {
977977
return r.errorAt(inst, err)
978978
}

0 commit comments

Comments
 (0)