ORC JIT Weekly #25 -- Orc library break-up, remote TargetProcessControl review.

Hi All,

Now that OrcV1 has been removed we can look at landing the new Remote TargetProcessControl utilities that have been under development for the last couple of months. I have posted an initial patch for review in https://reviews.llvm.org/D90132.

The aim of these utilities is to make it easy to execute JIT’d code in a separate process from the JIT itself. This can be useful for both stability (if you don’t want a crash in your JIT’d code taking down your JIT process or vice versa) and security (you can sandbox your JIT’d code separately from the JIT itself).

The patch contains:

(1) A break-up of the OrcJIT library into three parts: OrcJIT, OrcTargetProcess, and OrcShared. I’ll follow up with details on this tomorrow, but in short: This break-up will allow target processes to link against OrcTargetProcess and Support only, rather than OrcJIT (and, consequently, Object, Core, IRReader, etc.), which should allow for much smaller target process executables.

(2) An OrcRPC based TargetProcessControl implementation that can be used to JIT code into a target process connected via an OrcRPC endpoint. The llvm-jitlink utility has been updated to include a demonstration of this (see the -oop-executor example in [1], Orc JIT Weekly #21 for usage notes).

(3) An OrcRPC based server that can be linked into a target process to allow remote code to be received and executed. You can see an example of this in the patch in the newly added llvm-jitlink-executor program.

Parts (2) and (3) can be thought of as the OrcV2 equivalent of the OrcV1 OrcRemoteTargetClient/OrcRemoteTargetServer classes.

I expect there will be a few bugs to shake out, but once this lands we will be able to reinstate Chapter 5 of the BuildingAJIT tutorial series, which should provide another nice example of how to use these APIs.

As for other tasks on the todo list: I haven’t forgotten the requests for documentation and road-maps. They’re next on my list once this work lands.

Regards,
Lang.

[1] http://lists.llvm.org/pipermail/llvm-dev/2020-September/145070.html