-
Notifications
You must be signed in to change notification settings - Fork 170
WASM: Runtime Library #1413
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
Comments
What are the possible ways forward? One option is to use Another option is to take the frontend language (Fortran or Python) runtime library, that calls into C, and then implement those C functions somehow. We also have several applications of wasm:
We should ensure that our solution works well for all three use cases. |
This feels hackish to me. IMO, |
This feels hackish to me. IMO, |
Nothing is preventing us as far as I know. |
Then we should try with |
I will share my thoughts on this soon. |
The pure Fortran (and Python) library works with wasm, so the only remaining file to tackle is
That leaves the following functions:
Given this, it seems to me that we do not need the C runtime library at all, it is just a temporary measure to get things going. For the WASM backend specifically, I would almost not bother, and rather work on moving more things into the surface language and ASR, one by one. |
We now use IntrinsicFunction (might need to sync ASR with LFortran). Just a few functions are ported, but There are two ways. 1In the WASM backend you can implement IntrinsicFunction by changing this:
Into:
2Improve the ASR->ASR pass and instead of calling implementation in C, call pure Fortran implementation. Most likely we will implement this in ASR itself, then it is usable for LPython also. See lfortran/lfortran#1435. |
At present the |
Regarding 1), I think we can use
and provide the implementation of our imports in C, compile with clang to wasm and preload the module. Something like that might work and might be quite simple to maintain. |
I think here is how we need to move forward: we need to port ALL of our runtime library to ASR, based on the plan above (#1413 (comment)).
That will make pure Fortran or pure LPython code work completely via WASM, and our WASM->x64 backend will generate a standalone binary that will just work. If we need to link with C, then we just generate an |
The runtime library functions that need access to libc are currently not supported in the
wasm
backend (and therefore also not yet supported in thewasm_x64
andwasm_x86
backends). It seemsWASI
or something similar could be used. This issue to plan/discuss about supporting the runtime library functions in thewasm
backend.The text was updated successfully, but these errors were encountered: