Function
function
P = ParamSpec('P')
module-attribute
R = TypeVar('R')
module-attribute
CFunc
Bases: Protocol
A callable native function pointer.
Source code in xdsl/jit/function.py
11 12 13 14 | |
__call__(*args: Any, **kwargs: Any) -> Any
Source code in xdsl/jit/function.py
14 | |
CFuncType
Bases: Protocol
A ctypes function-pointer type.
Source code in xdsl/jit/function.py
17 18 19 20 21 22 23 24 25 26 27 | |
RawJITFunc
dataclass
A jitted function exposed as a ctypes callable.
Backends may subclass this to retain native runtime state that must outlive
calls through c_func.
Source code in xdsl/jit/function.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
c_func_type: CFuncType
instance-attribute
The CFUNCTYPE describing the native calling convention.
c_func: CFunc
instance-attribute
Bound ctypes function object for the native entry point.
__init__(c_func_type: CFuncType, c_func: CFunc) -> None
WrappedJITFunc
dataclass
A Python-callable wrapper around a :class:RawJITFunc.
Invoking the instance marshals arguments to ctypes, calls the native function, and converts the result back to a Python value.
Source code in xdsl/jit/function.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
raw_func: RawJITFunc
instance-attribute
Underlying ctypes binding.
original_func: Callable[P, R]
instance-attribute
The undecorated Python function.
__call__: Callable[P, R]
instance-attribute
Marshaling entry point for calls.
__init__(raw_func: RawJITFunc, original_func: Callable[P, R], __call__: Callable[P, R]) -> None
wrap_jit_func(raw_func: RawJITFunc, original_func: Callable[P, R], signature: TypeForm[Callable[P, R]], py_type_context: PyTypeContext) -> WrappedJITFunc[P, R]
Wrap a :class:RawJITFunc as a :class:WrappedJITFunc.
Builds argument/result converters from signature and checks that the
resulting CFUNCTYPE matches raw_func.c_func_type.
Source code in xdsl/jit/function.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |