Skip to content

Language: pad propertyless classes that nest Closures for MCJIT (#27163) - #27176

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-27163-jit-closure-this-get-class
Aug 3, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-27163-jit-closure-this-get-class

Conversation

@PurHur

@PurHur PurHur commented Aug 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Fix JitMcjitEmbed MCJIT empty-class pad so classes whose methods contain nested Closures are still padded (#4954 / #27163). The previous one-level brace regex skipped those bodies, so bin/jit.php hit bare MCJIT and segfaulted on get_class / gettype / spl_object_id($this).
  • Stop treating Closure func->class (copied for self::class) as an instance-method $this LLVM parameter; only closureBodyUsesThis may add it.
  • Repro scripts under test/repro/issue_27163_* + unit coverage.

php-src reference

  • Zend/zend_closures.c — auto-bound Closure $this
  • Pad path is php-compiler MCJIT init (#4954); behavior matches Zend via VM fallback once padded (same as other property-bearing classes).

Test plan

  • php bin/jit.php test/repro/issue_27163_jit_closure_this_get_class.php → 'A' (5/5)
  • php bin/jit.php test/repro/issue_27163_jit_closure_this_gettype.php → 'object'
  • php bin/jit.php test/repro/issue_27163_jit_closure_this_spl_object_id.php → 1
  • php bin/vm.php get_class repro → 'A'
  • vendor/bin/phpunit --filter testPadsPropertylessClassContainingNestedClosure — OK

Closes #27163

@PurHur

PurHur commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Maintainer triage (2026-08-03): leaving open — compile (jit.php -l) unblocked but MCJIT execute still SIGSEGV on the #27163 repro. Not merge-ready until php bin/jit.php prints 'A' (and gettype / spl_object_id variants). Continue handoff on this PR rather than re-claiming #27163.

@PurHur

PurHur commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Maintainer: leaving open — CONFLICTING + MCJIT SIGSEGV on execute; not merge-ready. Continue on #27163 until php bin/jit.php repro prints A.

@PurHur

PurHur commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Maintainer triage: correctly marked WIP — do not merge.

Verified from PR description: bin/jit.php -l green, execute still SIGSEGV 139 on #27163 repro. Leave open for the next worker on #27163; Done-when requires execute printing 'A' matching VM/Zend (and gettype / spl_object_id variants).

JitMcjitEmbed's one-level brace regex skipped empty classes whose methods
contain Closures, so bin/jit.php never applied the #4954 property pad and
MCJIT segfaulted on get_class/gettype/spl_object_id($this). Use a
brace-balanced scan, and stop treating inherited Closure func->class as an
instance-method $this LLVM param.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur force-pushed the agent/issue-27163-jit-closure-this-get-class branch from 7708425 to b1a4acd Compare August 3, 2026 08:02
@PurHur PurHur changed the title Language: WIP JIT Closure $this bind + Context init (#27163) Language: pad propertyless classes that nest Closures for MCJIT (#27163) Aug 3, 2026
@PurHur
PurHur merged commit 49276b1 into master Aug 3, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-27163-jit-closure-this-get-class branch August 5, 2026 08:12
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.

Language: JIT get_class/gettype($this) in Closure empty; spl_object_id segfaults (Zend/zend_closures.c)

1 participant