mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Rename EX_VAR_2() into ZEND_CALL_VAR() and EX_VAR_NUM_2() into ZEND_CALL_VAR_NUM().
This commit is contained in:
parent
1da14c9f81
commit
dcfe58773e
10 changed files with 27 additions and 24 deletions
|
@ -4127,7 +4127,7 @@ ZEND_API void zend_ctor_make_null(zend_execute_data *execute_data) /* {{{ */
|
||||||
if (ex->func) {
|
if (ex->func) {
|
||||||
if (ZEND_USER_CODE(ex->func->type)) {
|
if (ZEND_USER_CODE(ex->func->type)) {
|
||||||
if (ex->func->op_array.this_var != -1) {
|
if (ex->func->op_array.this_var != -1) {
|
||||||
zval *this_var = EX_VAR_2(ex, ex->func->op_array.this_var);
|
zval *this_var = ZEND_CALL_VAR(ex, ex->func->op_array.this_var);
|
||||||
if (this_var != EX(return_value)) {
|
if (this_var != EX(return_value)) {
|
||||||
zval_ptr_dtor(this_var);
|
zval_ptr_dtor(this_var);
|
||||||
ZVAL_NULL(this_var);
|
ZVAL_NULL(this_var);
|
||||||
|
|
|
@ -447,7 +447,7 @@ ZEND_FUNCTION(func_get_arg)
|
||||||
first_extra_arg--;
|
first_extra_arg--;
|
||||||
}
|
}
|
||||||
if (requested_offset >= first_extra_arg && (ZEND_CALL_NUM_ARGS(ex) > first_extra_arg)) {
|
if (requested_offset >= first_extra_arg && (ZEND_CALL_NUM_ARGS(ex) > first_extra_arg)) {
|
||||||
arg = EX_VAR_NUM_2(ex, ex->func->op_array.last_var + ex->func->op_array.T) + (requested_offset - first_extra_arg);
|
arg = ZEND_CALL_VAR_NUM(ex, ex->func->op_array.last_var + ex->func->op_array.T) + (requested_offset - first_extra_arg);
|
||||||
} else {
|
} else {
|
||||||
arg = ZEND_CALL_ARG(ex, requested_offset + 1);
|
arg = ZEND_CALL_ARG(ex, requested_offset + 1);
|
||||||
}
|
}
|
||||||
|
@ -496,7 +496,7 @@ ZEND_FUNCTION(func_get_args)
|
||||||
q++;
|
q++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
p = EX_VAR_NUM_2(ex, ex->func->op_array.last_var + ex->func->op_array.T);
|
p = ZEND_CALL_VAR_NUM(ex, ex->func->op_array.last_var + ex->func->op_array.T);
|
||||||
}
|
}
|
||||||
while (i < arg_count) {
|
while (i < arg_count) {
|
||||||
q->h = i;
|
q->h = i;
|
||||||
|
@ -2070,7 +2070,7 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array TS
|
||||||
p++;
|
p++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
p = EX_VAR_NUM_2(call, call->func->op_array.last_var + call->func->op_array.T);
|
p = ZEND_CALL_VAR_NUM(call, call->func->op_array.last_var + call->func->op_array.T);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ static int lookup_cv(zend_op_array *op_array, zend_string* name TSRMLS_DC) /* {{
|
||||||
op_array->vars[i]->len == name->len &&
|
op_array->vars[i]->len == name->len &&
|
||||||
memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) {
|
memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) {
|
||||||
zend_string_release(name);
|
zend_string_release(name);
|
||||||
return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i);
|
return (int)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, i);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ static int lookup_cv(zend_op_array *op_array, zend_string* name TSRMLS_DC) /* {{
|
||||||
}
|
}
|
||||||
|
|
||||||
op_array->vars[i] = zend_new_interned_string(name TSRMLS_CC);
|
op_array->vars[i] = zend_new_interned_string(name TSRMLS_CC);
|
||||||
return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i);
|
return (int)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, i);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
|
@ -403,8 +403,14 @@ struct _zend_execute_data {
|
||||||
#define ZEND_CALL_FRAME_SLOT \
|
#define ZEND_CALL_FRAME_SLOT \
|
||||||
((ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) - 1) / ZEND_MM_ALIGNED_SIZE(sizeof(zval)))
|
((ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) - 1) / ZEND_MM_ALIGNED_SIZE(sizeof(zval)))
|
||||||
|
|
||||||
|
#define ZEND_CALL_VAR(call, n) \
|
||||||
|
((zval*)(((char*)(call)) + ((int)(n))))
|
||||||
|
|
||||||
|
#define ZEND_CALL_VAR_NUM(call, n) \
|
||||||
|
(((zval*)(call)) + (ZEND_CALL_FRAME_SLOT + ((int)(n))))
|
||||||
|
|
||||||
#define ZEND_CALL_ARG(call, n) \
|
#define ZEND_CALL_ARG(call, n) \
|
||||||
(((zval*)(call)) + ((n) + (ZEND_CALL_FRAME_SLOT - 1)))
|
ZEND_CALL_VAR_NUM(call, ((int)(n)) - 1)
|
||||||
|
|
||||||
#define EX(element) ((execute_data)->element)
|
#define EX(element) ((execute_data)->element)
|
||||||
|
|
||||||
|
@ -412,13 +418,10 @@ struct _zend_execute_data {
|
||||||
#define EX_CALL_KIND() ZEND_CALL_KIND(execute_data)
|
#define EX_CALL_KIND() ZEND_CALL_KIND(execute_data)
|
||||||
#define EX_NUM_ARGS() ZEND_CALL_NUM_ARGS(execute_data)
|
#define EX_NUM_ARGS() ZEND_CALL_NUM_ARGS(execute_data)
|
||||||
|
|
||||||
#define EX_VAR_2(ex, n) ((zval*)(((char*)(ex)) + ((int)(n))))
|
#define EX_VAR(n) ZEND_CALL_VAR(execute_data, n)
|
||||||
#define EX_VAR_NUM_2(ex, n) (((zval*)(ex)) + (ZEND_CALL_FRAME_SLOT + ((int)(n))))
|
#define EX_VAR_NUM(n) ZEND_CALL_VAR_NUM(execute_data, n)
|
||||||
|
|
||||||
#define EX_VAR(n) EX_VAR_2(execute_data, n)
|
#define EX_VAR_TO_NUM(n) (ZEND_CALL_VAR(NULL, n) - ZEND_CALL_VAR_NUM(NULL, 0))
|
||||||
#define EX_VAR_NUM(n) EX_VAR_NUM_2(execute_data, n)
|
|
||||||
|
|
||||||
#define EX_VAR_TO_NUM(n) (EX_VAR_2(NULL, n) - EX_VAR_NUM_2(NULL, 0))
|
|
||||||
|
|
||||||
#define IS_CONST (1<<0)
|
#define IS_CONST (1<<0)
|
||||||
#define IS_TMP_VAR (1<<1)
|
#define IS_TMP_VAR (1<<1)
|
||||||
|
|
|
@ -232,7 +232,7 @@ static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *
|
||||||
uint32_t first_extra_arg = call->func->op_array.num_args - ((call->func->common.fn_flags & ZEND_ACC_VARIADIC) != 0);
|
uint32_t first_extra_arg = call->func->op_array.num_args - ((call->func->common.fn_flags & ZEND_ACC_VARIADIC) != 0);
|
||||||
|
|
||||||
if (UNEXPECTED(ZEND_CALL_NUM_ARGS(call) > first_extra_arg)) {
|
if (UNEXPECTED(ZEND_CALL_NUM_ARGS(call) > first_extra_arg)) {
|
||||||
zval *end = EX_VAR_NUM_2(call, call->func->op_array.last_var + call->func->op_array.T);
|
zval *end = ZEND_CALL_VAR_NUM(call, call->func->op_array.last_var + call->func->op_array.T);
|
||||||
zval *p = end + (ZEND_CALL_NUM_ARGS(call) - first_extra_arg);
|
zval *p = end + (ZEND_CALL_NUM_ARGS(call) - first_extra_arg);
|
||||||
do {
|
do {
|
||||||
p--;
|
p--;
|
||||||
|
|
|
@ -1532,7 +1532,7 @@ ZEND_API zend_array *zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */
|
||||||
for (i = 0; i < ex->func->op_array.last_var; i++) {
|
for (i = 0; i < ex->func->op_array.last_var; i++) {
|
||||||
zval zv;
|
zval zv;
|
||||||
|
|
||||||
ZVAL_INDIRECT(&zv, EX_VAR_NUM_2(ex, i));
|
ZVAL_INDIRECT(&zv, ZEND_CALL_VAR_NUM(ex, i));
|
||||||
zend_hash_add_new(&symbol_table->ht,
|
zend_hash_add_new(&symbol_table->ht,
|
||||||
ex->func->op_array.vars[i], &zv);
|
ex->func->op_array.vars[i], &zv);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
|
||||||
zend_op *brk_opline = op_array->opcodes + brk_cont->brk;
|
zend_op *brk_opline = op_array->opcodes + brk_cont->brk;
|
||||||
|
|
||||||
if (brk_opline->opcode == ZEND_FREE) {
|
if (brk_opline->opcode == ZEND_FREE) {
|
||||||
zval *var = EX_VAR_2(execute_data, brk_opline->op1.var);
|
zval *var = EX_VAR(brk_opline->op1.var);
|
||||||
zval_ptr_dtor_nogc(var);
|
zval_ptr_dtor_nogc(var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ static void zend_generator_dtor_storage(zend_object *object TSRMLS_DC) /* {{{ */
|
||||||
/* If a finally block was found we jump directly to it and
|
/* If a finally block was found we jump directly to it and
|
||||||
* resume the generator. */
|
* resume the generator. */
|
||||||
if (finally_op_num) {
|
if (finally_op_num) {
|
||||||
zval *fast_call = EX_VAR_2(ex, ex->func->op_array.opcodes[finally_op_end].op1.var);
|
zval *fast_call = ZEND_CALL_VAR(ex, ex->func->op_array.opcodes[finally_op_end].op1.var);
|
||||||
|
|
||||||
fast_call->u2.lineno = (uint32_t)-1;
|
fast_call->u2.lineno = (uint32_t)-1;
|
||||||
ex->opline = &ex->func->op_array.opcodes[finally_op_num];
|
ex->opline = &ex->func->op_array.opcodes[finally_op_num];
|
||||||
|
|
|
@ -719,20 +719,20 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
|
||||||
if (opline->op1_type == IS_CONST) {
|
if (opline->op1_type == IS_CONST) {
|
||||||
opline->op1.zv = &op_array->literals[opline->op1.constant];
|
opline->op1.zv = &op_array->literals[opline->op1.constant];
|
||||||
} else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
|
} else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
|
||||||
opline->op1.var = (uint32_t)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->op1.var);
|
opline->op1.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->op1.var);
|
||||||
}
|
}
|
||||||
if (opline->op2_type == IS_CONST) {
|
if (opline->op2_type == IS_CONST) {
|
||||||
opline->op2.zv = &op_array->literals[opline->op2.constant];
|
opline->op2.zv = &op_array->literals[opline->op2.constant];
|
||||||
} else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) {
|
} else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) {
|
||||||
opline->op2.var = (uint32_t)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->op2.var);
|
opline->op2.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->op2.var);
|
||||||
}
|
}
|
||||||
if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
|
if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
|
||||||
opline->result.var = (uint32_t)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->result.var);
|
opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->result.var);
|
||||||
}
|
}
|
||||||
switch (opline->opcode) {
|
switch (opline->opcode) {
|
||||||
case ZEND_DECLARE_INHERITED_CLASS:
|
case ZEND_DECLARE_INHERITED_CLASS:
|
||||||
case ZEND_DECLARE_INHERITED_CLASS_DELAYED:
|
case ZEND_DECLARE_INHERITED_CLASS_DELAYED:
|
||||||
opline->extended_value = (uint32_t)(zend_intptr_t)EX_VAR_NUM_2(NULL, op_array->last_var + opline->extended_value);
|
opline->extended_value = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->extended_value);
|
||||||
break;
|
break;
|
||||||
case ZEND_GOTO:
|
case ZEND_GOTO:
|
||||||
if (Z_TYPE_P(opline->op2.zv) != IS_LONG) {
|
if (Z_TYPE_P(opline->op2.zv) != IS_LONG) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name)
|
||||||
(op_array->vars[i]->h == hash_value &&
|
(op_array->vars[i]->h == hash_value &&
|
||||||
op_array->vars[i]->len == name->len &&
|
op_array->vars[i]->len == name->len &&
|
||||||
memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) {
|
memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) {
|
||||||
return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i);
|
return (int)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, i);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)(zend_intptr_t)EX_VAR_NUM_2(NULL, i);
|
return (int)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC)
|
int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "ZendAccelerator.h"
|
#include "ZendAccelerator.h"
|
||||||
|
|
||||||
#define VAR_NUM(v) EX_VAR_TO_NUM(v)
|
#define VAR_NUM(v) EX_VAR_TO_NUM(v)
|
||||||
#define NUM_VAR(v) ((uint32_t)(zend_uintptr_t)EX_VAR_NUM_2(0, v))
|
#define NUM_VAR(v) ((uint32_t)(zend_uintptr_t)ZEND_CALL_VAR_NUM(0, v))
|
||||||
|
|
||||||
#define INV_COND(op) ((op) == ZEND_JMPZ ? ZEND_JMPNZ : ZEND_JMPZ)
|
#define INV_COND(op) ((op) == ZEND_JMPZ ? ZEND_JMPNZ : ZEND_JMPZ)
|
||||||
#define INV_EX_COND(op) ((op) == ZEND_JMPZ_EX ? ZEND_JMPNZ : ZEND_JMPZ)
|
#define INV_EX_COND(op) ((op) == ZEND_JMPZ_EX ? ZEND_JMPNZ : ZEND_JMPZ)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue