From b10d59d1d201506eba1aaba035e699fec849ea60 Mon Sep 17 00:00:00 2001 From: Thomas Lively <tlively@google.com> Date: Fri, 29 Mar 2024 13:01:12 -0700 Subject: Remove the TRAVERSE_CALLS option in the ConstantExpressionRunner (#6449) The implementation of calls with this option was incorrect because it cleared the locals before evaluating the call arguments. The likely explanation for why this was never noticed is that there are no users of this option, especially since it is exposed in the C and JS APIs but not used internally. Rather than try to fix the implementation, just remove the option. --- test/binaryen.js/expressionrunner.js | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) (limited to 'test/binaryen.js/expressionrunner.js') diff --git a/test/binaryen.js/expressionrunner.js b/test/binaryen.js/expressionrunner.js index 7071f950d..9535b3eec 100644 --- a/test/binaryen.js/expressionrunner.js +++ b/test/binaryen.js/expressionrunner.js @@ -1,7 +1,6 @@ var Flags = binaryen.ExpressionRunner.Flags; console.log("// ExpressionRunner.Flags.Default = " + Flags.Default); console.log("// ExpressionRunner.Flags.PreserveSideeffects = " + Flags.PreserveSideeffects); -console.log("// ExpressionRunner.Flags.TraverseCalls = " + Flags.TraverseCalls); function assertDeepEqual(x, y) { if (typeof x === "object") { @@ -139,39 +138,7 @@ assertDeepEqual( } ); -// Should traverse into (simple) functions if requested -runner = new binaryen.ExpressionRunner(module, Flags.TraverseCalls); -module.addFunction("add", binaryen.createType([ binaryen.i32, binaryen.i32 ]), binaryen.i32, [], - module.block(null, [ - module.i32.add( - module.local.get(0, binaryen.i32), - module.local.get(1, binaryen.i32) - ) - ], binaryen.i32) -); -assert(runner.setLocalValue(0, module.i32.const(1))); -expr = runner.runAndDispose( - module.i32.add( - module.i32.add( - module.local.get(0, binaryen.i32), - module.call("add", [ - module.i32.const(2), - module.i32.const(4) - ], binaryen.i32) - ), - module.local.get(0, binaryen.i32) - ) -); -assertDeepEqual( - binaryen.getExpressionInfo(expr), - { - id: binaryen.ExpressionIds.Const, - type: binaryen.i32, - value: 8 - } -); - -// Should not attempt to traverse into functions if not explicitly set +// Should not attempt to traverse into functions runner = new binaryen.ExpressionRunner(module); expr = runner.runAndDispose( module.i32.add( -- cgit v1.2.3