Skip to content

Fix DECLARE_TRAIT MCJIT segfault — defer to VM lowering (#6284)#7046

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-6284-trait-mcjit-embed
Jun 6, 2026
Merged

Fix DECLARE_TRAIT MCJIT segfault — defer to VM lowering (#6284)#7046
PurHur merged 1 commit into
masterfrom
agent/issue-6284-trait-mcjit-embed

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented Jun 6, 2026

Summary

This extends the existing trait-__construct deferral gate to all trait declarations, fixing bin/jit.php -l on empty traits without touching runtime/*.c.

Remaining (follow-up for native MCJIT)

  • Trait constructor promotion still VM-fallbacks via containsTraitConstructorOpcodes() (redundant but harmless).
  • TraitConstructorJitExecuteTest stays skipped until lib/JIT/ DECLARE_TRAIT MCJIT link is fixed.

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/jit.php -l test/repro/trait_empty_mcjit_probe.php; echo exit:$?
php bin/jit.php test/repro/trait_empty_mcjit_probe.php
vendor/bin/phpunit test/unit/TraitEmptyMcjitCompileTest.php --group llvm
'

Output:

exit:0
ok
OK (3 tests, 11 assertions)

Closes #6284

Made with Cursor

Empty trait compilation units segfaulted bin/jit.php -l because MCJIT
link ran before DECLARE_TRAIT lowering was stable. Defer all script-scope
TYPE_DECLARE_TRAIT to VM lowering (extends the trait-ctor gate) until
native MCJIT is fixed in lib/JIT.php.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 7786e14 into master Jun 6, 2026
@PurHur PurHur deleted the agent/issue-6284-trait-mcjit-embed branch June 6, 2026 19:04
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.

1 participant