Skip to content

Commit 85eb349

Browse files
committed
Fix compiled signature converters not being cached
1 parent 9794c82 commit 85eb349

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/mono/wasm/runtime/method-binding.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,19 @@ export function _compile_converter_for_marshal_string(typePtr: MonoType, method:
299299
const js = _generate_args_marshaler(typePtr, method, args_marshal);
300300
const csFunc = new Function("get_api", "get_type_converter", js);
301301
csFuncResult = csFunc(_get_api, _pick_automatic_converter_for_type);
302+
303+
if (csFuncResult.contains_auto) {
304+
let map = <Map<MonoMethod, SignatureConverter>>_signature_converters.get(args_marshal);
305+
if (!map) {
306+
map = new Map();
307+
_signature_converters.set(args_marshal, map);
308+
}
309+
310+
map.set(method, csFuncResult);
311+
} else {
312+
_signature_converters.set(args_marshal, csFuncResult);
313+
}
314+
302315
return csFuncResult;
303316
}
304317

0 commit comments

Comments
 (0)