wasm gc: fix String.intern support

This commit is contained in:
Alexey Andreev 2024-10-02 20:04:18 +02:00
parent 2aabddc32d
commit 802efd49c6

View File

@ -83,6 +83,14 @@ TeaVM.wasm = function() {
} }
function coreImports(imports) { function coreImports(imports) {
let finalizationRegistry = new FinalizationRegistry(heldValue => {
if (typeof exports.reportGarbageCollectedValue === "function") {
exports.reportGarbageCollectedValue(heldValue)
}
});
let stringFinalizationRegistry = new FinalizationRegistry(heldValue => {
exports.reportGarbageCollectedString(heldValue);
});
imports.teavm = { imports.teavm = {
createWeakRef(value, heldValue) { createWeakRef(value, heldValue) {
let weakRef = new WeakRef(value); let weakRef = new WeakRef(value);
@ -102,14 +110,6 @@ TeaVM.wasm = function() {
} }
function jsoImports(imports) { function jsoImports(imports) {
new FinalizationRegistry(heldValue => {
if (typeof exports.reportGarbageCollectedValue === "function") {
exports.reportGarbageCollectedValue(heldValue)
}
});
new FinalizationRegistry(heldValue => {
exports.reportGarbageCollectedString(heldValue);
});
let javaObjectSymbol = Symbol("javaObject"); let javaObjectSymbol = Symbol("javaObject");
let functionsSymbol = Symbol("functions"); let functionsSymbol = Symbol("functions");