llvm / llvm/llvm-project

Formalise JIT address / pointer / flags relationships.

Open
#175,715 5 comments 0 reactions 1 assignee Claimed by @lhames View on GitHub
orcjit
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

### Description

ORC supports cross process JIT compilation / linking. We call the process that defines and links the JIT'd program the _controller_, and the process that executes the JIT'd code the _executor_. To support this cross-process model ORC needs (at minimum) a target independent address type for JIT linker arithmetic.

ORC currently defines the following relevant types:

`ExecutorAddr`: a class wrapper around uint64_t, intended to represent addresses in the executing process. (see also `ExecutorAddrRange` and `ExecutorAddrDiff`).
`ExecutorSymbolDef`: a class wrapper around a pair of an ExecutorAddr and a JITSymbolFlags. This represents a linkable location that will also be associated with some symbol name. (E.g. SymbolMap is defined as `DenseMap`)

These types are replicated in the ORC runtime for use in out-of-process JIT setups.

There are some deficiencies in this design:

1. `ExecutorAddr` has `toPtr` / `fromPtr` operations but doesn't capture potentially relevant non-address aspects of pointers, e.g. tag bits, ARM thumb bit, pointer authentication bits, etc.
2. `ExectorSymbolDef` uses JITSymbolFlags, but JITSymbolFlags mixes linker flags and pointer flags in an ad-hoc way.
3. COMDATs are not supported at all.

In this issue I'd like to work towards a coherent, ergonomic design that addresses these deficiencies.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.