mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 18:53:29 +00:00
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:
committed by
Ron Evans
parent
6e97079367
commit
811b13a9d3
@@ -970,9 +970,9 @@ func (r *runner) runAtRuntime(fn *function, inst instruction, locals []value, me
|
|||||||
case llvm.Call:
|
case llvm.Call:
|
||||||
llvmFn := operands[len(operands)-1]
|
llvmFn := operands[len(operands)-1]
|
||||||
args := operands[:len(operands)-1]
|
args := operands[:len(operands)-1]
|
||||||
for _, arg := range args {
|
for _, op := range operands {
|
||||||
if arg.Type().TypeKind() == llvm.PointerTypeKind {
|
if op.Type().TypeKind() == llvm.PointerTypeKind {
|
||||||
err := mem.markExternalStore(arg)
|
err := mem.markExternalStore(op)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return r.errorAt(inst, err)
|
return r.errorAt(inst, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user