Zend: refactor zend_parse_arg_class() so that it can be reused - #23104
Zend: refactor zend_parse_arg_class() so that it can be reused#23104Girgias wants to merge 4 commits into
Conversation
1a4a653 to
10a9bf7
Compare
| /* old "C" */ | ||
| #define Z_PARAM_CLASS_EX(dest, check_null, deref) \ | ||
| Z_PARAM_PROLOGUE(deref, 0); \ | ||
| _error = dest ? ZSTR_VAL((dest)->name) : NULL; \ |
There was a problem hiding this comment.
Can we avoid saving this in the non-error case? This increases code size and the load adds overhead.
We could change zend_parse_arg_class() so that it returns a zend_class_entry* or NULL. This way we don't need to take the address of dest, which is inline with previous refactorings:
zend_class_entry *ce = dest;
dest = zend_parse_arg_class(_arg, ce, _i, check_null);
if (UNEXPECTED(!dest)) {
_error = ce ? ZSTR_VAL(ce->name) : NULL;
...
}
There was a problem hiding this comment.
That should work yeah. Those semantics will be quite weird.
I do think we should get rid of the "derived from" behaviour and introduce a custom FastZPP specifier for it that takes the CE explicitly rather than re-using the pointer for two different things. But that'll need to wait for PHP next I think as this affects extensions in non obvious ways.
There was a problem hiding this comment.
That's what zend_parse_arg_class() does in my code snippet :) (no re-use, ce is explicit). The semantics of Z_PARAM_CLASS_EX() doesn't change however.
And stop throwing the exceptions directly, fixing quiet mode handling at the same time.
c9d613f to
9342dba
Compare
And stop throwing the exceptions directly, fixing quiet mode handling at the same time.
Based on: #23052