Skip to content

Commit

Permalink
Fix compiled signature converters not being cached
Browse files Browse the repository at this point in the history
  • Loading branch information
kg committed Jan 6, 2022
1 parent 9794c82 commit 85eb349
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/mono/wasm/runtime/method-binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,19 @@ export function _compile_converter_for_marshal_string(typePtr: MonoType, method:
const js = _generate_args_marshaler(typePtr, method, args_marshal);
const csFunc = new Function("get_api", "get_type_converter", js);
csFuncResult = csFunc(_get_api, _pick_automatic_converter_for_type);

if (csFuncResult.contains_auto) {
let map = <Map<MonoMethod, SignatureConverter>>_signature_converters.get(args_marshal);
if (!map) {
map = new Map();
_signature_converters.set(args_marshal, map);
}

map.set(method, csFuncResult);
} else {
_signature_converters.set(args_marshal, csFuncResult);
}

return csFuncResult;
}

Expand Down

0 comments on commit 85eb349

Please sign in to comment.