Skip to content

Commit 758557f

Browse files
VolkerVolker
authored andcommitted
Fix getTempI32() that it work without the removed prepare phase.
1 parent fcaa15d commit 758557f

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/de/inetsoftware/jwebassembly/module/LocaleVariableManager.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,6 @@ void use( ValueType valueType, int slot ) {
8383
var.valueType = valueType;
8484
}
8585

86-
/**
87-
* We need an extra temporary variable inn the WebAssembly code.
88-
*/
89-
void useTempI32() {
90-
needTempI32 = true;
91-
}
92-
9386
/**
9487
* Calculate the WebAssembly index position on the consumed data.
9588
*/
@@ -131,7 +124,8 @@ List<ValueType> getLocalTypes( int paramCount ) {
131124
* @return the slot
132125
*/
133126
int getTempI32() {
134-
return size - 1;
127+
needTempI32 = true;
128+
return -1;
135129
}
136130

137131
/**
@@ -142,6 +136,9 @@ int getTempI32() {
142136
* @return the variable index in WebAssembly
143137
*/
144138
int get( int slot ) {
139+
if( slot < 0 ) {
140+
slot = size - 1; // temp i32
141+
}
145142
return variables[slot].idx;
146143
}
147144

src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,6 @@ private void writeSwitchCode( CodeInputStream byteCode, boolean isLookupSwitch )
751751
int[] keys;
752752
int[] positions;
753753
if( isLookupSwitch ) { // lookupswitch
754-
localVariables.useTempI32(); //TODO
755754
int count = byteCode.readInt();
756755
keys = new int[count];
757756
positions = new int[count];

0 commit comments

Comments
 (0)