Skip to content

Commit

Permalink
Inline zend_zval_ptr() in executor explicitely (only on hot paths)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Aug 6, 2019
1 parent ef35556 commit d1fd460
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
3 changes: 0 additions & 3 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ ZEND_API const zend_internal_function zend_pass_function = {
{NULL,NULL,NULL,NULL} /* reserved */
};

#undef zval_ptr_dtor
#define zval_ptr_dtor(zv) i_zval_ptr_dtor(zv)

#define FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op, result) do { \
zval *__container_to_free = (free_op); \
if (UNEXPECTED(__container_to_free) \
Expand Down
10 changes: 5 additions & 5 deletions Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -4017,7 +4017,7 @@ ZEND_VM_HOT_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL))
zend_vm_stack_free_call_frame(call);

if (!RETURN_VALUE_USED(opline)) {
zval_ptr_dtor(ret);
i_zval_ptr_dtor(ret);
}

if (UNEXPECTED(EG(exception) != NULL)) {
Expand Down Expand Up @@ -4116,7 +4116,7 @@ ZEND_VM_HOT_HANDLER(131, ZEND_DO_FCALL_BY_NAME, ANY, ANY, SPEC(RETVAL))
zend_vm_stack_free_call_frame(call);

if (!RETURN_VALUE_USED(opline)) {
zval_ptr_dtor(ret);
i_zval_ptr_dtor(ret);
}
}

Expand Down Expand Up @@ -4204,7 +4204,7 @@ ZEND_VM_HOT_HANDLER(60, ZEND_DO_FCALL, ANY, ANY, SPEC(RETVAL))
zend_vm_stack_free_args(call);

if (!RETURN_VALUE_USED(opline)) {
zval_ptr_dtor(ret);
i_zval_ptr_dtor(ret);
}

} else { /* ZEND_OVERLOADED_FUNCTION */
Expand Down Expand Up @@ -6736,7 +6736,7 @@ ZEND_VM_C_LABEL(fe_fetch_w_exit):

ref = Z_REF_P(value);
GC_ADDREF(ref);
zval_ptr_dtor(variable_ptr);
i_zval_ptr_dtor(variable_ptr);
ZVAL_REF(variable_ptr, ref);
}
} else {
Expand Down Expand Up @@ -8366,7 +8366,7 @@ ZEND_VM_HANDLER(183, ZEND_BIND_STATIC, CV, UNUSED, REF)
zval *variable_ptr;

variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
zval_ptr_dtor(variable_ptr);
i_zval_ptr_dtor(variable_ptr);

ht = ZEND_MAP_PTR_GET(EX(func)->op_array.static_variables_ptr);
if (!ht) {
Expand Down
16 changes: 8 additions & 8 deletions Zend/zend_vm_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
zend_vm_stack_free_call_frame(call);

if (!0) {
zval_ptr_dtor(ret);
i_zval_ptr_dtor(ret);
}

if (UNEXPECTED(EG(exception) != NULL)) {
Expand Down Expand Up @@ -1332,7 +1332,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
zend_vm_stack_free_call_frame(call);

if (!1) {
zval_ptr_dtor(ret);
i_zval_ptr_dtor(ret);
}

if (UNEXPECTED(EG(exception) != NULL)) {
Expand Down Expand Up @@ -1454,7 +1454,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
zend_vm_stack_free_call_frame(call);

if (!0) {
zval_ptr_dtor(ret);
i_zval_ptr_dtor(ret);
}
}

Expand Down Expand Up @@ -1530,7 +1530,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
zend_vm_stack_free_call_frame(call);

if (!1) {
zval_ptr_dtor(ret);
i_zval_ptr_dtor(ret);
}
}

Expand Down Expand Up @@ -1618,7 +1618,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
zend_vm_stack_free_args(call);

if (!0) {
zval_ptr_dtor(ret);
i_zval_ptr_dtor(ret);
}

} else { /* ZEND_OVERLOADED_FUNCTION */
Expand Down Expand Up @@ -1729,7 +1729,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
zend_vm_stack_free_args(call);

if (!1) {
zval_ptr_dtor(ret);
i_zval_ptr_dtor(ret);
}

} else { /* ZEND_OVERLOADED_FUNCTION */
Expand Down Expand Up @@ -21632,7 +21632,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FETCH_RW_SPEC_VAR_HANDLER(Z

ref = Z_REF_P(value);
GC_ADDREF(ref);
zval_ptr_dtor(variable_ptr);
i_zval_ptr_dtor(variable_ptr);
ZVAL_REF(variable_ptr, ref);
}
} else {
Expand Down Expand Up @@ -46525,7 +46525,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_STATIC_SPEC_CV_UNUSED_HAN
zval *variable_ptr;

variable_ptr = EX_VAR(opline->op1.var);
zval_ptr_dtor(variable_ptr);
i_zval_ptr_dtor(variable_ptr);

ht = ZEND_MAP_PTR_GET(EX(func)->op_array.static_variables_ptr);
if (!ht) {
Expand Down

0 comments on commit d1fd460

Please sign in to comment.