开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 0

api-go/php-src

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (321)
标签 (1019)
master
PHP-7.4
PHP-7.3
PHP-7.2
PHP-7.4.1
PHP-7.2.26
PHP-7.3.13
PHP-7.1
PHP-7.4.0
PHP-7.2.25
PHP-7.3.12
PHP-7.2.24
PHP-7.3.11
PHP-7.2.23
PHP-7.3.10
PHP-7.2.22
PHP-7.3.9
PHP-7.2.21
PHP-7.3.8
PHP-7.3.7
php-7.4.1
php-7.2.26
php-7.3.13
php-7.4.1RC1
php-7.3.13RC1
php-7.2.26RC1
php-7.4.0
php-7.2.25
php-7.3.12
php-7.4.0RC6
php-7.3.12RC1
php-7.2.25RC1
php-7.4.0RC5
php-7.1.33
php-7.2.24
php-7.3.11
php-7.4.0RC4
php-7.3.11RC1
php-7.2.24RC1
php-7.4.0RC3
master
分支 (321)
标签 (1019)
master
PHP-7.4
PHP-7.3
PHP-7.2
PHP-7.4.1
PHP-7.2.26
PHP-7.3.13
PHP-7.1
PHP-7.4.0
PHP-7.2.25
PHP-7.3.12
PHP-7.2.24
PHP-7.3.11
PHP-7.2.23
PHP-7.3.10
PHP-7.2.22
PHP-7.3.9
PHP-7.2.21
PHP-7.3.8
PHP-7.3.7
php-7.4.1
php-7.2.26
php-7.3.13
php-7.4.1RC1
php-7.3.13RC1
php-7.2.26RC1
php-7.4.0
php-7.2.25
php-7.3.12
php-7.4.0RC6
php-7.3.12RC1
php-7.2.25RC1
php-7.4.0RC5
php-7.1.33
php-7.2.24
php-7.3.11
php-7.4.0RC4
php-7.3.11RC1
php-7.2.24RC1
php-7.4.0RC3
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (321)
标签 (1019)
master
PHP-7.4
PHP-7.3
PHP-7.2
PHP-7.4.1
PHP-7.2.26
PHP-7.3.13
PHP-7.1
PHP-7.4.0
PHP-7.2.25
PHP-7.3.12
PHP-7.2.24
PHP-7.3.11
PHP-7.2.23
PHP-7.3.10
PHP-7.2.22
PHP-7.3.9
PHP-7.2.21
PHP-7.3.8
PHP-7.3.7
php-7.4.1
php-7.2.26
php-7.3.13
php-7.4.1RC1
php-7.3.13RC1
php-7.2.26RC1
php-7.4.0
php-7.2.25
php-7.3.12
php-7.4.0RC6
php-7.3.12RC1
php-7.2.25RC1
php-7.4.0RC5
php-7.1.33
php-7.2.24
php-7.3.11
php-7.4.0RC4
php-7.3.11RC1
php-7.2.24RC1
php-7.4.0RC3
php-src
/
Zend
/
zend_objects_API.c
php-src
/
Zend
/
zend_objects_API.c
zend_objects_API.c 6.57 KB
一键复制 编辑 原始数据 按行查看 历史
Nikita Popov 提交于 2019年08月28日 21:35 +08:00 . Remove delref in free_object_storage
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@php.net> |
| Zeev Suraski <zeev@php.net> |
| Dmitry Stogov <dmitry@php.net> |
+----------------------------------------------------------------------+
*/
#include "zend.h"
#include "zend_globals.h"
#include "zend_variables.h"
#include "zend_API.h"
#include "zend_objects_API.h"
ZEND_API void ZEND_FASTCALL zend_objects_store_init(zend_objects_store *objects, uint32_t init_size)
{
objects->object_buckets = (zend_object **) emalloc(init_size * sizeof(zend_object*));
objects->top = 1; /* Skip 0 so that handles are true */
objects->size = init_size;
objects->free_list_head = -1;
memset(&objects->object_buckets[0], 0, sizeof(zend_object*));
}
ZEND_API void ZEND_FASTCALL zend_objects_store_destroy(zend_objects_store *objects)
{
efree(objects->object_buckets);
objects->object_buckets = NULL;
}
ZEND_API void ZEND_FASTCALL zend_objects_store_call_destructors(zend_objects_store *objects)
{
EG(flags) |= EG_FLAGS_OBJECT_STORE_NO_REUSE;
if (objects->top > 1) {
uint32_t i;
for (i = 1; i < objects->top; i++) {
zend_object *obj = objects->object_buckets[i];
if (IS_OBJ_VALID(obj)) {
if (!(OBJ_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) {
GC_ADD_FLAGS(obj, IS_OBJ_DESTRUCTOR_CALLED);
if (obj->handlers->dtor_obj != zend_objects_destroy_object
|| obj->ce->destructor) {
GC_ADDREF(obj);
obj->handlers->dtor_obj(obj);
GC_DELREF(obj);
}
}
}
}
}
}
ZEND_API void ZEND_FASTCALL zend_objects_store_mark_destructed(zend_objects_store *objects)
{
if (objects->object_buckets && objects->top > 1) {
zend_object **obj_ptr = objects->object_buckets + 1;
zend_object **end = objects->object_buckets + objects->top;
do {
zend_object *obj = *obj_ptr;
if (IS_OBJ_VALID(obj)) {
GC_ADD_FLAGS(obj, IS_OBJ_DESTRUCTOR_CALLED);
}
obj_ptr++;
} while (obj_ptr != end);
}
}
ZEND_API void ZEND_FASTCALL zend_objects_store_free_object_storage(zend_objects_store *objects, zend_bool fast_shutdown)
{
zend_object **obj_ptr, **end, *obj;
if (objects->top <= 1) {
return;
}
/* Free object contents, but don't free objects themselves, so they show up as leaks.
* Also add a ref to all objects, so the object can't be freed by something else later. */
end = objects->object_buckets + 1;
obj_ptr = objects->object_buckets + objects->top;
if (fast_shutdown) {
do {
obj_ptr--;
obj = *obj_ptr;
if (IS_OBJ_VALID(obj)) {
if (!(OBJ_FLAGS(obj) & IS_OBJ_FREE_CALLED)) {
GC_ADD_FLAGS(obj, IS_OBJ_FREE_CALLED);
if (obj->handlers->free_obj != zend_object_std_dtor) {
GC_ADDREF(obj);
obj->handlers->free_obj(obj);
}
}
}
} while (obj_ptr != end);
} else {
do {
obj_ptr--;
obj = *obj_ptr;
if (IS_OBJ_VALID(obj)) {
if (!(OBJ_FLAGS(obj) & IS_OBJ_FREE_CALLED)) {
GC_ADD_FLAGS(obj, IS_OBJ_FREE_CALLED);
GC_ADDREF(obj);
obj->handlers->free_obj(obj);
}
}
} while (obj_ptr != end);
}
}
/* Store objects API */
static ZEND_COLD zend_never_inline void ZEND_FASTCALL zend_objects_store_put_cold(zend_object *object)
{
int handle;
uint32_t new_size = 2 * EG(objects_store).size;
EG(objects_store).object_buckets = (zend_object **) erealloc(EG(objects_store).object_buckets, new_size * sizeof(zend_object*));
/* Assign size after realloc, in case it fails */
EG(objects_store).size = new_size;
handle = EG(objects_store).top++;
object->handle = handle;
EG(objects_store).object_buckets[handle] = object;
}
ZEND_API void ZEND_FASTCALL zend_objects_store_put(zend_object *object)
{
int handle;
/* When in shutdown sequence - do not reuse previously freed handles, to make sure
* the dtors for newly created objects are called in zend_objects_store_call_destructors() loop
*/
if (EG(objects_store).free_list_head != -1 && EXPECTED(!(EG(flags) & EG_FLAGS_OBJECT_STORE_NO_REUSE))) {
handle = EG(objects_store).free_list_head;
EG(objects_store).free_list_head = GET_OBJ_BUCKET_NUMBER(EG(objects_store).object_buckets[handle]);
} else if (UNEXPECTED(EG(objects_store).top == EG(objects_store).size)) {
zend_objects_store_put_cold(object);
return;
} else {
handle = EG(objects_store).top++;
}
object->handle = handle;
EG(objects_store).object_buckets[handle] = object;
}
ZEND_API void ZEND_FASTCALL zend_objects_store_del(zend_object *object) /* {{{ */
{
ZEND_ASSERT(GC_REFCOUNT(object) == 0);
/* GC might have released this object already. */
if (UNEXPECTED(GC_TYPE(object) == IS_NULL)) {
return;
}
/* Make sure we hold a reference count during the destructor call
otherwise, when the destructor ends the storage might be freed
when the refcount reaches 0 a second time
*/
if (!(OBJ_FLAGS(object) & IS_OBJ_DESTRUCTOR_CALLED)) {
GC_ADD_FLAGS(object, IS_OBJ_DESTRUCTOR_CALLED);
if (object->handlers->dtor_obj != zend_objects_destroy_object
|| object->ce->destructor) {
GC_SET_REFCOUNT(object, 1);
object->handlers->dtor_obj(object);
GC_DELREF(object);
}
}
if (GC_REFCOUNT(object) == 0) {
uint32_t handle = object->handle;
void *ptr;
ZEND_ASSERT(EG(objects_store).object_buckets != NULL);
ZEND_ASSERT(IS_OBJ_VALID(EG(objects_store).object_buckets[handle]));
EG(objects_store).object_buckets[handle] = SET_OBJ_INVALID(object);
if (!(OBJ_FLAGS(object) & IS_OBJ_FREE_CALLED)) {
GC_ADD_FLAGS(object, IS_OBJ_FREE_CALLED);
GC_SET_REFCOUNT(object, 1);
object->handlers->free_obj(object);
}
ptr = ((char*)object) - object->handlers->offset;
GC_REMOVE_FROM_BUFFER(object);
efree(ptr);
ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(handle);
}
}
/* }}} */
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

php-src 镜像库
暂无标签
未知许可证
查看未知开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/netscript/php-src.git
git@gitee.com:netscript/php-src.git
netscript
php-src
php-src
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /