This commit is contained in:
Dmitry Stogov 2014-08-08 13:47:34 +04:00
parent 50a76860bd
commit 4a3e501fb3
7 changed files with 28 additions and 35 deletions

View File

@ -227,8 +227,11 @@ again:
break;
}
case IS_TRUE:
// TODO: use interned string ???
ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0));
if (CG(one_char_string)['1']) {
ZVAL_INT_STR(expr_copy, CG(one_char_string)['1']);
} else {
ZVAL_NEW_STR(expr_copy, STR_INIT("1", 1, 0));
}
break;
case IS_RESOURCE: {
char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG];

View File

@ -109,7 +109,6 @@ static void zend_ast_add_array_element(zval *result, zval *offset, zval *expr TS
break;
case IS_STRING:
zend_symtable_update(Z_ARRVAL_P(result), Z_STR_P(offset), expr);
//???
zval_dtor(offset);
break;
case IS_NULL:

View File

@ -719,12 +719,10 @@ int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC);
#define ZEND_FETCH_CLASS_DEFAULT 0
#define ZEND_FETCH_CLASS_SELF 1
#define ZEND_FETCH_CLASS_PARENT 2
#define ZEND_FETCH_CLASS_MAIN 3 /* unused ??? */
#define ZEND_FETCH_CLASS_GLOBAL 4 /* unused ??? */
#define ZEND_FETCH_CLASS_AUTO 5
#define ZEND_FETCH_CLASS_INTERFACE 6
#define ZEND_FETCH_CLASS_STATIC 7
#define ZEND_FETCH_CLASS_TRAIT 14
#define ZEND_FETCH_CLASS_STATIC 3
#define ZEND_FETCH_CLASS_AUTO 4
#define ZEND_FETCH_CLASS_INTERFACE 5
#define ZEND_FETCH_CLASS_TRAIT 6
#define ZEND_FETCH_CLASS_MASK 0x0f
#define ZEND_FETCH_CLASS_NO_AUTOLOAD 0x80
#define ZEND_FETCH_CLASS_SILENT 0x0100

View File

@ -133,8 +133,7 @@ static const zend_internal_function zend_pass_function = {
/* End of zend_execute_locks.h */
// TODO: avoid global variable usage ???
#define CV_DEF_OF(i) (EG(current_execute_data)->func->op_array.vars[i])
#define CV_DEF_OF(i) (EX(func)->op_array.vars[i])
#define CTOR_CALL_BIT 0x1
#define CTOR_USED_BIT 0x2
@ -182,7 +181,7 @@ static zend_always_inline zval *_get_zval_ptr_var_deref(zend_uint var, const zen
return ret;
}
static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, zend_uint var, int type TSRMLS_DC)
static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, zend_uint var, int type, const zend_execute_data *execute_data TSRMLS_DC)
{
zend_string *cv;
@ -206,7 +205,7 @@ static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, zend_uint var, int
return ptr;
}
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, zend_uint var TSRMLS_DC)
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
{
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
@ -214,7 +213,7 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, zend_uin
return &EG(uninitialized_zval);
}
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, zend_uint var TSRMLS_DC)
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
{
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
@ -222,12 +221,12 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, zend
return &EG(uninitialized_zval);
}
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_IS(zval *ptr, zend_uint var TSRMLS_DC)
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_IS(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
{
return &EG(uninitialized_zval);
}
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, zend_uint var TSRMLS_DC)
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
{
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
@ -236,7 +235,7 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, zend_ui
return ptr;
}
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_W(zval *ptr, zend_uint var TSRMLS_DC)
static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_W(zval *ptr, zend_uint var, const zend_execute_data *execute_data TSRMLS_DC)
{
ZVAL_NULL(ptr);
return ptr;
@ -247,7 +246,7 @@ static zend_always_inline zval *_get_zval_ptr_cv(const zend_execute_data *execut
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup(ret, var, type TSRMLS_CC);
return _get_zval_cv_lookup(ret, var, type, execute_data TSRMLS_CC);
}
return ret;
}
@ -257,7 +256,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref(const zend_execute_data *
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup(ret, var, type TSRMLS_CC);
return _get_zval_cv_lookup(ret, var, type, execute_data TSRMLS_CC);
}
ZVAL_DEREF(ret);
return ret;
@ -268,7 +267,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_dat
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_R(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_R(ret, var, execute_data TSRMLS_CC);
}
return ret;
}
@ -278,7 +277,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(const zend_execu
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_R(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_R(ret, var, execute_data TSRMLS_CC);
}
ZVAL_DEREF(ret);
return ret;
@ -289,7 +288,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var, execute_data TSRMLS_CC);
}
return ret;
}
@ -299,7 +298,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_UNSET(const zend_e
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var, execute_data TSRMLS_CC);
}
ZVAL_DEREF(ret);
return ret;
@ -310,7 +309,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_da
zval *ret = EX_VAR(var);
if (Z_TYPE_P(ret) == IS_UNDEF) {
return _get_zval_cv_lookup_BP_VAR_IS(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_IS(ret, var, execute_data TSRMLS_CC);
}
return ret;
}
@ -320,7 +319,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_IS(const zend_exec
zval *ret = EX_VAR(var);
if (Z_TYPE_P(ret) == IS_UNDEF) {
return _get_zval_cv_lookup_BP_VAR_IS(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_IS(ret, var, execute_data TSRMLS_CC);
}
ZVAL_DEREF(ret);
return ret;
@ -331,7 +330,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_da
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_RW(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_RW(ret, var, execute_data TSRMLS_CC);
}
return ret;
}
@ -341,7 +340,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_RW(const zend_exec
zval *ret = EX_VAR(var);
if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
return _get_zval_cv_lookup_BP_VAR_RW(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_RW(ret, var, execute_data TSRMLS_CC);
}
ZVAL_DEREF(ret);
return ret;
@ -352,7 +351,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_dat
zval *ret = EX_VAR(var);
if (Z_TYPE_P(ret) == IS_UNDEF) {
return _get_zval_cv_lookup_BP_VAR_W(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_W(ret, var, execute_data TSRMLS_CC);
}
return ret;
}
@ -367,7 +366,7 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execu
zval *ret = EX_VAR(var);
if (Z_TYPE_P(ret) == IS_UNDEF) {
return _get_zval_cv_lookup_BP_VAR_W(ret, var TSRMLS_CC);
return _get_zval_cv_lookup_BP_VAR_W(ret, var, execute_data TSRMLS_CC);
}
ZVAL_DEREF(ret);
return ret;

View File

@ -115,9 +115,6 @@ again:
result = Z_TYPE(tmp) == IS_TRUE;
break;
}
// TODO: do we really need this warning ???
// Nikita, add your comments here.
zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to boolean", Z_OBJ_P(op)->ce->name->val);
} else if (Z_OBJ_HT_P(op)->get) {
zval rv;

View File

@ -992,8 +992,6 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
}
zend_fcall_info_argn(&handler->func.user->fci TSRMLS_CC, 0);
//??? zval_ptr_dtor(&ob_data);
//??? zval_ptr_dtor(&ob_mode);
zval_ptr_dtor(&retval);
} else {

View File

@ -285,7 +285,6 @@ static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php
{
/* create an instance of our class */
object_init_ex(object, uwrap->ce);
//??? Z_SET_ISREF_P(object);
if (context) {
add_property_resource(object, "context", context->res);