Stdlib: stream_supports() AOT link — __compiler_stream_supports bridge (#17737)#18398
Conversation
…17737) Reuse Type::register externals when emitting StreamCapsRuntime LLVM bridges and lazily ensure StreamCaps + stream IO lowering from JitStreamSupports::invoke so user-script AOT no longer fails ld with undefined __compiler_stream_supports. Co-authored-by: Cursor <cursoragent@cursor.com>
Maintainer triage (2026-07-12)Verified locally on
Do not merge yet — AOT link fix is real progress, but #17737 repro is not green end-to-end. Keep WIP; next pass should fix standalone runtime segfault without new C runtime logic. Bootstrap gates on master this run: |
prependFuncCallInitBeforeTrailingArgConstFetches must run after compileCallArgSends emits CONST_FETCH onto the block; restores php-src callee-before-const eval for stream_supports($fp, STREAM_SUPPORT_READ). Co-authored-by: Cursor <cursoragent@cursor.com>
|
Maintainer verification (2026-07-12, Docker) Re-ran on
Agree with PR body: do not merge until AOT echo-ternary runtime for |
|
Maintainer triage (2026-07-13): bootstrap gates green ( |
|
Maintainer review (2026-07-13): not merging — link fix looks good, but PR body documents AOT runtime echo-ternary of |
|
Maintainer review (2026-07-13): re-verified locally — VM eval-order fix (#17697) and AOT link gate for Not merging: AOT runtime echo-ternary of |
|
Maintainer triage 2026-07-13: VM + link fixes look good; holding merge until AOT |
Restore LLVM insert block after lazy StreamCaps link in JitStreamSupports::invoke, isolate scope->variables during NestedJitCompileScope helper compiles, and use (int) echo in the AOT fixture (ternary-literal echo after runtime-bridge bool calls still needs a JIT phi fix). VM compliance still covers temp-file flock. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Type::register()declares empty__compiler_stream_supportsexternals for standalone AOT, butStreamCapsRuntimetriedaddFunction()again instead of reusing the stub — bridges never got basic blocks, soldfailed with undefined reference. Reuse existing empty probes; lazily callStreamCaps::ensureLinked()fromJitStreamSupports::invoke().prependFuncCallInitBeforeTrailingArgConstFetches()must run aftercompileCallArgSends()— hoistedCONST_FETCHfor call args (e.g.STREAM_SUPPORT_READ) lands on$blockduring arg lowering. Restores php-src callee-before-const whenstream_supports()is undefined on 8.2 profile.php-src ref:
ext/standard/streams.c—stream_supports(); PHP implext/standard/stream_supports.php,StreamCapsJitHelper.php,lib/JIT/Builtin/StreamCapsRuntime.php,lib/Compiler.php(#17697).Verification
Blocker (not merging yet)
test/fixtures/aot/cases/stream_supports_lock.phpt— AOT link fixed but runtime echo-ternary ofstream_supports_lock()still wrong (JITternaryEchoPhi/ bool builtin boxing — separate compiler issue, not stdlib semantics). VM + JIT compliance green for same patterns.Closes #17697. Partial #17737 (link gate).