infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
infix_executable_t Struct Reference

Internal representation of an executable memory block for JIT code. More...

#include <infix_internals.h>

Public Attributes

int shm_fd
 
voidrx_ptr
 
voidrw_ptr
 
size_t size
 

Detailed Description

Internal representation of an executable memory block for JIT code.

This struct encapsulates the platform-specific details of allocating and managing executable memory in a way that is compliant with modern OS security features like W^X (Write XOR Execute). It supports two primary strategies:

  1. Single-Mapping W^X (Windows/macOS/Android): A single memory region is allocated as Read-Write (rw_ptr). After the JIT compiler writes the machine code to this region, its permissions are changed to Read-Execute. In this model, rx_ptr and rw_ptr point to the same address.
  2. Dual-Mapping W^X (Linux/BSD): A single underlying shared memory object is mapped into the process's address space twice: once as Read-Write (rw_ptr) and once as Read-Execute (rx_ptr). The pointers have different virtual addresses but point to the same physical memory. This is required on systems with stricter W^X enforcement.

Member Data Documentation

◆ rw_ptr

void* infix_executable_t::rw_ptr

The read-write memory address. The JIT compiler writes machine code here.

◆ rx_ptr

void* infix_executable_t::rx_ptr

The read-execute memory address. This is the callable function pointer.

◆ shm_fd

int infix_executable_t::shm_fd

The file descriptor for shared memory on dual-mapping POSIX systems. -1 otherwise.

◆ size

size_t infix_executable_t::size

The size of the allocated memory region in bytes.


The documentation for this struct was generated from the following file: