StaticCompiler.jl icon indicating copy to clipboard operation
StaticCompiler.jl copied to clipboard

Features roadmap

Open MasonProtter opened this issue 3 years ago • 12 comments

  • [ ] Support storing and relocation of global variables
  • [ ] Support for linking binaries to julia's runtime
  • [ ] Support Windows. (Help wanted!)
  • [ ] Interfaces and tests for cross compilation

MasonProtter avatar Feb 10 '22 19:02 MasonProtter

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

  • Support basic globals without Julia's runtime (maybe covered by the next item).
  • C-level deserialization/linking in a shared library to support calling from other languages like Python or R.
  • Cross compiling (I think this is rather hard in general).

tshort avatar Feb 10 '22 19:02 tshort

I'll add those to the checklist.

MasonProtter avatar Feb 10 '22 19:02 MasonProtter

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.

MasonProtter avatar Feb 10 '22 19:02 MasonProtter

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()

vchuravy avatar Feb 10 '22 19:02 vchuravy

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

AriMKatz avatar Feb 10 '22 19:02 AriMKatz

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

MasonProtter avatar Feb 10 '22 19:02 MasonProtter

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.

AriMKatz avatar Feb 10 '22 23:02 AriMKatz

@rhuffy has been working on compiling libjulia to WASM

vchuravy avatar Feb 11 '22 00:02 vchuravy

@rhuffy has been working on compiling libjulia to WASM

Awesome! How is the progress there?

fonsp avatar Feb 14 '22 10:02 fonsp

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

davidanthoff avatar Mar 26 '22 17:03 davidanthoff

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.

Seelengrab avatar Apr 22 '22 10:04 Seelengrab

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.

MasonProtter avatar Nov 12 '23 10:11 MasonProtter