diff --git a/src/de/inetsoftware/jwebassembly/module/LocaleVariableManager.java b/src/de/inetsoftware/jwebassembly/module/LocaleVariableManager.java index 7c0abd2..01d08d5 100644 --- a/src/de/inetsoftware/jwebassembly/module/LocaleVariableManager.java +++ b/src/de/inetsoftware/jwebassembly/module/LocaleVariableManager.java @@ -83,13 +83,6 @@ class LocaleVariableManager { var.valueType = valueType; } - /** - * We need an extra temporary variable inn the WebAssembly code. - */ - void useTempI32() { - needTempI32 = true; - } - /** * Calculate the WebAssembly index position on the consumed data. */ @@ -131,7 +124,8 @@ class LocaleVariableManager { * @return the slot */ int getTempI32() { - return size - 1; + needTempI32 = true; + return -1; } /** @@ -142,6 +136,9 @@ class LocaleVariableManager { * @return the variable index in WebAssembly */ int get( int slot ) { + if( slot < 0 ) { + slot = size - 1; // temp i32 + } return variables[slot].idx; } diff --git a/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java b/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java index 9680e8c..3b6708c 100644 --- a/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java +++ b/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java @@ -751,7 +751,6 @@ public class ModuleGenerator { int[] keys; int[] positions; if( isLookupSwitch ) { // lookupswitch - localVariables.useTempI32(); //TODO int count = byteCode.readInt(); keys = new int[count]; positions = new int[count];