Add support for string pools over 10000 strings

This commit is contained in:
lax1dude 2024-11-30 12:45:26 -08:00
parent bf15f0e299
commit 4f431f4170

View File

@ -93,11 +93,17 @@ public class WasmGCStringPool implements WasmGCStringProvider, WasmGCInitializer
void.class));
function.getBody().add(new WasmCall(internInit));
}
var array = new WasmArrayNewFixed(stringsArray);
for (var str : stringMap.values()) {
array.getElements().add(new WasmGetGlobal(str.global));
var stringIterator = stringMap.values().iterator();
while (stringIterator.hasNext()) {
var elementCount = 0;
var array = new WasmArrayNewFixed(stringsArray);
// WasmArrayNewFixed cannot be larger than 10000 elements
while (elementCount < 10000 && stringIterator.hasNext()) {
array.getElements().add(new WasmGetGlobal(stringIterator.next().global));
++elementCount;
}
function.getBody().add(new WasmCall(initStringsFunction, array));
}
function.getBody().add(new WasmCall(initStringsFunction, array));
}
@Override