-
-
Notifications
You must be signed in to change notification settings - Fork 655
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
Refactor loader #411
Refactor loader #411
Conversation
While looking at this I figured that it totally makes sense to move the accessors to the memory instance, as it also avoids naming collisions with actual exports naturally. Might be worth to consider dropping backwards compatibility and update the documentation to the new semantics. Wdyt? |
Though, I believe that I had an issue once where it wasn't possible to extend a |
Yeah sure, sounds good. Might make sense to create a api compatible wrapper object for the memory instance instead of extending it to avoid any troubles. |
Ported to TypeScript and extracted the helpers out from the module namespace into |
This looks great! I had solved the issue by adding getStringImpl as an export, but this is a lot cleaner. However, another needed feature for the loader has to do with running multithreaded code. I've been working on a library that implements the web worker API and one important aspect is that each instantiation of a module will copy the data section into memory, which can overwrite shared memory. Thus you need to first create a module with just the data to be instantiated and then use the exported memory for each of the subsequent modules. I had first solved this by hacking at the compile itself to not emit a data section. However, I think the best way to approach this is to use the parser to split a data section and module at load time. This is something that I'm also close to finishing, but am unsure where this all should take place. Your class abstraction might be the key; perhaps my threading library can just extend it to add this feature. |
Looking good so far! Code style should use semicolons, though, because that's essentially what's used everywhere else. With no immediately useable |
Semicolons added I haven't used lerna before but seen it used in some projects and I like the structure. I think it could be a good option. |
Or let's just add a new |
366a4ef
to
5e2196d
Compare
Sorry, took me a while to get to this, mostly because I'd like to actually play around with it a bit on top of master. Thanks! :) |
Hrm, actually, when I opened the loader source locally it instantly went all red due to code style issues (tslint vscode ext), like indentation, missing return types, single quoted strings, redundant public keywords. Really thought I had looked through this more thoroughly before, sorry. Going to revert for now. Let me know if you'd like to tackle those issues. |
Fixes #410
Also allows default
trace
andabort
functions to use more efficientgetString
when available. Tests passing and should be backwards compatible.