TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3.2 KiB
3.2 KiB
TypePHP OS roadmap
This directory is a long-running experiment. Every milestone must remain bootable in QEMU and must not change ordinary TypePHP, PHPX, or PHP Nano behavior.
Architecture rules
- The project is an ordinary
tpc --nanoconsumer. tpc has no kernel option, and PHP Nano has no kernel source profile. - PHP and Composer remain build-time tools; the kernel never links
libphp. - Keep copied php-src C/H files unchanged and compile the complete Nano source manifest. TypePHP OS owns the required libc/POSIX and C++ ABI boundary.
- Missing ABI operations must be linkable panic stubs. Replace each stub with a real kernel service before exposing the corresponding PHP capability.
- Cross-project changes must use generally useful portability contracts such
as
PHP_NANO_NO_LIBC,PHPX_NO_EXCEPTION, andPHPX_NO_RTTI; product-specific conditionals are not allowed in PHP Nano or PHPX. - Ordinary same-ABI source files and flags belong in
project.yml. Translation units that require incompatible per-file options are built by Make and may be linked through tpc's genericobjectsfacility when their ABI matches. Architecture packaging and ELF/binary conversion happen after tpc emits the 64-bit ELF. - Every completed milestone must pass the serial-output QEMU smoke test and leave the 64-bit payload with no undefined symbols.
Milestones
- Boot and scalar AOT — complete. Multiboot v1 bootstrap, x86_64 long mode, VGA/COM1 output, TypePHP scalars, functions, and control flow.
- Memory and Zend containers — complete. Physical arena, TypePHP OS ABI
layer, original
zend_alloc,zend_gc,zend_string,zend_hash, zval destruction, and generated TypePHP arrays/strings through PHPX. - Zend object model — complete for the current demo. Original object store, class entries, inheritance, interfaces, handlers, PHP exception classes, generated user classes, construction, properties, and destruction.
- Time service — complete. CMOS wall clock, monotonic host hook, built-in
date formatting, and the standard extension's
sleep()path. - Filesystem — first slice complete. ATA PIO, a persistent FAT16 image, TypePHP-owned cluster/directory/file logic, file descriptors, POSIX directory/stat operations, and PHP's local file stream API. The current implementation is intentionally limited to root-level DOS 8.3 names; nested directories and long filenames are next.
- Single-task userspace — first slice complete. ELF64 validation/loading,
supervisor/user page separation, GDT/TSS, Ring-3 entry, synchronous
int 0x80system calls, COM1 standard I/O, saved parent context, and independent freestanding Csh,ls, andcdprograms. - Native Class memory. Exercise Wren GC through Zend MM and verify tracing of PHPX fields under sustained allocation.
- Kernel services. Interrupt-driven timer, keyboard, physical-page reclamation, and a capability-oriented native API.
- Packaging and CI. Automate the two-stage ELF32/ELF64 build and QEMU boot smoke test in GitHub Actions.
Later architectures may provide different bootstraps and host ABI adapters. Generated TypePHP code and PHPX values remain 64-bit on every target.