ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.21k stars 262 forks source link

Adding D support to GraalVM (via Sulong, its LLVM bitcode runtime) for polyglot apps, using LDC #3745

Open GavinRay97 opened 3 years ago

GavinRay97 commented 3 years ago

Heya =)

I'm interested in adding support for D into GraalVM so that D programs can interop with all of the other languages available on the platform:

image

The piece that enables this in GraalVM is "Sulong": https://github.com/oracle/graal/tree/master/sulong

Sulong is a high-performance LLVM bitcode runtime built on the GraalVM by Oracle Labs. ... With Sulong you can execute programming languages that can be transformed to LLVM bitcode on GraalVM. This includes languages like C/C++, Fortran, and others.

I don't have a good understanding of this platform yet, but I asked on the GraalVM slack about how to go about doing this, and the response I got was:

image

What is the process to enable "embedded bitcode" in LDC-produced binaries please 👀

kinke commented 3 years ago

Hey,

What is the process to enable "embedded bitcode" in LDC-produced binaries please

no idea, 1st time I hear about it. It's probably best to look at what clang does with -fembed-bitcode. If LLVM does the bulk of the work and no manual fiddling with embedding the bitcode as extra object file section (according to https://jonasdevlieghere.com/embedded-bitcode/) is required, it might be feasible without big effort, but I doubt it's that easy.

A much simpler variant would be using the bitcode directly (-output-bc for LDC), not sure if that's possible or planned for that GraalVM.

GavinRay97 commented 3 years ago

it might be feasible without big effort, but I doubt it's that easy.

These things never are, are they? ;^)

Thank you for the reply! I will dig into both of these and ask humbly for some more help from the GraalVM folks. Would be really amazing if we could get this working I think 😄