Skip to content

Fix garbage collection bug with JSRef

Camil Staps requested to merge 116-fix-gc-issue-with-JSRef into master

What does this MR do?

Due to a change in !157 (merged), garbage collection did not communicate JSRef values found on the Clean heap to the JavaScript wrapper any more. This means that when a JavaScript object is shared with Clean, and garbage collection runs before it is retrieved, it has already been discarded from the JavaScript shared values array. This can be tested by creating a JavaScript object, trigger garbage collection by generating a lot of garbage, and retrieving the object.

When a JSRef is found by the WebAssembly GC, the JavaScript wrapper needs to be informed so that this value is kept in memory. This was not done properly: js_ref_found was called with the JSRef descriptor instead of its argument.

There will be a minor conflict with !164 (merged). That MR should be merged first, after which this can be rebased and it should compile.

Related issues

Closes #116 (closed)

Changes to public APIs

None.

Author's checklist (required)

See CONTRIBUTING.md for the rationale behind these items:

  • The commit history does not contain merges (use git rebase -i master if it does)
  • Intermediate commits compile (use git rebase -i master if not)
  • Newly added code has a style consistent with the existing code
  • Newly added code is documented
  • A changelog entry has been added if required. See CONTRIBUTING.md
  • If bugs have been solved, tests have been added
  • Appropriate types have been used, especially in APIs
  • If efficiency is part of the acceptance criteria of the issue, a benchmark is provided
  • If enum instruction in src/abc_instructions.h has changed, ABC_VERSION in src/settings.h has been increased
Edited by Camil Staps

Merge request reports