Skip to content

Stdlib JIT: iterator_to_array() LLVM lowering (phase 2 of #3100) #3179

Description

@PurHur

Category

stdlib / JIT

Problem

iterator_to_array() is VM-only (#3100 closed). ext/standard/iterator_to_array.php throws in call() for JIT. Generators and Traversable materialization are needed in JIT/AOT paths that call this builtin (e.g. spread/collection helpers).

Capability matrix: VM yes, JIT no, AOT no.

php-src reference

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php -r "function gen() { yield 1; yield 2; } echo count(iterator_to_array(gen()));"'

Today: JIT failure (VM-only call() stub).

Zend: 2

VM repro (works today):

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "function gen() { yield 1; yield 2; } echo count(iterator_to_array(gen()));"'

Scope (this repo)

Area Path
VM (done) ext/standard/iterator_to_array.php
JIT Lower to generator walk or call VM helper until #3074 generator JIT lands
AOT Same; register in self-host builtin policy
Tests test/compliance/cases/stdlib/iterator_to_array_jit.phpt
Matrix capability-matrix.php

Done when

Notes

Labels

stdlib, implementation-ready

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 / JITenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions