Skip to content

Language: Fiber JIT/AOT — native suspend/resume (phase 2 of #3130) #4019

Description

@PurHur

Category

language / runtime

Problem

#3130 delivered VM-only Fiber (Fiber::suspend(), start(), resume(), getCurrent()). script/capability-syntax-lib.php still marks fiber_suspend as JIT=no / AOT=no. Self-host and bin/jit.php / phpc build paths that use cooperative scheduling therefore fall back to VM or fail when fibers appear in hot code.

php-src reference

Repro (gap today)

<?php
$fiber = new Fiber(function (): void {
    Fiber::suspend('ok');
});
echo $fiber->start(), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php /tmp/fiber.php          # VM: ok
php bin/jit.php /tmp/fiber.php 2>&1    # JIT: compare output / fallback
'
Backend Expected (Zend parity) Today
VM ok ✅ (#3130)
JIT ok ❌ not lowered — capability row JIT=no
AOT ok ❌ capability row AOT=no

Scope (this repo)

Layer Files
VM reference lib/VM/FiberState.php, lib/VM.php (startFiber / resumeFiber)
JIT lib/JIT.php, new lib/JIT/FiberSupport.php or builtin dispatch — suspend saves frame; resume restores
AOT lib/AOT/ — immortal fiber context or VM callback trampoline
Tests test/compliance/cases/language/fiber_jit.phpt, test/fixtures/aot/cases/fiber_suspend.phpt
Matrix script/capability-syntax-lib.php — set jit/aot true when green

Phase 1: single-fiber suspend/resume in script scope (no nested fibers). Defer: Fiber::getReturn(), throwing across suspend, concurrent fibers.

Done when

  • Repro prints ok under bin/jit.php and AOT binary (same as VM)
  • fiber_suspend row in docs/capabilities-syntax.md shows JIT/AOT yes
  • ./script/ci-fast.sh --filter Fiber green (or targeted compliance file)

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITarea:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions