- Commit new VM architecture. This one allows people (aka Derick) to

- ask the engine to use function handler mode. Will update the README
- about that.
This commit is contained in:
Andi Gutmans 2004-09-23 21:43:32 +00:00
parent 1fc2b79172
commit f82ed13625
6 changed files with 535 additions and 3826 deletions

View File

@ -72,7 +72,7 @@ typedef struct _zend_execute_data zend_execute_data;
typedef int (*opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
extern ZEND_API opcode_handler_t zend_opcode_handlers[512];
extern ZEND_API opcode_handler_t *zend_opcode_handlers;
struct _zend_op {
opcode_handler_t handler;

File diff suppressed because it is too large Load Diff

View File

@ -169,8 +169,6 @@ void zend_shutdown_timeout_thread();
#define active_opline (*EG(opline_ptr))
void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts TSRMLS_DC);
/* The following tries to resolve the classname of a zval of type object.
* Since it is slow it should be only used in error messages.
*/

View File

@ -30,6 +30,7 @@
#include "zend_constants.h"
#include "zend_extensions.h"
#include "zend_exceptions.h"
#include "zend_vm.h"
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@ -1075,7 +1076,7 @@ void execute_new_code(TSRMLS_D)
opline->op2.u.constant.is_ref = 1;
opline->op2.u.constant.refcount = 2;
}
opline->handler = zend_opcode_handlers[opline->opcode];
ZEND_VM_SET_OPCODE_HANDLER(opline);
opline++;
}

View File

@ -27,6 +27,8 @@
#include "zend_extensions.h"
#include "zend_API.h"
#include "zend_vm.h"
static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
{
if (extension->op_array_ctor) {
@ -361,7 +363,7 @@ int pass_two(zend_op_array *op_array TSRMLS_DC)
opline->op2.u.jmp_addr = &op_array->opcodes[opline->op2.u.opline_num];
break;
}
opline->handler = zend_opcode_handlers[opline->opcode];
ZEND_VM_SET_OPCODE_HANDLER(opline);
opline++;
}

View File

@ -21,15 +21,24 @@
#ifndef ZEND_VM_H
#define ZEND_VM_H
#define ZEND_VM_HAVE_OLD_EXECUTOR
#define ZEND_VM_KIND_CALL 1
#define ZEND_VM_KIND_SWITCH 2
#define ZEND_VM_KIND_GOTO 3
/* #define ZEND_VM_KIND ZEND_VM_KIND_CALL */
#define ZEND_VM_SPEC
#ifndef ZEND_VM_OLD_EXECUTOR
/*# define ZEND_VM_KIND ZEND_VM_KIND_CALL */
# define ZEND_VM_SPEC
#endif
/* don't edit the rest of the file */
#ifdef ZEND_VM_HAVE_OLD_EXECUTOR
ZEND_API void zend_vm_use_old_executor();
void zend_vm_set_opcode_handler(zend_op* opcode);
#endif
#define _CONST_CODE 0
#define _TMP_CODE 1
#define _VAR_CODE 2
@ -43,7 +52,7 @@
# endif
#endif
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(ZEND_VM_OLD_EXECUTOR)
# define ZEND_VM_ALWAYS_INLINE __attribute__ ((always_inline))
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn));
/*extern void zend_error_noreturn(int type, const char *format, ...) __asm__("zend_error") __attribute__ ((noreturn));*/
@ -55,8 +64,13 @@ void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alia
#ifndef ZEND_VM_SPEC
# define ZEND_VM_CODE(opcode, op1, op2) opcode
# define ZEND_VM_SPEC_OPCODE(opcode, op1, op2) opcode
# define ZEND_VM_SET_OPCODE_HANDLER(opline) \
opline->handler = zend_opcode_handlers[opline->opcode];
# ifdef ZEND_VM_HAVE_OLD_EXECUTOR
# define ZEND_VM_SET_OPCODE_HANDLER(opline) \
zend_vm_set_opcode_handler(opline)
# else
# define ZEND_VM_SET_OPCODE_HANDLER(opline) \
opline->handler = zend_opcode_handlers[opline->opcode]
# endif
#else
static const int zend_vm_decode[] = {
_UNUSED_CODE, /* 0 */
@ -74,8 +88,13 @@ static const int zend_vm_decode[] = {
opcode * 16 + op1 * 4 + op2
# define ZEND_VM_SPEC_OPCODE(opcode, op1, op2) \
ZEND_VM_CODE(opcode, zend_vm_decode[op1], zend_vm_decode[op2])
# define ZEND_VM_SET_OPCODE_HANDLER(opline) \
opline->handler = zend_opcode_handlers[ZEND_VM_SPEC_OPCODE(opline->opcode, opline->op1.op_type, opline->op2.op_type)]
# ifdef ZEND_VM_HAVE_OLD_EXECUTOR
# define ZEND_VM_SET_OPCODE_HANDLER(opline) \
zend_vm_set_opcode_handler(opline)
# else
# define ZEND_VM_SET_OPCODE_HANDLER(opline) \
opline->handler = zend_opcode_handlers[ZEND_VM_SPEC_OPCODE(opline->opcode, opline->op1.op_type, opline->op2.op_type)]
# endif
#endif