diff options
author | Dmitry Stogov <dmitry@zend.com> | 2017-06-22 01:45:28 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2017-06-22 01:45:28 +0300 |
commit | f25ecdacf805f840f743b67b6d84485b2deceb4f (patch) | |
tree | f8f6c7606287b952dcdf51e2ee9f528606bb9a2c /Zend/zend_objects_API.c | |
parent | 9fb0e6ffe29cc37b6b84a093d7438f0453cc1c41 (diff) | |
download | php-git-f25ecdacf805f840f743b67b6d84485b2deceb4f.tar.gz |
shutdown_executor() refactoring (reuse opcache fast request shutdown code)
Diffstat (limited to 'Zend/zend_objects_API.c')
-rw-r--r-- | Zend/zend_objects_API.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index 53a0c3be23..f838eddc97 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -76,7 +76,7 @@ ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects) } } -ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects) +ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects, zend_bool fast_shutdown) { zend_object **obj_ptr, **end, *obj; @@ -88,20 +88,37 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects end = objects->object_buckets + 1; obj_ptr = objects->object_buckets + objects->top; - do { - obj_ptr--; - obj = *obj_ptr; - if (IS_OBJ_VALID(obj)) { - if (!(GC_FLAGS(obj) & IS_OBJ_FREE_CALLED)) { - GC_FLAGS(obj) |= IS_OBJ_FREE_CALLED; - if (obj->handlers->free_obj) { - GC_REFCOUNT(obj)++; - obj->handlers->free_obj(obj); - GC_REFCOUNT(obj)--; + if (fast_shutdown) { + do { + obj_ptr--; + obj = *obj_ptr; + if (IS_OBJ_VALID(obj)) { + if (!(GC_FLAGS(obj) & IS_OBJ_FREE_CALLED)) { + GC_FLAGS(obj) |= IS_OBJ_FREE_CALLED; + if (obj->handlers->free_obj && obj->handlers->free_obj != zend_object_std_dtor) { + GC_REFCOUNT(obj)++; + obj->handlers->free_obj(obj); + GC_REFCOUNT(obj)--; + } } } - } - } while (obj_ptr != end); + } while (obj_ptr != end); + } else { + do { + obj_ptr--; + obj = *obj_ptr; + if (IS_OBJ_VALID(obj)) { + if (!(GC_FLAGS(obj) & IS_OBJ_FREE_CALLED)) { + GC_FLAGS(obj) |= IS_OBJ_FREE_CALLED; + if (obj->handlers->free_obj) { + GC_REFCOUNT(obj)++; + obj->handlers->free_obj(obj); + GC_REFCOUNT(obj)--; + } + } + } + } while (obj_ptr != end); + } } |