From a51bd6df919a5b79574f0996a760cc20cb05697e Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 18 Sep 2023 21:54:14 -0700 Subject: Reland "Optimize tuple.extract of gets in BinaryInstWriter" (#5955) In general, the binary lowering of tuple.extract expects that all the tuple values are on top of the stack, so it inserts drops and possibly uses a scratch local to ensure only the extracted value is left. However, when the extracted tuple expression is a local.get, local.tee, or global.get, it's much more efficient to change the lowering of the get or tee to ensure that only the extracted value is on the stack to begin with. Implement that optimization in the binary writer. --- test/exception-handling.wast.fromBinary | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'test/exception-handling.wast.fromBinary') diff --git a/test/exception-handling.wast.fromBinary b/test/exception-handling.wast.fromBinary index d5cc2c179..44bd2e5c3 100644 --- a/test/exception-handling.wast.fromBinary +++ b/test/exception-handling.wast.fromBinary @@ -20,7 +20,6 @@ (local $1 i64) (local $2 (i32 i64)) (local $3 i32) - (local $4 i32) (try $label$3 (do (throw $e-i32 @@ -60,15 +59,7 @@ ) ) (drop - (block (result i32) - (local.set $4 - (local.get $x) - ) - (drop - (local.get $1) - ) - (local.get $4) - ) + (local.get $x) ) ) ) -- cgit v1.2.3