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

Another try #13

Open
tshort opened this issue Aug 3, 2019 · 3 comments
Open

Another try #13

tshort opened this issue Aug 3, 2019 · 3 comments

Comments

@tshort
Copy link
Owner

tshort commented Aug 3, 2019

New branch started at: https://github.com/tshort/ExportWebAssembly.jl/tree/rework

This is a trial to see if some of the earlier limitations can be removed. Some results are promising:

  • ccall and cglobal--Raw addresses are converted to symbol references for later linking.

  • Global variables--A prototype to serialize and deserialize global objects is working. Lots more work needed to make it robust.

Problems still to start are:

  • Initialization

  • Handling jl_apply_generic

This branch also doesn't generate WebAssembly, yet. For that, we need:

@jpsamaroo
Copy link

What's llc needed for specifically? Is that for compiling parts of Julia's runtime to WASM?

@tshort
Copy link
Owner Author

tshort commented Aug 3, 2019

llc is used for converting a .bc IR file generated by Julia to native code (WebAssembly in this case). Maybe LLVM through Julia can do this, but I haven't run across it.

Julia binaries don't include either of llc or lld. LLVMBuilder includes both. A custom compile of Julia with LLVM built from source includes llc but not lld.

@tshort
Copy link
Owner Author

tshort commented Aug 4, 2019

I don't see a decent way to support initialization without writing C code. julia_init does a lot that requires stuff we won't have in a standalone version. Most of the init functions we do need are not part of the exported C api. It may not be that hard to write a simpler init function in C, but it'd be tough to get that into base. I don't want to support a fork of Julia to make this work.

We could write replacements for libjulia functions and swap them in as needed, but that's a lot of work (for smaller downloads, it is appealing to have a minimal version of libjulia written in Julia). Maybe it's possible to write replacements for just the init functions we need, but it sounds tricky.

Maybe Keno and Valentin will have suggestions after they've gotten deeper into the Iodide work.

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

2 participants