sun::driver::SunJIT

sun::driver::SunJIT

class · Source (opens in a new tab)

class sun::driver::SunJIT

The ORC JIT behind sun file.sun: one dylib, host-targeted, resolving unknown symbols from the compiler's own process.

The object-linking layer is JITLink on every platform, so the JIT has one linker's behavior to test and one set of quirks to learn. (RuntimeDyld is not an option: its Mach-O support is legacy and mishandles arm64 unwind sections.)

Public Functions

Create

public · function · static · Source (opens in a new tab)

static Expected< std::unique_ptr< SunJIT > > sun::driver::SunJIT::Create(bool optimize=true)

Create a host JIT with the requested backend optimization setting.

Related: SunJIT

SunJIT

public · function · Source (opens in a new tab)

sun::driver::SunJIT::SunJIT(std::unique_ptr< ExecutionSession > ES, JITTargetMachineBuilder JTMB, DataLayout DL)

Creates a JIT engine using the execution session and target data layout.

addModule

public · function · Source (opens in a new tab)

Error sun::driver::SunJIT::addModule(ThreadSafeModule TSM, ResourceTrackerSP RT=nullptr)

Adds an LLVM module to the JIT under the supplied resource tracker.

addStaticLibrary

public · function · Source (opens in a new tab)

Error sun::driver::SunJIT::addStaticLibrary(const std::string &Path)

Resolve symbols out of a native static library (.a), the way the AOT linker would.

Used for archives carried inside .moon bundles.

getDataLayout

public · function · Source (opens in a new tab)

const DataLayout & sun::driver::SunJIT::getDataLayout() const

Returns the data layout stored by this object.

getExecutionSession

public · function · Source (opens in a new tab)

ExecutionSession & sun::driver::SunJIT::getExecutionSession()

Returns the execution session stored by this object.

getMainJITDylib

public · function · Source (opens in a new tab)

JITDylib & sun::driver::SunJIT::getMainJITDylib()

Returns the JIT symbol table for the main program.

getTargetTriple

public · function · Source (opens in a new tab)

const Triple & sun::driver::SunJIT::getTargetTriple() const

Returns the target triple stored by this object.

lookup

public · function · Source (opens in a new tab)

Expected< ExecutorSymbolDef > sun::driver::SunJIT::lookup(StringRef Name)

Finds the address of a symbol available to the JIT.

mangle

public · function · Source (opens in a new tab)

SymbolStringPtr sun::driver::SunJIT::mangle(StringRef Name)

The symbol-table spelling of a C-level name on this platform (Mach-O adds a leading underscore).

Definitions handed to the JIT must use it, or JIT'd code referencing the name will not find them.

~SunJIT

public · function · Source (opens in a new tab)

sun::driver::SunJIT::~SunJIT()

Ends the JIT execution session and releases its resources.

Private Functions

makeObjectLayer

private · function · static · Source (opens in a new tab)

static std::unique_ptr< ObjectLayer > sun::driver::SunJIT::makeObjectLayer(ExecutionSession &ES)

Build the JITLink object layer.

Eh-frame registration lets thrown Sun errors unwind through JITed frames. (If exception interop proves incomplete on Apple Silicon, the known next step is MachOPlatform with the ORC runtime, which also registers compact-unwind info.) The debug object plugin hands each JITed ELF object to gdb's JIT interface so -g modules are debuggable under the JIT; it is a no-op when no debugger is attached and for non-ELF objects.

Private Fields

CompileLayer

private · variable · Source (opens in a new tab)

IRCompileLayer sun::driver::SunJIT::CompileLayer

No documentation comment.

DL

private · variable · Source (opens in a new tab)

DataLayout sun::driver::SunJIT::DL

No documentation comment.

ES

private · variable · Source (opens in a new tab)

std::unique_ptr<ExecutionSession> sun::driver::SunJIT::ES

No documentation comment.

MainJD

private · variable · Source (opens in a new tab)

JITDylib& sun::driver::SunJIT::MainJD

No documentation comment.

Mangle

private · variable · Source (opens in a new tab)

MangleAndInterner sun::driver::SunJIT::Mangle

No documentation comment.

ObjLayer

private · variable · Source (opens in a new tab)

std::unique_ptr<ObjectLayer> sun::driver::SunJIT::ObjLayer

No documentation comment.

TT

private · variable · Source (opens in a new tab)

Triple sun::driver::SunJIT::TT

No documentation comment.