diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-04-02 14:34:44 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-04-02 14:34:44 +0400 |
commit | d8099d0468426dbee59f540048376653535270ce (patch) | |
tree | 133021a1fda6a2453efcd9a279e9b0a55c006396 /Zend/zend_objects_API.c | |
parent | 3b25faa4aa844bce12b1cbb3a3938573965df485 (diff) | |
download | php-git-d8099d0468426dbee59f540048376653535270ce.tar.gz |
Changed data layout to allow more efficient operations
Diffstat (limited to 'Zend/zend_objects_API.c')
-rw-r--r-- | Zend/zend_objects_API.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index be215ed086..a65b4a993e 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -48,11 +48,11 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS zend_object *obj = objects->object_buckets[i]; if (IS_VALID(obj)) { - if (!(obj->gc.u.v.flags & IS_OBJ_DESTRUCTOR_CALLED)) { - obj->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED; - obj->gc.refcount++; + if (!(GC_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) { + GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED; + GC_REFCOUNT(obj)++; obj->handlers->dtor_obj(obj TSRMLS_CC); - obj->gc.refcount--; + GC_REFCOUNT(obj)--; } } } @@ -69,7 +69,7 @@ ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSR zend_object *obj = objects->object_buckets[i]; if (IS_VALID(obj)) { - obj->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED; + GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED; } } } @@ -136,24 +136,24 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */ */ if (EG(objects_store).object_buckets && IS_VALID(EG(objects_store).object_buckets[object->handle])) { - if (object->gc.refcount == 0) { + if (GC_REFCOUNT(object) == 0) { int failure = 0; - if (!(object->gc.u.v.flags & IS_OBJ_DESTRUCTOR_CALLED)) { - object->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED; + if (!(GC_FLAGS(object) & IS_OBJ_DESTRUCTOR_CALLED)) { + GC_FLAGS(object) |= IS_OBJ_DESTRUCTOR_CALLED; if (object->handlers->dtor_obj) { - object->gc.refcount++; + GC_REFCOUNT(object)++; zend_try { object->handlers->dtor_obj(object TSRMLS_CC); } zend_catch { failure = 1; } zend_end_try(); - object->gc.refcount--; + GC_REFCOUNT(object)--; } } - if (object->gc.refcount == 0) { + if (GC_REFCOUNT(object) == 0) { zend_uint handle = object->handle; EG(objects_store).object_buckets[handle] = SET_INVALID(object); @@ -171,7 +171,7 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */ zend_bailout(); } } else { - object->gc.refcount--; + GC_REFCOUNT(object)--; } } } @@ -218,7 +218,7 @@ ZEND_API void zend_object_store_set_object(zval *zobject, zend_object *object TS /* Called when the ctor was terminated by an exception */ ZEND_API void zend_object_store_ctor_failed(zend_object *obj TSRMLS_DC) { - obj->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED; + GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED; } /* Proxy objects workings */ @@ -254,9 +254,8 @@ ZEND_API zend_object *zend_object_create_proxy(zval *object, zval *member TSRMLS { zend_proxy_object *obj = emalloc(sizeof(zend_proxy_object)); - obj->std.gc.refcount = 1; - obj->std.gc.u.v.type = IS_OBJECT; - obj->std.gc.u.v.gc_info = 0; + GC_REFCOUNT(obj) = 1; + GC_TYPE_INFO(obj) = IS_OBJECT; obj->std.ce = NULL; obj->std.properties = NULL; obj->std.guards = NULL; |