serene/libserene/include/serene/jit
Sameer Rahmani 1d2eebe680 Create a PoC to setup the stdlib calls via serene.core 2022-07-23 11:09:15 +01:00
..
README.org Move and strip the jit engine to the v1 2022-06-14 15:56:57 +01:00
halley.h Create a PoC to setup the stdlib calls via serene.core 2022-07-23 11:09:15 +01:00

README.org

Serene JIT

SereneJIT

Development Notes

Steps to take

You usually want a custom MaterializationUnit for your program representation, and a custom Layer. The Layer will have two operations: add and emit. The add operation takes an instance of your program representation, builds one of your custom MaterializationUnits to hold it, then adds it to a JITDylib. The emit operation takes a MaterializationResponsibility object and an instance of your program representation and materializes it, usually by compiling it and handing the resulting object off to an ObjectLinkingLayer.

Your custom MaterializationUnit will have two operations: materialize and discard. The materialize function will be called for you when any symbol provided by the unit is looked up, and it should just call the emit function on your layer, passing in the given MaterializationResponsibility and the wrapped program representation. The discard function will be called if some weak symbol provided by your unit is not needed (because the JIT found an overriding definition). You can use this to drop your definition early, or just ignore it and let the linker drop the definition later.