From a0ddb00a736d52a74888d3b0e9ef4962e2abd64b Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Mon, 23 Sep 2019 21:24:46 +0200 Subject: [PATCH] pass the method with signature to the VariableManager as fallback --- .../jwebassembly/module/LocaleVariableManager.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/de/inetsoftware/jwebassembly/module/LocaleVariableManager.java b/src/de/inetsoftware/jwebassembly/module/LocaleVariableManager.java index 8a8b0c8..c5c4384 100644 --- a/src/de/inetsoftware/jwebassembly/module/LocaleVariableManager.java +++ b/src/de/inetsoftware/jwebassembly/module/LocaleVariableManager.java @@ -158,14 +158,14 @@ class LocaleVariableManager { if( maxLocals > 0 && vars.length == 0 && method != null ) { ValueTypeParser parser = new ValueTypeParser( method.getType(), types ); if( !method.isStatic() ) { - resetAddVar( ValueType.anyref ); + resetAddVar( ValueType.anyref, size ); } while( size < maxLocals ) { AnyType type = parser.next(); if( type == null ) { break; } - resetAddVar( type ); + resetAddVar( type, size ); } } @@ -177,7 +177,7 @@ class LocaleVariableManager { continue NEXT; } } - resetAddVar( null ); + resetAddVar( null, i ); } } @@ -186,13 +186,15 @@ class LocaleVariableManager { * * @param type * the type of the variable + * @param slot + * the slot of the variable */ - private void resetAddVar( AnyType type ) { + private void resetAddVar( AnyType type, int slot ) { ensureCapacity( size + 1 ); Variable var = variables[size]; var.valueType = type; var.name = null; - var.idx = size; + var.idx = slot; var.startPos = 0; var.endPos = Integer.MAX_VALUE; size++;