Skip to content

Zend: derive lazy object initializer callble from FCC - #24000

Merged
Girgias merged 4 commits into
php:masterfrom
Girgias:2026-09-lazy-initializer
Oct 10, 2026
Merged

Girgias merged 4 commits into
php:masterfrom
Girgias:2026-09-lazy-initializer

Conversation

@Girgias

@Girgias Girgias commented Sep 29, 2026

Copy link
Copy Markdown
Member

Based on #23998.

We do not need the initializer zval as we can derive it from the initializer FCC. This means we can save some space for the struct.

The only thing this seems to change is the GC behaviour which I don't fully understand, so I currently marked that test as XFAIL.

@Girgias
Girgias force-pushed the 2026-09-lazy-initializer branch from 7a195a6 to 5002906 Compare October 1, 2026 12:06
@Girgias
Girgias marked this pull request as ready for review October 5, 2026 11:58
@Girgias
Girgias requested a review from arnaud-lb October 5, 2026 11:58

@DanielEScherzer DanielEScherzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on the reflection code for lazy objects, but I'm a bit worried that the xfail test is now failing, so not marking this as approved

but, as for as ext/reflection is concerned, if those who know about lazy objects are okay with this, no strong objections from me

@Girgias

Girgias commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

I'm waiting for Arnaud to have a look on the Lazy Object side, I think the reason is that a destructor is now fired earlier because we no longer store an extra zval reference to it. But that's just a theory.

Trigger GC explicitly during lazy object realization instead of relying on
buffer size trigger.

@arnaud-lb arnaud-lb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

I've fixed the test: It was relying on the GC to be triggered exactly in zend_lazy_object_info_dtor_func(), but this wasn't happening anymore.

@Girgias
Girgias merged commit 269eff6 into php:master Oct 10, 2026
18 checks passed
@Girgias
Girgias deleted the 2026-09-lazy-initializer branch October 10, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants