Skip to content
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

Add WebAssembly support to the language and to dmd #109

Open
PetarKirov opened this issue Jan 30, 2024 · 3 comments
Open

Add WebAssembly support to the language and to dmd #109

PetarKirov opened this issue Jan 30, 2024 · 3 comments
Labels
dmd projects related to dmd druntime projects related to druntime industry Something that is interesting to the industrial users of D

Comments

@PetarKirov
Copy link
Member

Description

  • Implement toolchain libraries for working with WebAssmebly:
    • Assembling WAT / WAST (WebAssembly Text format) files to WASM (WebAssembly Binary format)
    • Disassembling WASM to WAT/WAST
    • Builder API for generating WASM modules programatically
    • Linker - link multiple .wasm files into a single .wasm file
  • Implement WebAssembly compiler backend in D and integrate it with dmd
  • Port druntime to WebAssembly + WASI
  • Port phobos to WebAssembly + WASI

What are rough milestones of this project?

The project can be split in two:

  • adding WebAssembly backend to dmd
  • porting Druntime and Phobos to WebAssembly and using LDC for D->Wasm compilation

and each one can be worked on to some extent independently from the other (e.g. the webassembly backend will compile programs in "BetterC" mode until druntime and phobos are ported.

How does this project help the D community?

It expands the range of platforms and uses cases that D supports

Recommended skills

  • Bytecode-based virtual machines
  • Compiler development

Point of Contact

References

<NG discussions, GitHub PRs, Bugzilla issues, ...>

@PetarKirov PetarKirov added industry Something that is interesting to the industrial users of D dmd projects related to dmd druntime projects related to druntime labels Jan 30, 2024
@Herringway
Copy link

I can definitely see value in druntime support (#108 may be related), but what value does DMD support have? I don't think fast compilation is guaranteed anymore with the major backend changes required for that.

Would this cover the emscripten platform as well? A number of pre-WASI projects (such as SDL) out there only support it, and it may be worth considering for compatibility.

@mdparker
Copy link
Member

mdparker commented Feb 5, 2024

WebASM support for DRuntime has filtered up our project list. We had a discussion about it in a recent planning session. There's no appetite for doing anything in dmd for it right now.

@maxhaton
Copy link
Member

maxhaton commented Feb 5, 2024

Merging the druntimes of DMD and LDC would go a long way. There's a lot of wasm crap floating around that should really be upstreamed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dmd projects related to dmd druntime projects related to druntime industry Something that is interesting to the industrial users of D
Projects
None yet
Development

No branches or pull requests

4 participants