tshort / StaticCompiler.jl

Compiles Julia code to a standalone library (experimental)
Other
490 stars 31 forks source link

Features roadmap #59

Open MasonProtter opened 2 years ago

MasonProtter commented 2 years ago
tshort commented 2 years ago

Ambitious! If we're looking at farther-out features, here are some:

MasonProtter commented 2 years ago

I'll add those to the checklist.

MasonProtter commented 2 years ago

I think "Support basic globals without Julia's runtime" technically already works with #58. I got the globals working before I even figured out how to link to the runtime. The only real problem is that the way I relocate the globals is currently happening inside a julia session, so yeah I think it's kinda covered by the deserialization point and the lower startup time point.

Naively, I think actually that cross compilation might not be too bad (famous last words I know). Afterall, GPUCompiler is already doing cross compilation to GPUs.

vchuravy commented 2 years ago

Cross-compilation on the same OS is feasible, e.g. Linux to Linux, but cross-compilation across OS's is tricky since people love to do: @statis if Sys.iswindows()

AriMKatz commented 2 years ago

out of curiosity, how hard would WASM compilation be? Just flipping a switch in LLVM or something else?

I'd imagine could be straightforward for full static code. Otherwise, we could maybe compile the runtime to wasm- Python does that for the entire interpreter. Or is that better as some sort of plugin system or dependent package?

cc: @fonsp

MasonProtter commented 2 years ago

Yeah, the main issue as far as I understand is that the libjulia runtime is not well supported on WASM. I think LLVM is able to compile to WASM fine from what I understand, but stuff that needs the runtime might be dicey. I'm not an expert at all on this though

AriMKatz commented 2 years ago

Yea, does seem dicey...on the other hand @keno got all of Julia to compile to WASM here (with caveats): https://github.com/Keno/julia-wasm and that seems even dicey-er. So maybe it's not as bad as we think (if we just want the slim libjulia and don't need to codegen) and there could be some code or lessons lifted from that effort.

vchuravy commented 2 years ago

@rhuffy has been working on compiling libjulia to WASM

fonsp commented 2 years ago

@rhuffy has been working on compiling libjulia to WASM

Awesome! How is the progress there?

davidanthoff commented 2 years ago

Is compiling standalone executable also something that might work with this? We would love to eventually ship the language server as a precompiled binary :)

Seelengrab commented 2 years ago

Maybe I'm going a little off the deep end here, but is targeting bare-metal (i.e., there is no OS) anything short of infeasible? Particularly in combination with baremodule, so that there's nothing in there that's not required.

MasonProtter commented 8 months ago

Okay, so a lot has changed with version 0.6 (https://github.com/tshort/StaticCompiler.jl/pull/146) and a lot of stuff on that roadmap is no longer relevant or planned, so I've updated it.

The package is now significantly simpler and more streamlined, so hopefully future work on it will be easier.