rocq/backend/EmitObject.v
# Function objects
Every function has a getter, a generic entry and a function object, so that its address can be taken; an exported one also has the public alias of its implementation and a global getter. As filc_amd64.pl's function_object//5 and variadic_object//4. The generic entry adapts a packet of cells in the thread to the fast convention and the fast result back to a packet.
Adapter operands
Where an adapter reads a word of the fast call from: memory, a register, or the aux word at an offset of a promoted packet, which has no aux if %r13 is null.
As channel_offset/2: the thread offset of a generic cell's data or aux word.
As adapter_operand/3: for the area thread the cells are in the thread at %rbx; for snapshot they are in the promoted packet at %r12.
As snapshot_load//2: the operand into %rax.
As adapter_load//3: a single is the low half of its word.
A word of the adapter's fast call and its operand.
As adapter_stack//3: the words that travel on the stack, through %rax, which is the only scratch register.
As adapter_registers//3: an integer register takes a word in memory directly.
The generic result
As generic_zeroings//1.
As generic_reg_stores//2: each result register at its thread offset.
As generic_buffer_copies//2: each word of the return buffer, from off(%rsp) on, to its thread offset.
As typed_ret_kind/3: a pointer of a returned tuple is two integer words.
As generic_typed_gprs//2 and generic_typed_xmms//2, over the registers result_registers/2 gives the words.
As generic_reg_results//2: the result words from their registers to their thread offsets; a void result is one zero word.
The thread offsets of sources; None if one is not a cell.
As generic_entry_call//6: the call of the fast entry of the function object in %rsi, then the result into the packet and its size in %edx. An exception skips the result.
The failure of an entry given fewer than need bytes of arguments.
As generic_entry//2: {i1, i64 ret_size} (thread, callee_lower, args_size).
As variadic_adapter//3: the generic entry of a variadic function, which promotes its packet to the heap and passes the snapshot to the private fast body, whose object is body. The promotion is the only exiting call before the body roots the snapshot.
The object
S + 16, the address of the payload of the object s.
As aux_bits/2 of [global, readonly, function].
As object_getter//2: the getter of the function object fo gives its flight pointer, whose lower is its address, in %rax and %rdx.
As function_object_data//4: the object with its entries (a symbol, or 0 for none) and its signature. Its header has upper = lower, so it cannot be read or written, and an aux word that points at itself.
A function's linkage.
| | | LkExport | ||
| | | LkLocal | ||
| | | LkWeak | ||
| | | LkOther |
As linkage_alias//4: an exported function has the public alias fi of its implementation and a global getter; a weak one has a weak getter and no alias, since callers elsewhere go through their thunks to whichever definition the linker keeps.
As function_object//5. The object of a function that is not local names its fast entry by a local alias, since a global implementation symbol is preemptible and the dynamic linker would bind the word to the first definition of the name.
As variadic_object//4: a variadic function has a generic entry only, which is public, and a private fast body.
As body_function_object//4.