Py type context
py_type_context
TypeMap
Bases: NamedTuple
Correspondence between a Python type and its ctypes representation.
to_ctype / from_ctype convert values at call boundaries.
Source code in xdsl/jit/py_type_context.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
python_type: type[Any]
instance-attribute
Python type on the wrapped-function boundary.
ctype_type: type[Any]
instance-attribute
ctypes type used in the native CFUNCTYPE.
to_ctype: Callable[[Any], Any]
instance-attribute
Convert a Python argument to a ctypes-compatible value.
from_ctype: Callable[[Any], Any]
instance-attribute
Convert a ctypes result back to a Python value.
FuncTypeMap
Bases: NamedTuple
Per-argument and result :class:TypeMap entries for a function signature.
Source code in xdsl/jit/py_type_context.py
30 31 32 33 34 35 36 37 38 39 40 | |
arg_maps: tuple[TypeMap, ...]
instance-attribute
res_map: TypeMap
instance-attribute
c_func_type()
Return the CFUNCTYPE for this signature.
Source code in xdsl/jit/py_type_context.py
36 37 38 39 40 | |
PyTypeContext
Registry of Python types to :class:TypeMap entries.
Used to marshal values when wrapping a :class:RawJITFunc. Registrations must
agree with the frontend type mapping and with
:class:~xdsl.jit.c_type_context.CTypeContext for the same logical types.
Source code in xdsl/jit/py_type_context.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
__init__()
Source code in xdsl/jit/py_type_context.py
54 55 | |
register_type_map(type_map: TypeMap)
Register a :class:TypeMap for its python_type.
Source code in xdsl/jit/py_type_context.py
57 58 59 | |
type_map(python_type: type[Any]) -> TypeMap
Return the :class:TypeMap for python_type.
Source code in xdsl/jit/py_type_context.py
61 62 63 64 65 66 | |
func_type_map(signature: TypeForm[Callable[..., Any]]) -> FuncTypeMap
Build a :class:FuncTypeMap from a Callable signature.
Source code in xdsl/jit/py_type_context.py
68 69 70 71 72 73 74 75 76 77 | |