-
Notifications
You must be signed in to change notification settings - Fork 5
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
Browser support #24
Comments
Note that the resolc binary (the solidity frontend) uses stdlib features heavily (threads via rayon, creates processes, calls itself recursively, reads from STDIN, writes files, etc.). I'd expect at least some of those things to work out of the box but I lack experience with the emscripten target. The compilation process roughly looks like this (in a very simple case):
The Rough order of tasks (that can be more or less worked on independently):
|
There is a webassembly SDK at https://github.com/WebAssembly/wasi-sdk. This has a compiler that targets wasm and an implementation of libc in wasm. The compiler is LLVM-19 which is reported to support webassembly as a target. There is also an effort from the YoWASP project to build LLVM to run in a wasm runtime. There is a discussion on the LLVM forum and PR. They have repositories for the patched LLVM and a build script and tools. |
solidity is compiled to wasm with emscripten https://github.com/ethereum/solidity/blob/develop/scripts/ci/build_emscripten.sh |
Note that dependency resolution (parallel compilation) is done in separate processes. AFAIC LLVM uses globals. If creating multiple instances in different "processes" doesn't just work like that in the browser, the LLVM objects need to be mutexed. |
emscripten does not allow to call Module.callMain from Module.callMain as it is implemented in revive so it is an issue |
I think it might be easier to split the compilation process up and process the YUL files one by one using revives YUL mode (i.e. |
Does it change anything? |
Ah yes of course you are right, the recursive call happens regardless of the pipeline. However the code compiles fine regardless for emscripten? What does actually happen on process creation, how is this supposed to work? |
Revive is compiled as an ES6 module. I think that for recursive execution, we need to instantiate an isolated module. Maybe Web Workers could be used. Simply reloading the module for a recursive call does not work. |
We want easy integration for browser-based contract IDEs. Which in turn requires the compiler to be able to run in web browsers.
The text was updated successfully, but these errors were encountered: