Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create persistent copies of classes when they are loaded, instead of when they are used #62

Open
dktapps opened this issue Aug 3, 2021 · 3 comments

Comments

@dktapps
Copy link
Member

dktapps commented Aug 3, 2021

Currently, pthreads makes copies of classes when a new thread is started. This is a problem for numerous reasons:

  • Static properties may have been modified, and since the default values of static properties are not retained (unless opcache is used), we cannot make clean copies of classes. This forces us to copy objects like Threaded objects and other things which might not be copyable, like resources. Resolved since PHP 8.1
  • In PHP 8.1, we will need to copy enum classes, which have object constants. This is problematic for the same reason - we can't conveniently copy objects (although we could copy the AST that instantiates them, but again, without opcache, this is typically not retained). Resolved by other means
  • Static variables of functions may have been modified (same problem as with static properties).

We can avoid all of these issues by copying the class to persistent memory when it is loaded, exactly the same way that OPcache does.

@polyphia
Copy link

Could this be related to #63 ?

@dktapps
Copy link
Member Author

dktapps commented Sep 13, 2021

This isn't a bug report, so it's not related that way, no.
I have no idea what's behind #63 since I haven't investigated it yet.

@polyphia
Copy link

Alright thanks for updating, just considering the possibitily of having to copy classes causing an extra delay in Pool::Submit , which seems to be aligned with the #63 issue disappearing when opcache cli is enabled .

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

No branches or pull requests

2 participants