mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 00:04:10 -08:00
wasm gc: add support for string pools over 10000 strings (#977)
Due to limit in spec that allows `ref.array_new_fixed` to take up to 10000 arguments
This commit is contained in:
parent
bf15f0e299
commit
516602d32d
|
@ -93,12 +93,18 @@ public class WasmGCStringPool implements WasmGCStringProvider, WasmGCInitializer
|
|||
void.class));
|
||||
function.getBody().add(new WasmCall(internInit));
|
||||
}
|
||||
var stringIterator = stringMap.values().iterator();
|
||||
while (stringIterator.hasNext()) {
|
||||
var elementCount = 0;
|
||||
var array = new WasmArrayNewFixed(stringsArray);
|
||||
for (var str : stringMap.values()) {
|
||||
array.getElements().add(new WasmGetGlobal(str.global));
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WasmGCStringConstant getStringConstant(String string) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user