Dlang dynamic compilation
Johan Engelen via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Thu Nov 24 12:48:14 PST 2016
On Thursday, 24 November 2016 at 20:00:11 UTC, Ivan Butygin wrote:
> There are a lot of questions how this feature should interact
> with PGO/coverage analysis/debug info generation.
I would postpone these 3 issues, and just disable them for now if
it's too much work. Nice topics for future (!) work. :-)
Can @jit functions write to normal global variables? (DMD-style
coverage is just that; PGO is more involved because LLVM creates
the IR instructions for that)
> I need some more intelligent way to replace functions with
> thunks.
Looking at what you've achieved, I think you are more than
intelligent enough to come up with a great solution! :-)
Upon emitting a call to a function, you can detect that the
function is "@jit" and instead emit a functionptr call, right?
I think all that's needed is adding that functionality to `DValue
*call(...)` in gen/toir.cpp. It already has code for indirect
calls; so probably all you have to do is add a bit of code to
load from the function pointer that is written to by
`rtCompileProcess`.
I didn't check but if there isn't already, the functionptr should
be initialized with the address of a function that errors and
tells the user that the function is not yet compiled, _or_ a
function that starts JIT compilation and calls the desired
function afterwards.
(Hop on Gitter for an easier discussion of things :-)
-Johan
More information about the digitalmars-d-ldc
mailing list