Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AssemblyScript] gl-matrix port to WebAssembly #420

Open
3 tasks done
StEvUgnIn opened this issue Mar 26, 2021 · 7 comments
Open
3 tasks done

[AssemblyScript] gl-matrix port to WebAssembly #420

StEvUgnIn opened this issue Mar 26, 2021 · 7 comments

Comments

@StEvUgnIn
Copy link

StEvUgnIn commented Mar 26, 2021

Hi everyone,
I am working since yesterday on the port of gl-matrix to WebAssembly.

Define objectives are:

  • compatibility with TypeScript preserved (using std/assemblyscript/portable definitions)
  • minimal changes from the original code
  • encapsulation and compatibility with projects using the JavaScript implementation

I will publish as soon as I have a solid draft to present :) But the code of gl-matrix is concise, not too shaby for JavaScript code, easily portable to TS/AS environments.

@StEvUgnIn
Copy link
Author

Don't hesitate to share your feedback on my ongoing work here

@stefnotch
Copy link
Collaborator

Out of curiosity, how will garbage collection be handled?

@StEvUgnIn
Copy link
Author

StEvUgnIn commented Mar 27, 2021

Garbage collection makes more sense in bigger projects. Memory is handled manually on Webassembly by the programmer. You have a ton of projects porting C/C++, JavaScript, Rust to Webassembly.

Webassembly is designed to work alongside JavaScript. That means that the binary needs glue code to be able to run in an application (client or server).

After research, the AssemblyScript team is bringing some experimental support for GC. Here is a link https://www.assemblyscript.org/runtime.html

@trusktr
Copy link

trusktr commented Mar 28, 2021

AssemblyScript has automatic GC currently.

  • if an AssemblyScript Wasm module is no longer referenced by JS, the it is collected (this is regular stuff, not assemblyscript-specific).
  • If an AssemblyScript Wasm module is still held by JS, then every time JS invokes the module, AssemblyScript does it's own GC (custom implementation, not the upcoming Wasm GC) on each call. The developer, by default, does not need to worry about it.

@StEvUgnIn
Copy link
Author

Thanks for your explanation @trusktr 🙂

@StEvUgnIn
Copy link
Author

@StEvUgnIn
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants