JS api for creating GC roots to store temporary object references in (#40645)
authorKatelyn Gadd <kg@luminance.org>
Thu, 13 Aug 2020 18:47:05 +0000 (11:47 -0700)
committerGitHub <noreply@github.com>
Thu, 13 Aug 2020 18:47:05 +0000 (11:47 -0700)
commit8b036be4c3856de3539dbee79059de8e7abc0633
treeebd0f870319e33770471af4d5b168dafa7dafa8e
parent6fb6750c5615279a3773f40ee2360abdcbb988d5
JS api for creating GC roots to store temporary object references in (#40645)

Our current JS is not GC safe and as a result if a GC happens at the wrong time, objects being used by JS can get collected. This PR is a partial solution for the issue that introduces an API for allocating root buffers where you can store GC object references while JS code is manipulating them. Two convenience APIs are layered on top for creating single temporary roots. The PR updates some of the existing bindings APIs to make use of temporary roots when manipulating managed objects.
src/mono/wasm/runtime/binding_support.js
src/mono/wasm/runtime/driver.c
src/mono/wasm/runtime/library_mono.js