Skip to content

Another hook for codegen to help with WebAssembly #24038

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

Closed
tshort opened this issue Oct 7, 2017 · 4 comments
Closed

Another hook for codegen to help with WebAssembly #24038

tshort opened this issue Oct 7, 2017 · 4 comments

Comments

@tshort
Copy link
Contributor

tshort commented Oct 7, 2017

At ExportWebAssembly, I've prototyped a package for converting Julia code to WebAssembly. It uses the awesome LLVM package, and much of this code is straight from CUDAnative. This approach works much better than my previous efforts of trying to get julia --output-bc incantations to work.

Right now, it works fine for code using StaticArrays and other immutables. Nothing works that uses ccall's, though. Using Emscripten, I've gotten big chunks of libjulia and libuv compiled to bitcode, so if I can get the ccall's to link with that bitcode, that will open up much more Julia code that will compile to WebAssembly/JavaScript.

llvmcall's are handled fine by this package. In llvmcall's, you can include calls to functions that are declared but not defined. So, it may be possible to convert a ccall to an llvmcall with a declared function and let the linking happen later.

Supporting ccall may require changes to codegen in Julia. So, would it be appropriate to add another hook or two to those added by @maleadt (#19290, #23581)? To get at the ccall's before they are converted to calls to memory addresses, it looks like I need a hook earlier in the codegen process (here?).

If hooks aren't the way to go, are there any other suggestions?

@Keno
Copy link
Member

Keno commented Oct 7, 2017

Seems reasonable to me.

@davidrapin
Copy link

Any updates on the status of this? I'm very interested.

@tshort
Copy link
Contributor Author

tshort commented Jan 29, 2018

I played around with it enough to find something that worked for my application, but it wasn't very general. I changed focus to try implementing codegen in Julia: https://github.com/tshort/CodeGen.jl

It's still a WIP.

@davidrapin
Copy link

Thank you for the update!

@tshort tshort closed this as completed Mar 15, 2018
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