Permalink
Browse files

- Improve opcode dispatching

  • Loading branch information...
1 parent 572b2a5 commit 536d4d8aab711e534c409f129b092cba6575be4d @andigutmans andigutmans committed Oct 19, 2002
Showing with 11 additions and 7 deletions.
  1. +9 −0 Zend/zend_compile.h
  2. +1 −7 Zend/zend_execute.c
  3. +1 −0 Zend/zend_opcode.c
View
@@ -59,6 +59,14 @@ typedef struct _znode {
} u;
} znode;
+typedef struct _zend_execute_data zend_execute_data;
+
+#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data, zend_op_array *op_array TSRMLS_DC
+#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data, op_array TSRMLS_CC
+
+typedef int (*opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
+
+extern opcode_handler_t zend_opcode_handlers[512];
typedef struct _zend_op {
zend_uchar opcode;
@@ -67,6 +75,7 @@ typedef struct _zend_op {
znode op2;
ulong extended_value;
uint lineno;
+ opcode_handler_t handler;
} zend_op;
View
@@ -1167,11 +1167,6 @@ static int zend_check_symbol(zval **pz TSRMLS_DC)
EG(current_execute_data) = EX(prev_execute_data); \
return 1; /* CHECK_ME */
-#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data, zend_op_array *op_array TSRMLS_DC
-#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data, op_array TSRMLS_CC
-
-typedef int (*opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
-
opcode_handler_t zend_opcode_handlers[512];
ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
@@ -1220,7 +1215,7 @@ ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
#endif
zend_clean_garbage(TSRMLS_C);
- if (zend_opcode_handlers[EX(opline)->opcode](&execute_data, op_array TSRMLS_CC)) {
+ if (EX(opline)->handler(&execute_data, op_array TSRMLS_CC)) {
return;
}
}
@@ -3471,7 +3466,6 @@ int zend_isset_isempty_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
int result = 0;
if (container) {
-
if ((*container)->type == IS_ARRAY) {
HashTable *ht;
int isset = 0;
View
@@ -306,6 +306,7 @@ int pass_two(zend_op_array *op_array TSRMLS_DC)
opline->op2.u.constant.is_ref = 1;
opline->op2.u.constant.refcount = 2;
}
+ opline->handler = zend_opcode_handlers[opline->opcode];
opline++;
}
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);

0 comments on commit 536d4d8

Please sign in to comment.