Engee documentation

Call Agreements

Julia uses three calling conventions for four different purposes:

Title The prefix Appointment

Own

julia_

Speed due to specialized signatures

JL Call

jlcall_

A shell for universal calls

JL Call

jl_

Built-in functions

C ABI

jlcapi_

A shell called from C

Julia’s own call agreement

The proprietary calling agreement is designed for fast non-universal calls. As a rule, it uses a specialized signature.

*LLVM phantom instances (zero-length types) are omitted. *LLVM scalars and vectors are passed by value. *LLVM aggregates (arrays and structures) are passed by reference.

A small return value is returned as an LLVM return value. Large return values are returned by the "structure return" convention (sret), where the caller provides a pointer to the return slot.

An argument or return values that are a homogeneous tuple are sometimes represented as an LLVM vector instead of an LLVM array.

JL Call Agreement

The JL Call agreement is intended for embedded modules and general dispatching. Handwritten functions using this convention are declared using the macro `JL_CALLABLE'. The agreement uses exactly three parameters:

*F — representation in Julia of the function used *args — pointer to an array of pointers to heaps *nargs — length of the array.

The return value is a pointer to the heap.

C ABI

The C ABI wrappers allow you to call Julia from C. The shell invokes the function using its own calling convention.

Tuples are always represented as arrays of C.