Skip to content

Fix self-host link TypeError on NestedJIT :HashTable refresh (#21888) - #21904

Merged
PurHur merged 2 commits into
masterfrom
agent/runtime-php-superglobal-refresh-hashtable-return-21888
Jul 21, 2026
Merged

PurHur merged 2 commits into
masterfrom
agent/runtime-php-superglobal-refresh-hashtable-return-21888

Conversation

@PurHur

@PurHur PurHur commented Jul 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #21888

Follow-up: Zend gen-0 still SIGSEGVs later at M3EmitTuTrivialEchoAot.php — classified pre-existing (#21925).

php-src reference

PHP implementation

  • lib/JIT/Builtin/SuperglobalRefreshRuntime.php — always kernel for standalone
  • lib/JIT/ClassReturnCheck.php — isVmHashTableClass / enforceVmHashTableReturn
  • Zend/VM SSOT unchanged: lib/Web/Superglobals.php + SuperglobalRefreshJitHelper unit tests

C runtime

  • No new runtime/*.c. Removed NestedJIT bridge call sites (net PHP LOC ↓ ~100 in SuperglobalRefreshRuntime.php).

Test plan / verification

@PurHur

PurHur commented Jul 21, 2026

Copy link
Copy Markdown
Owner Author

Maintainer review (2026-07-21)

Unit (host, PR tree):

  • ClassReturnCheckHashTableTest — OK
  • SuperglobalRefreshRuntimeShrinkTest — OK (6)
  • SuperglobalRefreshKernelShrinkTest — OK (3)
  • Web/SuperglobalRefreshJitHelperTest — OK (4)
  • JIT/SuperglobalsRefreshRuntimeStandaloneTest — needs LLVM in Docker (host skipped)

Link gate: re-running make bootstrap-selfhost-link on this PR tip (detached) via docker-exec — checking that Zend gen-0 no longer dies with buildGetTable(): … HashTable, int returned (#21888). Will merge if that symptom is gone.

@PurHur

PurHur commented Jul 21, 2026

Copy link
Copy Markdown
Owner Author

Link verify update (PR tip 3c37d74)

make bootstrap-selfhost-link on this PR (detached checkout + docker-exec):

  1. Stale gen-0 → Zend fallback (same as master)
  2. buildGetTable(): … HashTable, int returned is gone — Gen-1+ #1492: bootstrap-selfhost-link Zend gen-0 — SuperglobalRefreshJitHelper::buildGetTable returns int not HashTable #21888 symptom fixed
  3. New failure ~11 min into Zend gen-0 compile:
phpc: fatal signal (segfault) after c:include:/compiler/lib/JIT/M3EmitTuTrivialEchoAot.php
make: *** [Makefile:298: bootstrap-selfhost-link] Error 139

Not merging yet — link still red (different failure). Next: confirm whether this segfault reproduces on clean master after #21886/#21908, or is introduced by the kernel-only refresh path. PHP_COMPILER_LLVM_ASSERT=1 / gdb on that include recommended.

…21888).

Route standalone __superglobals__refresh through JitSuperglobalRefreshKernel
(same as user-script) and accept VM HashTable ABI in ClassReturnCheck so
self-host stubs no longer abort with "HashTable, int returned".

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur force-pushed the agent/runtime-php-superglobal-refresh-hashtable-return-21888 branch from 3c37d74 to 94d47ac Compare July 21, 2026 18:09
@PurHur
PurHur force-pushed the agent/runtime-php-superglobal-refresh-hashtable-return-21888 branch from 94d47ac to 53360a3 Compare July 21, 2026 18:48
).

Route environ checks through phpc_getenv_kernel so Zend gen-0 compiler_minimal
binaries survive ScriptExit flush instead of crashing in isWebResponseEnvPresent.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur

PurHur commented Jul 21, 2026

Copy link
Copy Markdown
Owner Author

Segfault classification (pre-existing / unblocked by #21888)

Reproduced on rebased tip 53360a3dd with BOOTSTRAP_GEN0_ZEND_ONLY=1 make bootstrap-selfhost-link (+ PHP_COMPILER_LLVM_ASSERT=1):

Tree #21888 TypeError Outcome ~12–13 min
PR (kernel-only refresh + ClassReturnCheck) gone SEGV after c:include:…/M3EmitTuTrivialEchoAot.php (Error 139)
ClassReturnCheck-only (NestedJIT SuperglobalRefreshRuntime restored from master) gone same SEGV at same include

Conclusion: M3EmitTu SEGV is not introduced by retiring the NestedJIT refresh bridge. ClassReturnCheck HashTable ABI accept alone clears buildGetTable(): … int returned; the SEGV is the next latent Zend gen-0 failure once that abort is removed.

Follow-up: #21925

Unit (Docker): ClassReturnCheckHashTable / SuperglobalRefresh* shrink+standalone / SuperglobalRefreshJitHelper — green.

Merging for #21888 TypeError fix; link completion tracked on #21925.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gen-1+ #1492: bootstrap-selfhost-link Zend gen-0 — SuperglobalRefreshJitHelper::buildGetTable returns int not HashTable

1 participant