Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Avoid manual memory management with JSClosure #106

Copy link
Copy link
@MaxDesiatov

Description

@MaxDesiatov
Issue body actions

I wonder if reference types could lift our requirement to manage references to JS closures manually?

With externrefs, the host gives Wasm limited access to host objects, but the host also needs to know when Wasm is finished with those objects, so it can clean them up. That clean up might involve closing a file handle or simply deallocating memory.

This means that JS closures should be passed to the Swift code as externref. Deallocating all references to externref would deallocate the closure on the JS side.

Reference types are now available in all browsers except Safari, and in the latter case they seem to only be hidden behind JSC_useWebAssemblyReferences flag. The only question is externref support in our toolchain...

Doesn't look like LLVM had much progress in that direction? 🤔 Also see WebAssembly/tool-conventions#122

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.