mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +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:
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user