summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2016-06-19 17:05:48 +0100
committerJakub Zelenka <bukka@php.net>2016-06-19 17:05:48 +0100
commite63a8540a60e95aa5bd8e269add1b02afcc1b79b (patch)
treeb83a144eec24cc81adab0b9a778f7a730d8df79e /Zend/zend_opcode.c
parent7a4cc73641bb3eb878f7184bcbd026ee663cf2a9 (diff)
parent53071e647049f099f7f7a0771ddb63fc2cdd621c (diff)
downloadphp-git-e63a8540a60e95aa5bd8e269add1b02afcc1b79b.tar.gz
Merge branch 'openssl_error_store' into openssl_aead
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c82
1 files changed, 8 insertions, 74 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index ab67a88272..4e7469edb9 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -85,8 +85,6 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
op_array->static_variables = NULL;
op_array->last_try_catch = 0;
- op_array->this_var = -1;
-
op_array->fn_flags = 0;
op_array->early_binding = -1;
@@ -534,58 +532,6 @@ static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num
}
}
-static void zend_resolve_fast_call(zend_op_array *op_array, uint32_t op_num)
-{
- int i;
- uint32_t finally_num = (uint32_t)-1;
-
- for (i = 0; i < op_array->last_try_catch; i++) {
- if (op_num >= op_array->try_catch_array[i].finally_op
- && op_num < op_array->try_catch_array[i].finally_end) {
- finally_num = i;
- }
- }
-
- if (finally_num != (uint32_t)-1) {
- /* Must be ZEND_FAST_CALL */
- ZEND_ASSERT(op_array->opcodes[op_array->try_catch_array[finally_num].finally_op - 2].opcode == ZEND_FAST_CALL);
- op_array->opcodes[op_num].extended_value = ZEND_FAST_CALL_FROM_FINALLY;
- op_array->opcodes[op_num].op2.num = finally_num;
- }
-}
-
-static void zend_resolve_finally_ret(zend_op_array *op_array, uint32_t op_num)
-{
- int i;
- uint32_t finally_num = (uint32_t)-1;
- uint32_t catch_num = (uint32_t)-1;
-
- for (i = 0; i < op_array->last_try_catch; i++) {
- if (op_array->try_catch_array[i].try_op > op_num) {
- break;
- }
- if (op_num < op_array->try_catch_array[i].finally_op) {
- finally_num = i;
- }
- if (op_num < op_array->try_catch_array[i].catch_op) {
- catch_num = i;
- }
- }
-
- if (finally_num != (uint32_t)-1 &&
- (catch_num == (uint32_t)-1 ||
- op_array->try_catch_array[catch_num].catch_op >=
- op_array->try_catch_array[finally_num].finally_op)) {
- /* in case of unhandled exception return to upward finally block */
- op_array->opcodes[op_num].extended_value = ZEND_FAST_RET_TO_FINALLY;
- op_array->opcodes[op_num].op2.num = finally_num;
- } else if (catch_num != (uint32_t)-1) {
- /* in case of unhandled exception return to upward catch block */
- op_array->opcodes[op_num].extended_value = ZEND_FAST_RET_TO_CATCH;
- op_array->opcodes[op_num].op2.num = catch_num;
- }
-}
-
static uint32_t zend_get_brk_cont_target(const zend_op_array *op_array, const zend_op *opline) {
int nest_levels = opline->op2.num;
int array_offset = opline->op1.num;
@@ -634,12 +580,8 @@ ZEND_API int pass_two(zend_op_array *op_array)
switch (opline->opcode) {
case ZEND_FAST_CALL:
opline->op1.opline_num = op_array->try_catch_array[opline->op1.num].finally_op;
- zend_resolve_fast_call(op_array, opline - op_array->opcodes);
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
break;
- case ZEND_FAST_RET:
- zend_resolve_finally_ret(op_array, opline - op_array->opcodes);
- break;
case ZEND_BRK:
case ZEND_CONT:
{
@@ -673,18 +615,23 @@ ZEND_API int pass_two(zend_op_array *op_array)
case ZEND_JMPNZ_EX:
case ZEND_JMP_SET:
case ZEND_COALESCE:
- case ZEND_NEW:
case ZEND_FE_RESET_R:
case ZEND_FE_RESET_RW:
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
break;
case ZEND_ASSERT_CHECK:
+ {
/* If result of assert is unused, result of check is unused as well */
- if (op_array->opcodes[opline->op2.opline_num - 1].result_type == IS_UNUSED) {
+ zend_op *call = &op_array->opcodes[opline->op2.opline_num - 1];
+ if (call->opcode == ZEND_EXT_FCALL_END) {
+ call--;
+ }
+ if (call->result_type == IS_UNUSED) {
opline->result_type = IS_UNUSED;
}
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
break;
+ }
case ZEND_DECLARE_ANON_CLASS:
case ZEND_DECLARE_ANON_INHERITED_CLASS:
case ZEND_CATCH:
@@ -693,19 +640,6 @@ ZEND_API int pass_two(zend_op_array *op_array)
/* absolute index to relative offset */
opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value);
break;
- case ZEND_VERIFY_RETURN_TYPE:
- if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
- if (opline->op1_type != IS_UNUSED) {
- zend_op *ret = opline;
- do ret++; while (ret->opcode != ZEND_RETURN);
-
- ret->op1 = opline->op1;
- ret->op1_type = opline->op1_type;
- }
-
- MAKE_NOP(opline);
- }
- break;
case ZEND_RETURN:
case ZEND_RETURN_BY_REF:
if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
@@ -731,7 +665,7 @@ ZEND_API int pass_two(zend_op_array *op_array)
}
if (op_array->live_range) {
- uint32_t i;
+ int i;
for (i = 0; i < op_array->last_live_range; i++) {
op_array->live_range[i].var =