You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4a9d30f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/SPEC.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1307,7 +1307,7 @@ All in `PM/commonTest`, so they run wherever the interpreter loads.
1307
1307
impure one; `ValueError` with the same message; augmented forms; INT and object operands; `bool` and
1308
1308
float operands skipped or `TypeError`. `Status: implemented`.
1309
1309
-**N-17** TypedPython AOT mode: a standalone build with no interpreter (#443; INTENT §1.4, maintainer
1310
-
decision 2026-11-16). `Status: planned, not implemented; design first`. A check-only mode exists (`python -m typedpython aot-check <entry.py>`): it builds nothing and reports every construct an AOT build would refuse, as an error or as pending with its tier (K, O, S or T), and a ready status per function (#446; agent proposal, not owner-confirmed). A first AOT build step exists (`python -m typedpython aot-build`): single-module programs with an `if __name__ == "__main__"` entry, scalar functions, native `list[float]` / `list[int]` values (counted, passed, returned and aliased by name), fixed tuples of scalars returned and unpacked, `print` with f-strings (`{e}` and `{e:.Nf}`), the conditional expression, `abs`, `min` and `max`, `len(sys.argv)`, and module constants (`NAME = <constant expression>`, also annotated `int`, `float` or `bool`), strict integers (an operation not proved inside 64 bits is `aot/int-unproven`, and so is `int(sys.argv[i])`: no run-time path differs from CPython), differential-tested against CPython (a variant of nbody with its size fixed in the source builds and prints what CPython prints; nbody, spectral_norm and fannkuch as they are, are refused only for `aot/int-unproven`); the front end and verifier read the file itself in an AOT mode that is off by default (#448, #451; agent proposal, not owner-confirmed). The library output exists (`python -m typedpython aot-lib <module.py> --export f,g --prefix <p> -o <dir>`): it writes a shared library, a C header and a JSON description of the same signatures (exports with int, float, bool and list arguments as counted handles, results through out pointers, a thread-local `<p>_last_error`, no library-wide lock), and is tested through a C-ABI consumer that compares every export with CPython (#455; owner decision D5 for its existence, shape per leader decisions of 2026-11-16, not owner-confirmed). The big-integer runtime exists (`runtime/tp_aot_int.h`), is not yet used by the back end, and is differential-tested against the reference interpreter (#460; design decision D1 (a), leader 2026-11-16, not owner-confirmed).
1310
+
decision 2026-11-16). `Status: planned, not implemented; design first`. A check-only mode exists (`python -m typedpython aot-check <entry.py>`): it builds nothing and reports every construct an AOT build would refuse, as an error or as pending with its tier (K, O, S or T), and a ready status per function (#446; agent proposal, not owner-confirmed). A first AOT build step exists (`python -m typedpython aot-build`): single-module programs with an `if __name__ == "__main__"` entry, scalar functions, native `list[float]` / `list[int]` values (counted, passed, returned and aliased by name), fixed tuples of scalars returned and unpacked, `print` with f-strings (`{e}` and `{e:.Nf}`), the conditional expression, `abs`, `min` and `max`, `len(sys.argv)`, and module constants (`NAME = <constant expression>`, also annotated `int`, `float` or `bool`), exact integers (#462; design decision D1 (a), leader 2026-11-16, not owner-confirmed): an int proved inside 64 bits is a plain `int64_t` and generates the code it always generated, and any other int is a small-int / big-integer value of `runtime/tp_aot_int.h`, with CPython's results, exception classes and messages for `+ - *`, `//`, `%`, comparisons (also with floats, exactly), `/` of two ints, `float()`, `abs`, `min`, `max`, `range` loops, list indexing, `print` and f-strings (the 4300-digit limit included), and `int(sys.argv[i])` for every argument (the reference's `repr` of the string in the message, non-UTF-8 bytes as the reference decodes them); `--strict-int` keeps the earlier rule that an operation not proved inside 64 bits is `aot/int-unproven`; a value not proved to fit 64 bits stored into a `list[int]` is `aot/int-list-store` (lists of big integers are the next step); differential-tested against CPython (spectral_norm.py and nbody.py as they are build and print what CPython prints for valid and invalid arguments; fannkuch.py is refused only for its two list stores; the three give the earlier `aot/int-unproven` sets under `--strict-int`); the front end and verifier read the file itself in an AOT mode that is off by default (#448, #451; agent proposal, not owner-confirmed). The library output exists (`python -m typedpython aot-lib <module.py> --export f,g --prefix <p> -o <dir>`): it writes a shared library, a C header and a JSON description of the same signatures (exports with int, float, bool and list arguments as counted handles, results through out pointers, a thread-local `<p>_last_error`, no library-wide lock; an `int` result that is outside 64 bits fails the call with an `OverflowError` that says so, an ABI-level rule with no counterpart in the source language, #462), and is tested through a C-ABI consumer that compares every export with CPython (#455; owner decision D5 for its existence, shape per leader decisions of 2026-11-16, not owner-confirmed). The big-integer runtime exists (`runtime/tp_aot_int.h`), is differential-tested against the reference interpreter (#460; design decision D1 (a), leader 2026-11-16, not owner-confirmed), and the back end includes it only in a program that has an int not proved inside 64 bits (#462).
1311
1311
-**Selection.** Opt-in per build; the default mode (N-1 to N-16, interpreted fallback) is unchanged.
1312
1312
-**Acceptance.** The whole program must pass the verifier. Every construct that the default mode would
1313
1313
leave interpreted or deopt from (unknown calls, unproven bounds or overflow without a compiled
|`int`not proved inside i64 | not exportable in a signature (compile error naming the parameter); the export must narrow it or return it as a string ||
|`int`held as a big-integer-capable value inside the function (#462) | A parameter arrives as `int64_t` and is converted where the compiled function holds it so. A result (also an element of a tuple) is converted back with a fit check: one that does not fit `int64_t` fails the call with -1 and the error record `OverflowError`, message "the int result of `<function>` does not fit in 64 bits", and no out value is written. The same call with smaller inputs succeeds. `abi_version` stays 1 (no signature changes) |`Long`; the failed call throws `TypedPythonAotException` as for any other error|
321
364
|`str`| pointer and length of UTF-8 bytes; an argument is borrowed for the call, a result is owned by the caller and released with `<prefix>_free`|`String`, copied at the boundary |
322
365
|`list[float]` / `list[int]`, as an argument and as a result | an opaque counted handle (`<prefix>_f64_list`, `<prefix>_i64_list`) made and read through exported list functions (`_new`, `_len`, `_data`, `_retain`, `_release`); an argument is borrowed for the call, a returned handle is owned by the caller | a class holding the handle, with `DoubleArray` / `LongArray` copied from or to the `_data` address as the app needs |
323
366
| an instance of a compiled class, or any other container | an opaque handle (a counted reference) with `<prefix>_release(handle)`| a Kotlin class holding the handle, released deterministically (`close`) with a cleaner as a safety net |
324
367
|`None` result |`void`|`Unit`|
325
368
369
+
The int rows are an agent proposal, not owner-confirmed (the representation they serve, design decision D1 (a), was
370
+
approved by the leader on 2026-11-16, not owner-confirmed). The result rule is an ABI-level rule with no counterpart in
371
+
the source language, like the null-handle `TypeError`: the source language's int has no limit and the C ABI's has, and
372
+
the generated header says so in its Errors paragraph (only for a library that has such a result; the header of a library
373
+
whose ints are all proved inside 64 bits is what it was). Lists of big integers do not cross the boundary in this step.
374
+
326
375
The list row is a leader decision of 2026-11-16, not owner-confirmed. Reason: an AOT list carries a 16-byte
327
376
header (count and length) before its elements, so a foreign array cannot be passed as it is; a handle
328
377
also keeps Python's list identity across calls (a function that returns its argument returns the same list,
0 commit comments