diff options
author | Tyson Andre <tysonandre775@hotmail.com> | 2021-01-02 14:07:45 -0500 |
---|---|---|
committer | Tyson Andre <tysonandre775@hotmail.com> | 2021-01-02 16:10:14 -0500 |
commit | dfb9e03336fed7c4c07fb1a30a8be25cfbf546e4 (patch) | |
tree | 6ada3503f63bc7da91a6a1435264f1a6879775eb /Zend/zend_weakrefs.c | |
parent | 64c753e7c823848b55553dee4bdf1a3336fbc0f5 (diff) | |
download | php-git-dfb9e03336fed7c4c07fb1a30a8be25cfbf546e4.tar.gz |
Use Z_PARAM_OBJ macros when zval isn't needed
In some cases, like spl_object_id, the code is simpler but equally efficient
after optimizations.
In other cases, like get_mangled_object_vars(), the compiler can't infer that
the object in the zval won't change.
Closes GH-6567
Diffstat (limited to 'Zend/zend_weakrefs.c')
-rw-r--r-- | Zend/zend_weakrefs.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c index 85b56518ab..1d225f735b 100644 --- a/Zend/zend_weakrefs.c +++ b/Zend/zend_weakrefs.c @@ -181,8 +181,8 @@ static zend_object* zend_weakref_new(zend_class_entry *ce) { return &wr->std; } -static zend_always_inline zend_bool zend_weakref_find(zval *referent, zval *return_value) { - void *tagged_ptr = zend_hash_index_find_ptr(&EG(weakrefs), (zend_ulong) Z_OBJ_P(referent)); +static zend_always_inline zend_bool zend_weakref_find(zend_object *referent, zval *return_value) { + void *tagged_ptr = zend_hash_index_find_ptr(&EG(weakrefs), (zend_ulong) referent); if (!tagged_ptr) { return 0; } @@ -209,13 +209,13 @@ found_weakref: return 0; } -static zend_always_inline void zend_weakref_create(zval *referent, zval *return_value) { +static zend_always_inline void zend_weakref_create(zend_object *referent, zval *return_value) { zend_weakref *wr; object_init_ex(return_value, zend_ce_weakref); wr = zend_weakref_fetch(return_value); - wr->referent = Z_OBJ_P(referent); + wr->referent = referent; zend_weakref_register(wr->referent, ZEND_WEAKREF_ENCODE(wr, ZEND_WEAKREF_TAG_REF)); } @@ -245,10 +245,10 @@ ZEND_COLD ZEND_METHOD(WeakReference, __construct) ZEND_METHOD(WeakReference, create) { - zval *referent; + zend_object *referent; ZEND_PARSE_PARAMETERS_START(1,1) - Z_PARAM_OBJECT(referent) + Z_PARAM_OBJ(referent) ZEND_PARSE_PARAMETERS_END(); if (zend_weakref_find(referent, return_value)) { |