Skip to content

Commit

Permalink
Changed the structure of op_array.opcodes. The constant values are mo…
Browse files Browse the repository at this point in the history
…ved from opcode operands into a separate literal table
  • Loading branch information
dstogov committed Apr 20, 2010
1 parent ea53dc5 commit 94dd837
Show file tree
Hide file tree
Showing 37 changed files with 6,989 additions and 6,303 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

- default_charset if not specified is now UTF-8 instead of ISO-8859-1. (Rasmus)

- Changed the structure of op_array.opcodes. The constant values are moved from
opcode operands into a separate literal table. (Dmitry)
- Changed session.entropy_file to default to /dev/urandom or /dev/arandom if either
is present at compile time. (Rasmus)

Expand Down
18 changes: 9 additions & 9 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,19 +464,19 @@ static void zend_init_exception_op(TSRMLS_D) /* {{{ */
{
memset(EG(exception_op), 0, sizeof(EG(exception_op)));
EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION;
EG(exception_op)[0].op1.op_type = IS_UNUSED;
EG(exception_op)[0].op2.op_type = IS_UNUSED;
EG(exception_op)[0].result.op_type = IS_UNUSED;
EG(exception_op)[0].op1_type = IS_UNUSED;
EG(exception_op)[0].op2_type = IS_UNUSED;
EG(exception_op)[0].result_type = IS_UNUSED;
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op));
EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION;
EG(exception_op)[1].op1.op_type = IS_UNUSED;
EG(exception_op)[1].op2.op_type = IS_UNUSED;
EG(exception_op)[1].result.op_type = IS_UNUSED;
EG(exception_op)[1].op1_type = IS_UNUSED;
EG(exception_op)[1].op2_type = IS_UNUSED;
EG(exception_op)[1].result_type = IS_UNUSED;
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1);
EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION;
EG(exception_op)[2].op1.op_type = IS_UNUSED;
EG(exception_op)[2].op2.op_type = IS_UNUSED;
EG(exception_op)[2].result.op_type = IS_UNUSED;
EG(exception_op)[2].op1_type = IS_UNUSED;
EG(exception_op)[2].op2_type = IS_UNUSED;
EG(exception_op)[2].result_type = IS_UNUSED;
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2);
}
/* }}} */
Expand Down
34 changes: 17 additions & 17 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ static int zend_merge_property(zval **value TSRMLS_DC, int num_args, va_list arg

MAKE_STD_ZVAL(member);
ZVAL_STRINGL(member, hash_key->arKey, hash_key->nKeyLength-1, 1);
obj_ht->write_property(obj, member, *value TSRMLS_CC);
obj_ht->write_property(obj, member, *value, 0 TSRMLS_CC);
zval_ptr_dtor(&member);
}
return ZEND_HASH_APPLY_KEEP;
Expand Down Expand Up @@ -1435,7 +1435,7 @@ ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);

Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
Expand All @@ -1453,7 +1453,7 @@ ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);

Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
Expand All @@ -1471,7 +1471,7 @@ ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRML
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);

Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
Expand All @@ -1489,7 +1489,7 @@ ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len,
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);

Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
Expand All @@ -1507,7 +1507,7 @@ ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, do
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);

Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
Expand All @@ -1525,7 +1525,7 @@ ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, ch
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);

Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
Expand All @@ -1543,7 +1543,7 @@ ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, c
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);

Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
Expand All @@ -1557,7 +1557,7 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);

Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, value TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, value, 0 TSRMLS_CC);
zval_ptr_dtor(&z_key);
return SUCCESS;
}
Expand Down Expand Up @@ -1893,7 +1893,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
}
fname_len = strlen(ptr->fname);
lowercase_name = zend_str_tolower_dup(ptr->fname, fname_len);
lowercase_name = zend_str_tolower_dup(ptr->fname, fname_len);
if (zend_hash_add(target_function_table, lowercase_name, fname_len+1, &function, sizeof(zend_function), (void**)&reg_function) == FAILURE) {
unload=1;
efree(lowercase_name);
Expand Down Expand Up @@ -2381,7 +2381,7 @@ static int zend_is_callable_check_class(const char *name, int name_len, zend_fca
*strict_class = 1;
ret = 1;
}
} else if (zend_lookup_class_ex(name, name_len, 1, &pce TSRMLS_CC) == SUCCESS) {
} else if (zend_lookup_class_ex(name, name_len, NULL, 1, &pce TSRMLS_CC) == SUCCESS) {
zend_class_entry *scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL;

fcc->calling_scope = *pce;
Expand Down Expand Up @@ -2546,7 +2546,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
call_via_handler = 1;
retval = 1;
} else if (Z_OBJ_HT_P(fcc->object_ptr)->get_method) {
fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, mname, mlen TSRMLS_CC);
fcc->function_handler = Z_OBJ_HT_P(fcc->object_ptr)->get_method(&fcc->object_ptr, mname, mlen, NULL TSRMLS_CC);
if (fcc->function_handler) {
if (strict_class &&
(!fcc->function_handler->common.scope ||
Expand All @@ -2567,7 +2567,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
if (fcc->calling_scope->get_static_method) {
fcc->function_handler = fcc->calling_scope->get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC);
} else {
fcc->function_handler = zend_std_get_static_method(fcc->calling_scope, mname, mlen TSRMLS_CC);
fcc->function_handler = zend_std_get_static_method(fcc->calling_scope, mname, mlen, NULL TSRMLS_CC);
}
if (fcc->function_handler) {
retval = 1;
Expand Down Expand Up @@ -3343,7 +3343,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *
}
MAKE_STD_ZVAL(property);
ZVAL_STRINGL(property, name, name_length, 1);
Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC);
Z_OBJ_HT_P(object)->write_property(object, property, value, 0 TSRMLS_CC);
zval_ptr_dtor(&property);

EG(scope) = old_scope;
Expand Down Expand Up @@ -3428,7 +3428,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, in
zend_class_entry *old_scope = EG(scope);

EG(scope) = scope;
property = zend_std_get_static_property(scope, name, name_length, 0 TSRMLS_CC);
property = zend_std_get_static_property(scope, name, name_length, 0, NULL TSRMLS_CC);
EG(scope) = old_scope;
if (!property) {
return FAILURE;
Expand Down Expand Up @@ -3546,7 +3546,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n

MAKE_STD_ZVAL(property);
ZVAL_STRINGL(property, name, name_length, 1);
value = Z_OBJ_HT_P(object)->read_property(object, property, silent?BP_VAR_IS:BP_VAR_R TSRMLS_CC);
value = Z_OBJ_HT_P(object)->read_property(object, property, silent?BP_VAR_IS:BP_VAR_R, 0 TSRMLS_CC);
zval_ptr_dtor(&property);

EG(scope) = old_scope;
Expand All @@ -3560,7 +3560,7 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, in
zend_class_entry *old_scope = EG(scope);

EG(scope) = scope;
property = zend_std_get_static_property(scope, name, name_length, silent TSRMLS_CC);
property = zend_std_get_static_property(scope, name, name_length, silent, NULL TSRMLS_CC);
EG(scope) = old_scope;

return property?*property:NULL;
Expand Down
10 changes: 5 additions & 5 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
RETURN_FALSE;
}

if (zend_lookup_class_ex(class_name, class_name_len, 0, &ce TSRMLS_CC) == FAILURE) {
if (zend_lookup_class_ex(class_name, class_name_len, NULL, 0, &ce TSRMLS_CC) == FAILURE) {
retval = 0;
} else {
if (only_subclass) {
Expand Down Expand Up @@ -1102,7 +1102,7 @@ ZEND_FUNCTION(method_exists)

if (Z_TYPE_P(klass) == IS_OBJECT
&& Z_OBJ_HT_P(klass)->get_method != NULL
&& (func = Z_OBJ_HT_P(klass)->get_method(&klass, method_name, method_len TSRMLS_CC)) != NULL
&& (func = Z_OBJ_HT_P(klass)->get_method(&klass, method_name, method_len, NULL TSRMLS_CC)) != NULL
) {
if (func->type == ZEND_INTERNAL_FUNCTION
&& ((zend_internal_function*)func)->handler == zend_std_call_user_call
Expand Down Expand Up @@ -1160,7 +1160,7 @@ ZEND_FUNCTION(property_exists)

if (Z_TYPE_P(object) == IS_OBJECT &&
Z_OBJ_HANDLER_P(object, has_property) &&
Z_OBJ_HANDLER_P(object, has_property)(object, &property_z, 2 TSRMLS_CC)) {
Z_OBJ_HANDLER_P(object, has_property)(object, &property_z, 2, 0 TSRMLS_CC)) {
RETURN_TRUE;
}
RETURN_FALSE;
Expand Down Expand Up @@ -2021,7 +2021,7 @@ ZEND_FUNCTION(debug_print_backtrace)
function_name = "unknown";
build_filename_arg = 0;
} else
switch (Z_LVAL(ptr->opline->op2.u.constant)) {
switch (ptr->opline->extended_value) {
case ZEND_EVAL:
function_name = "eval";
build_filename_arg = 0;
Expand Down Expand Up @@ -2204,7 +2204,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
function_name = "unknown";
build_filename_arg = 0;
} else
switch (ptr->opline->op2.u.constant.value.lval) {
switch (ptr->opline->extended_value) {
case ZEND_EVAL:
function_name = "eval";
build_filename_arg = 0;
Expand Down
18 changes: 9 additions & 9 deletions Zend/zend_closures.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC) /* {{{ */
}
/* }}} */

static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len TSRMLS_DC) /* {{{ */
static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */
{
char *lc_name;
ALLOCA_FLAG(use_heap)
Expand All @@ -166,32 +166,32 @@ static zend_function *zend_closure_get_method(zval **object_ptr, char *method_na
return zend_get_closure_invoke_method(*object_ptr TSRMLS_CC);
}
free_alloca(lc_name, use_heap);
return std_object_handlers.get_method(object_ptr, method_name, method_len TSRMLS_CC);
return std_object_handlers.get_method(object_ptr, method_name, method_len, key TSRMLS_CC);
}
/* }}} */

static zval *zend_closure_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */
static zval *zend_closure_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
Z_ADDREF(EG(uninitialized_zval));
return &EG(uninitialized_zval);
}
/* }}} */

static void zend_closure_write_property(zval *object, zval *member, zval *value TSRMLS_DC) /* {{{ */
static void zend_closure_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
}
/* }}} */

static zval **zend_closure_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) /* {{{ */
static zval **zend_closure_get_property_ptr_ptr(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return NULL;
}
/* }}} */

static int zend_closure_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC) /* {{{ */
static int zend_closure_has_property(zval *object, zval *member, int has_set_exists, const zend_literal *key TSRMLS_DC) /* {{{ */
{
if (has_set_exists != 2) {
ZEND_CLOSURE_PROPERTY_ERROR();
Expand All @@ -200,7 +200,7 @@ static int zend_closure_has_property(zval *object, zval *member, int has_set_exi
}
/* }}} */

static void zend_closure_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */
static void zend_closure_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
}
Expand Down Expand Up @@ -308,7 +308,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
MAKE_STD_ZVAL(val);
array_init(val);
zend_hash_copy(Z_ARRVAL_P(val), static_variables, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval*));
zend_symtable_update(closure->debug_info, "static", sizeof("static"), (void *) &val, sizeof(zval *), NULL);
zend_hash_update(closure->debug_info, "static", sizeof("static"), (void *) &val, sizeof(zval *), NULL);
}

if (closure->this_ptr) {
Expand Down Expand Up @@ -340,7 +340,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
efree(name);
arg_info++;
}
zend_symtable_update(closure->debug_info, "parameter", sizeof("parameter"), (void *) &val, sizeof(zval *), NULL);
zend_hash_update(closure->debug_info, "parameter", sizeof("parameter"), (void *) &val, sizeof(zval *), NULL);
}
}

Expand Down
Loading

0 comments on commit 94dd837

Please sign in to comment.