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

cache function names and file names #84

Closed
sj-i opened this issue Sep 16, 2021 · 2 comments · Fixed by #217
Closed

cache function names and file names #84

sj-i opened this issue Sep 16, 2021 · 2 comments · Fixed by #217

Comments

@sj-i
Copy link
Member

sj-i commented Sep 16, 2021

  • function names and file names can be retrieved from zend_function_entry
  • they can be cached by using the address of zend_function_entry as a key at least in CLI
  • in mod_php or fpm, the cache must be invalidated per request
@sj-i
Copy link
Member Author

sj-i commented Feb 16, 2022

sapi_globals is a public symbol that remains in the stripped binary. Its members include global_request_time, which is filled with a timestamp in the request initialization sequence in SAPI. We can use it to detect request boundaries. Then, we can retrieve the function name, class name, and file name from a cache by simply looking at the address value of zend_execute_data.func. It is also probably possible to have a reasonably high hit rate cache for opline as well.

This is another way to reduce the number of calls to process_vm_readv() significantly #158

This resolves #63 also.

@sj-i
Copy link
Member Author

sj-i commented Feb 16, 2022

Note that global_request_time is microseconds from the UNIX epoch in both mod_php and fpm.

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 a pull request may close this issue.

1 participant