Bug 19198 – Transfer the entire development DMD to LLVM: WebAssembly, dynamic scripting..
Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-08-27T11:21:19Z
Last change time
2018-08-27T15:33:38Z
Assigned to
No Owner
Creator
OlegZ
Comments
Comment #0 by black80 — 2018-08-27T11:21:19Z
I am noob of LLVM.
1) LLVM allow use any subset of Analytic and Transfer Passes https://releases.llvm.org/6.0.0/docs/Passes.html
GCC(DMD backend?) is blackbox, LLVM - white box where u can insert/delete/update any Passes for any hardware.
2) LLVM can generate WebAssembly code - big frontend area, probably server too.
translation LLVM-IR to WASM can be used from any opensource team: LLVM, Rust, Go... U don't need waste time for it.
3) LDC already supports dynamic compilation for some functions.
Team can add runtime scripts do D in future.
see Terra language with Lua integration.
yep, Lua is scripting and Terra is script inside Lua.
Lua has one runtime(LUA), Terra has another runtime(LLVM) - they should cooperate and this step adds more complications inside RT.
D-LLVM-scripts can work in one runtime and GC.
at this PDF author of Terra says about lang and optimizations https://cs.stanford.edu/~zdevito/zdevito_thesis.pdf. Look at chapter 5 where 50 lines of Terra code can compared by speed with thousands LOC of BLAS and MKL - libs that solve linear system of equations. Such simplicity would not be available without LLVM.
Runtime scripts are needed in many areas - games, graphic editors (shaders), REPL/shell, finance (trading/backtesting).. Even Qt/QML has no good interop between itself. C#/Java has good scripting interop and probably that all.
4) I can't imagine how many bonuses can be with using LLVM.
search ideas at internet/blogs and known persons from any lang-teams that use LLVM. union of LLVM and D can add features to both areas: D-team can improve LLVM passes/code/lib and people that worked LLVM can add incredible possibilities to D-lang/runtime
Comment #1 by black80 — 2018-08-27T11:26:00Z
SPIR-V (bytecode of Vulkan API and OpenCL) can be translated to LLVM and back https://github.com/KhronosGroup/SPIRV-LLVM
LLVM can generate code for AMD/NVIDIA extension cards (graphics, math..)