From fd27656b6548311067adead65cc0db2f351fa283 Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sun, 26 Apr 2020 18:37:10 +0200 Subject: [PATCH] Does not unbox if exception handling is not supported. --- src/de/inetsoftware/jwebassembly/module/BranchManger.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/de/inetsoftware/jwebassembly/module/BranchManger.java b/src/de/inetsoftware/jwebassembly/module/BranchManger.java index 2036b65..1287543 100644 --- a/src/de/inetsoftware/jwebassembly/module/BranchManger.java +++ b/src/de/inetsoftware/jwebassembly/module/BranchManger.java @@ -1044,6 +1044,11 @@ class BranchManger { private void addUnboxExnref( BranchNode catchNode ) { // unboxing the exnref on the stack to a reference of the exception int catchPos = catchNode.startPos; + if( !options.useEH() ) { + BranchNode unBoxing = new BranchNode( catchPos, catchPos, WasmBlockOperator.UNREACHABLE, null ); + catchNode.add( 0, unBoxing ); + return; + } BranchNode unBoxing = new BranchNode( catchPos, catchPos, WasmBlockOperator.BLOCK, WasmBlockOperator.END, options.getCatchType() ); catchNode.add( 0, unBoxing );