-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[opcache] [jit] Attribute support #5915
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
Conversation
@dstogov This is my attempt at Attribute support for JIT. Looking forward for your feedback. |
I think we need some more clarity on what we expect these attributes to actually be useful for. Is the attribute trigger mode something purely for debugging, so one can JIT one function out of a large code base easily? |
@nikic I agree, More consistent would probably be to remove the trigger=attribute completly, and have the |
void zend_jit_validate_opcache_attribute(zend_attribute *jit, uint32_t target, zend_class_entry *scope) | ||
{ | ||
if (jit->argc > 1) { | ||
zend_error(E_COMPILE_ERROR, "@@Jit requires zero or one argument, %d arguments given", jit->argc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems inconsistent to emit E_COMPILE_ERROR with opcache but not without opcache. I'd personally prefer E_WARNING like some of the other warnings about failing to optimize.
- And to return early but proceed with optimizing the file anywhere where the attribute is seen with invalid count or argument types
ext/opcache/zend_accelerator_module.c
893: zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " could not compile file %s", handle.filename);
Also, zend_error
proceeds with execution after being called. You may want zend_error_noreturn(E_COMPILE_ERROR,
if the intent is actually to make php stop executing - I don't know if that actually works in the opcache step, though
@dstogov can you comment please? Looking to merge this tomorrow morning (Europe time) |
looks good, but I would remove |
I think it would be good to bring this up on the mailing list. I'm still not completely clear on what the use-case for them will be, and I'm also a bit uncomfortable with adding a global |
@nikic from am APM perspective my primary use case is I would be willing to hold this off until 8.1 to discuss the implications and use-cases in more detail, if extensions get another way to selectively control the JIT. The positive use case of enabling the JIT for certain functions I can see when code gets microoptimized towards the JIT, then maybe a human makes better decisions on what function should be jitted, and which ones not. |
@dstogov One question I just had, if I wanted to disable the JIT for selected functions: It is now possible for an extension to use |
f3e09f0
to
1192b51
Compare
@dstogov ping, sorry for being pushy :-( |
Remove the obsolete doc-comment based JIT trigger. Since function and tracing JITs are recommended for now, the attribute based trigger mode is removed for now. Only @@jit("off") is available to disable the JIT for a function/method.
1192b51
to
ee82318
Compare
Remove the obsolete doc-comment based JIT trigger. Since function and
tracing JITs are recommended for now, the attribute based trigger mode
is removed for now.
Only
@@jit("off")
is available to disable the JIT for a function/method.Open Questions:
,
@@jit("tracing")and
@@jit("function")` for now to thoroughly discuss best approach for 8.1?@@Jit
to something more specific like@@JitOptions
,@@JitConfig
or@@JitHint
?