void fetch_simple_variable_ex(znode *result, znode *varname, int bp, int op CLS_DC)
{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
+ zend_op opline;
+ zend_op *opline_ptr;
zend_llist *fetch_list_ptr;
- opline->opcode = op;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *varname;
- *result = opline->result;
- SET_UNUSED(opline->op2);
- opline->op2.u.fetch_type = ZEND_FETCH_LOCAL;
+ if (bp) {
+ opline_ptr = &opline;
+ init_op(opline_ptr CLS_CC);
+ } else {
+ opline_ptr = get_next_op(CG(active_op_array) CLS_CC);
+ }
+
+ opline_ptr->opcode = op;
+ opline_ptr->result.op_type = IS_VAR;
+ opline_ptr->result.u.EA.type = 0;
+ opline_ptr->result.u.var = get_temporary_variable(CG(active_op_array));
+ opline_ptr->op1 = *varname;
+ *result = opline_ptr->result;
+ SET_UNUSED(opline_ptr->op2);
+ opline_ptr->op2.u.fetch_type = ZEND_FETCH_LOCAL;
if (bp) {
zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, &next_op_number);
+ zend_llist_add_element(fetch_list_ptr, opline_ptr);
}
}
void fetch_array_dim(znode *result, znode *parent, znode *dim CLS_DC)
{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
+ zend_op opline;
zend_llist *fetch_list_ptr;
- opline->opcode = ZEND_FETCH_DIM_W; /* the backpatching routine assumes W */
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *parent;
- opline->op2 = *dim;
- opline->extended_value = ZEND_FETCH_STANDARD;
- *result = opline->result;
+ init_op(&opline CLS_CC);
+ opline.opcode = ZEND_FETCH_DIM_W; /* the backpatching routine assumes W */
+ opline.result.op_type = IS_VAR;
+ opline.result.u.EA.type = 0;
+ opline.result.u.var = get_temporary_variable(CG(active_op_array));
+ opline.op1 = *parent;
+ opline.op2 = *dim;
+ opline.extended_value = ZEND_FETCH_STANDARD;
+ *result = opline.result;
zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, &next_op_number);
+ zend_llist_add_element(fetch_list_ptr, &opline);
}
{
zend_llist fetch_list;
- zend_llist_init(&fetch_list, sizeof(int), NULL, 0);
+ /* zend_llist_init(&fetch_list, sizeof(int), NULL, 0);
+ zend_stack_push(&CG(bp_stack), (void *) &fetch_list, sizeof(zend_llist));*/
+ zend_llist_init(&fetch_list, sizeof(zend_op), NULL, 0);
zend_stack_push(&CG(bp_stack), (void *) &fetch_list, sizeof(zend_llist));
}
{
zend_llist *fetch_list_ptr;
zend_llist_element *le;
- zend_op *opline;
+ zend_op *opline, *opline_ptr;
+ int last_temp_var=-1;
zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
le = fetch_list_ptr->head;
while (le) {
- opline = &CG(active_op_array)->opcodes[*((int *) le->data)];
+ opline_ptr = (zend_op *)le->data;
+ opline = get_next_op(CG(active_op_array) CLS_CC);
+ memcpy(opline, opline_ptr, sizeof(zend_op));
switch (type) {
case BP_VAR_R:
if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
void do_fetch_property(znode *result, znode *object, znode *property CLS_DC)
{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
+ zend_op opline;
zend_llist *fetch_list_ptr;
- opline->opcode = ZEND_FETCH_OBJ_W; /* the backpatching routine assumes W */
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *object;
- opline->op2 = *property;
- *result = opline->result;
+ init_op(&opline CLS_CC);
+ opline.opcode = ZEND_FETCH_OBJ_W; /* the backpatching routine assumes W */
+ opline.result.op_type = IS_VAR;
+ opline.result.u.EA.type = 0;
+ opline.result.u.var = get_temporary_variable(CG(active_op_array));
+ opline.op1 = *object;
+ opline.op2 = *property;
+ *result = opline.result;
zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, &next_op_number);
+ zend_llist_add_element(fetch_list_ptr, &opline);
}
}
+void init_op(zend_op *op CLS_DC)
+{
+ op->lineno = CG(zend_lineno);
+ op->filename = zend_get_compiled_filename();
+ op->result.op_type = IS_UNUSED;
+ op->extended_value = 0;
+ op->op1.u.EA.var = 0;
+ op->op1.u.EA.type = 0;
+ op->op2.u.EA.var = 0;
+ op->op2.u.EA.type = 0;
+ op->result.u.EA.var = 0;
+ op->result.u.EA.type = 0;
+}
+
zend_op *get_next_op(zend_op_array *op_array CLS_DC)
{
int next_op_num = op_array->last++;
}
next_op = &(op_array->opcodes[next_op_num]);
- next_op->lineno = CG(zend_lineno);
- next_op->filename = zend_get_compiled_filename();
- next_op->result.op_type = IS_UNUSED;
- next_op->extended_value = 0;
- next_op->op1.u.EA.var = 0;
- next_op->op1.u.EA.type = 0;
- next_op->op2.u.EA.var = 0;
- next_op->op2.u.EA.type = 0;
- next_op->result.u.EA.var = 0;
- next_op->result.u.EA.type = 0;
+
+ init_op(next_op CLS_CC);
return next_op;
}