2006-05-09 10:58:38 +00:00
|
|
|
dnl ================
|
|
|
|
/* {{{ Pre-declare */
|
|
|
|
DECL_STRUCT_P_FUNC(`zval')
|
|
|
|
DECL_STRUCT_P_FUNC(`zval_ptr')
|
2012-03-22 18:18:05 +00:00
|
|
|
DECL_STRUCT_P_FUNC(`zval_ptr_nullable')
|
2006-05-09 10:58:38 +00:00
|
|
|
DECL_STRUCT_P_FUNC(`zend_op_array')
|
|
|
|
DECL_STRUCT_P_FUNC(`zend_class_entry')
|
2006-07-16 11:07:57 +00:00
|
|
|
#ifdef HAVE_XCACHE_CONSTANT
|
|
|
|
DECL_STRUCT_P_FUNC(`zend_constant')
|
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
DECL_STRUCT_P_FUNC(`zend_function')
|
|
|
|
DECL_STRUCT_P_FUNC(`xc_entry_t')
|
|
|
|
#ifdef ZEND_ENGINE_2
|
|
|
|
DECL_STRUCT_P_FUNC(`zend_property_info')
|
|
|
|
#endif
|
|
|
|
/* }}} */
|
|
|
|
dnl ====================================================
|
|
|
|
#ifdef IS_CV
|
2012-03-25 02:14:44 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`zend_compiled_variable', , `dnl {{{
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, name_len)
|
2006-08-27 05:09:02 +00:00
|
|
|
PROC_ZSTRING_L(, name, name_len)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(ulong, hash_value)
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
|
|
|
dnl }}}
|
2012-03-25 02:14:44 +00:00
|
|
|
#endif
|
|
|
|
DEF_STRUCT_P_FUNC(`zend_uint', , `dnl {{{
|
2006-05-09 10:58:38 +00:00
|
|
|
IFCOPY(`dst[0] = src[0];')
|
|
|
|
IFDPRINT(`
|
|
|
|
INDENT()
|
|
|
|
fprintf(stderr, "%u\n", src[0]);
|
|
|
|
')
|
|
|
|
DONE_SIZE(sizeof(src[0]))
|
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
#ifndef ZEND_ENGINE_2
|
2012-03-25 02:14:44 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`int', , `dnl {{{
|
2006-05-09 10:58:38 +00:00
|
|
|
IFCOPY(`*dst = *src;')
|
|
|
|
IFDPRINT(`
|
|
|
|
INDENT()
|
|
|
|
fprintf(stderr, "%d\n", src[0]);
|
|
|
|
')
|
|
|
|
DONE_SIZE(sizeof(src[0]))
|
|
|
|
')
|
|
|
|
dnl }}}
|
2012-03-25 02:14:44 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
#ifdef ZEND_ENGINE_2
|
2012-03-25 02:14:44 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`zend_try_catch_element', , `dnl {{{
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, try_op)
|
|
|
|
PROCESS(zend_uint, catch_op)
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
|
|
|
dnl }}}
|
2012-03-25 02:14:44 +00:00
|
|
|
#endif
|
|
|
|
DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , `dnl {{{
|
2006-09-24 04:18:22 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_2
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, start)
|
2006-09-24 04:18:22 +00:00
|
|
|
#endif
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, cont)
|
|
|
|
PROCESS(int, brk)
|
|
|
|
PROCESS(int, parent)
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr', `zval_ptr')
|
2012-03-22 18:18:05 +00:00
|
|
|
DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr_nullable', `zval_ptr_nullable')
|
2006-05-09 10:58:38 +00:00
|
|
|
DEF_HASH_TABLE_FUNC(`HashTable_zend_function', `zend_function')
|
|
|
|
#ifdef ZEND_ENGINE_2
|
|
|
|
DEF_HASH_TABLE_FUNC(`HashTable_zend_property_info', `zend_property_info')
|
|
|
|
#endif
|
|
|
|
DEF_STRUCT_P_FUNC(`zval', , `dnl {{{
|
|
|
|
IFDASM(`do {
|
|
|
|
zval_dtor(dst);
|
|
|
|
*dst = *src;
|
|
|
|
zval_copy_ctor(dst);
|
2007-12-28 12:10:13 +00:00
|
|
|
Z_SET_REFCOUNT(*dst, 1);
|
2006-05-09 10:58:38 +00:00
|
|
|
DONE(value)
|
|
|
|
DONE(type)
|
2007-10-07 06:24:10 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_3
|
2007-12-28 10:16:12 +00:00
|
|
|
DONE(is_ref__gc)
|
|
|
|
DONE(refcount__gc)
|
|
|
|
#else
|
|
|
|
DONE(is_ref)
|
|
|
|
DONE(refcount)
|
2007-10-07 06:24:10 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
} while(0);
|
|
|
|
', `
|
|
|
|
dnl IFDASM else
|
|
|
|
/* Variable information */
|
|
|
|
dnl {{{ zvalue_value
|
|
|
|
DISABLECHECK(`
|
2007-12-29 03:44:16 +00:00
|
|
|
switch ((Z_TYPE_P(src) & IS_CONSTANT_TYPE_MASK)) {
|
2006-05-09 10:58:38 +00:00
|
|
|
case IS_LONG:
|
|
|
|
case IS_RESOURCE:
|
|
|
|
case IS_BOOL:
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(long, value.lval)
|
2006-05-09 10:58:38 +00:00
|
|
|
break;
|
|
|
|
case IS_DOUBLE:
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(double, value.dval)
|
2006-05-09 10:58:38 +00:00
|
|
|
break;
|
|
|
|
case IS_NULL:
|
|
|
|
IFDPRINT(`INDENT()`'fprintf(stderr, "\tNULL\n");')
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IS_CONSTANT:
|
|
|
|
#ifdef IS_UNICODE
|
|
|
|
if (UG(unicode)) {
|
|
|
|
goto proc_unicode;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
case IS_STRING:
|
|
|
|
#ifdef FLAG_IS_BC
|
|
|
|
case FLAG_IS_BC:
|
|
|
|
#endif
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, value.str.len)
|
2006-05-09 10:58:38 +00:00
|
|
|
PROC_STRING_L(value.str.val, value.str.len)
|
|
|
|
break;
|
|
|
|
#ifdef IS_UNICODE
|
|
|
|
case IS_UNICODE:
|
|
|
|
proc_unicode:
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int32_t, value.uni.len)
|
2006-08-27 05:09:02 +00:00
|
|
|
PROC_ZSTRING_L(1, value.uni.val, value.uni.len)
|
2006-05-09 10:58:38 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case IS_ARRAY:
|
|
|
|
case IS_CONSTANT_ARRAY:
|
|
|
|
STRUCT_P(HashTable, value.ht, HashTable_zval_ptr)
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IS_OBJECT:
|
|
|
|
IFNOTMEMCPY(`IFCOPY(`memcpy(dst, src, sizeof(src[0]));')')
|
|
|
|
dnl STRUCT(value.obj)
|
|
|
|
#ifndef ZEND_ENGINE_2
|
|
|
|
STRUCT_P(zend_class_entry, value.obj.ce)
|
|
|
|
STRUCT_P(HashTable, value.obj.properties, HashTable_zval_ptr)
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
DONE(value)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(xc_zval_data_type, type)
|
2007-12-28 10:16:12 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_3
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uchar, is_ref__gc)
|
2007-12-28 10:16:12 +00:00
|
|
|
#else
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uchar, is_ref)
|
2007-12-28 10:16:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ZEND_ENGINE_2_3
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, refcount__gc)
|
2007-12-28 10:16:12 +00:00
|
|
|
#elif defined(ZEND_ENGINE_2)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, refcount)
|
2007-10-07 06:31:19 +00:00
|
|
|
#else
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_ushort, refcount)
|
2007-10-07 06:24:10 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
')dnl IFDASM
|
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{
|
|
|
|
IFDASM(`
|
|
|
|
pushdefFUNC_NAME(`zval')
|
|
|
|
FUNC_NAME (dst, src[0] TSRMLS_CC);
|
|
|
|
popdef(`FUNC_NAME')
|
|
|
|
', `
|
|
|
|
do {
|
|
|
|
IFCALCCOPY(`
|
|
|
|
if (processor->reference) {
|
|
|
|
zval_ptr *ppzv;
|
2006-10-10 00:35:56 +00:00
|
|
|
if (zend_hash_find(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void **) &ppzv) == SUCCESS) {
|
2006-05-09 10:58:38 +00:00
|
|
|
IFCOPY(`
|
|
|
|
dst[0] = *ppzv;
|
|
|
|
/* *dst is updated */
|
2006-10-16 09:07:30 +00:00
|
|
|
dnl fprintf(stderr, "*dst is set to %p, KIND is_shm %d\n", dst[0], xc_is_shm(dst[0]));
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
2006-10-10 00:46:00 +00:00
|
|
|
IFCALCSTORE(`processor->have_references = 1;')
|
2006-05-09 10:58:38 +00:00
|
|
|
IFSTORE(`assert(xc_is_shm(dst[0]));')
|
|
|
|
IFRESTORE(`assert(!xc_is_shm(dst[0]));')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
')
|
|
|
|
|
|
|
|
ALLOC(dst[0], zval)
|
|
|
|
IFCALCCOPY(`
|
|
|
|
if (processor->reference) {
|
|
|
|
IFCALC(`
|
|
|
|
/* make dummy */
|
|
|
|
zval_ptr pzv = (zval_ptr)-1;
|
|
|
|
', `
|
|
|
|
zval_ptr pzv = dst[0];
|
2006-10-16 09:07:30 +00:00
|
|
|
FIXPOINTER_EX(zval, pzv)
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
2006-10-10 00:35:56 +00:00
|
|
|
if (zend_hash_add(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void *) &pzv, sizeof(pzv), NULL) == SUCCESS) {
|
2006-05-09 10:58:38 +00:00
|
|
|
/* first add, go on */
|
|
|
|
dnl fprintf(stderr, "mark[%p] = %p\n", src[0], pzv);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
')
|
|
|
|
IFCOPY(`
|
|
|
|
dnl fprintf(stderr, "copy from %p to %p\n", src[0], dst[0]);
|
|
|
|
')
|
2008-02-29 08:58:29 +00:00
|
|
|
IFDPRINT(`INDENT()`'fprintf(stderr, "[%p] ", src[0]);')
|
2006-05-13 01:54:55 +00:00
|
|
|
STRUCT_P_EX(zval, dst[0], src[0], `[0]', `', ` ')
|
2006-10-16 09:07:30 +00:00
|
|
|
FIXPOINTER_EX(zval, dst[0])
|
2006-05-09 10:58:38 +00:00
|
|
|
} while (0);
|
|
|
|
')
|
|
|
|
DONE_SIZE(sizeof(zval_ptr))
|
|
|
|
')
|
|
|
|
dnl }}}
|
2012-03-22 18:18:05 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`zval_ptr_nullable', , `dnl {{{
|
|
|
|
if (src[0]) {
|
|
|
|
STRUCT_P_EX(zval_ptr, dst, src, `', `', ` ')
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
IFCOPY(`COPYNULL_EX(src[0], src)')
|
|
|
|
}
|
|
|
|
DONE_SIZE(sizeof(zval_ptr_nullable))
|
|
|
|
')
|
|
|
|
dnl }}}
|
2006-05-09 10:58:38 +00:00
|
|
|
#ifdef ZEND_ENGINE_2
|
2012-03-25 02:14:44 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`zend_arg_info', , `dnl {{{
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, name_len)
|
2009-07-08 04:39:33 +00:00
|
|
|
PROC_ZSTRING_L(, name, name_len)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, class_name_len)
|
2009-07-08 04:39:33 +00:00
|
|
|
PROC_ZSTRING_L(, class_name, class_name_len)
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uchar, type_hint)
|
2011-04-09 07:07:48 +00:00
|
|
|
#else
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_bool, array_type_hint)
|
2011-04-09 07:07:48 +00:00
|
|
|
#endif
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_bool, allow_null)
|
|
|
|
PROCESS(zend_bool, pass_by_reference)
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifndef ZEND_ENGINE_2_4
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_bool, return_reference)
|
|
|
|
PROCESS(int, required_num_args)
|
2011-04-09 07:07:48 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
|
|
|
dnl }}}
|
2012-03-25 02:14:44 +00:00
|
|
|
#endif
|
2006-07-16 11:07:57 +00:00
|
|
|
#ifdef HAVE_XCACHE_CONSTANT
|
|
|
|
DEF_STRUCT_P_FUNC(`zend_constant', , `dnl {{{
|
|
|
|
STRUCT(zval, value)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, flags)
|
|
|
|
PROCESS(uint, name_len)
|
2012-03-23 08:04:14 +00:00
|
|
|
pushdef(`estrndup', `zend_strndup')
|
2008-01-05 03:42:33 +00:00
|
|
|
PROC_ZSTRING_N(, name, name_len)
|
2012-03-23 08:04:14 +00:00
|
|
|
popdef(`estrndup')
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, module_number)
|
2006-07-16 11:07:57 +00:00
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`zend_function', , `dnl {{{
|
|
|
|
DISABLECHECK(`
|
|
|
|
switch (src->type) {
|
|
|
|
case ZEND_INTERNAL_FUNCTION:
|
|
|
|
case ZEND_OVERLOADED_FUNCTION:
|
|
|
|
IFNOTMEMCPY(`IFCOPY(`memcpy(dst, src, sizeof(src[0]));')')
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ZEND_USER_FUNCTION:
|
|
|
|
case ZEND_EVAL_CODE:
|
|
|
|
DONE(type)
|
|
|
|
STRUCT(zend_op_array, op_array)
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
')
|
|
|
|
DONE_SIZE(sizeof(src[0]))
|
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
#ifdef ZEND_ENGINE_2
|
2012-03-25 02:14:44 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`zend_property_info', , `dnl {{{
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, flags)
|
|
|
|
PROCESS(int, name_length)
|
2006-08-27 05:09:02 +00:00
|
|
|
PROC_ZSTRING_L(, name, name_length)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(ulong, h)
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, offset)
|
2011-04-09 07:07:48 +00:00
|
|
|
#endif
|
2006-05-31 01:22:18 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_1
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, doc_comment_len)
|
2006-11-05 03:00:32 +00:00
|
|
|
PROC_ZSTRING_L(, doc_comment, doc_comment_len)
|
2006-06-11 02:49:31 +00:00
|
|
|
#endif
|
|
|
|
dnl isnt in php6 yet
|
2008-01-05 03:42:14 +00:00
|
|
|
#if defined(ZEND_ENGINE_2_2)
|
2006-06-11 02:49:31 +00:00
|
|
|
PROC_CLASS_ENTRY_P(ce)
|
2006-05-31 01:22:18 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
2012-03-25 02:14:44 +00:00
|
|
|
dnl }}}
|
2006-05-09 10:58:38 +00:00
|
|
|
#endif
|
2012-03-25 02:14:44 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
|
|
|
DEF_STRUCT_P_FUNC(`zend_trait_method_reference', , `dnl {{{
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(unsigned int, mname_len)
|
2012-03-25 02:14:44 +00:00
|
|
|
PROC_STRING_L(method_name, mname_len)
|
|
|
|
COPYNULL(ce)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(unsigned int, cname_len)
|
2012-03-25 02:14:44 +00:00
|
|
|
PROC_STRING_L(class_name, cname_len)
|
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
DEF_STRUCT_P_FUNC(`zend_trait_alias', , `dnl {{{
|
|
|
|
STRUCT_P(zend_trait_method_reference, trait_method)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(unsigned int, alias_len)
|
2012-03-25 02:14:44 +00:00
|
|
|
PROC_STRING_L(alias, alias_len)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, modifiers)
|
2012-03-25 02:14:44 +00:00
|
|
|
COPYNULL(function)
|
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
DEF_STRUCT_P_FUNC(`zend_trait_precedence', , `dnl {{{
|
|
|
|
STRUCT_P(zend_trait_method_reference, trait_method)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS_ARRAY(, xc_ztstring, exclude_from_classes, zend_class_entry*)
|
2012-03-25 02:14:44 +00:00
|
|
|
COPYNULL(function)
|
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
DEF_STRUCT_P_FUNC(`zend_trait_alias_ptr', , `dnl {{{
|
|
|
|
IFDASM(`
|
|
|
|
pushdefFUNC_NAME(`zend_trait_alias')
|
|
|
|
FUNC_NAME (dst, src[0] TSRMLS_CC);
|
|
|
|
popdef(`FUNC_NAME')
|
|
|
|
', `
|
|
|
|
ALLOC(dst[0], zend_trait_alias)
|
|
|
|
STRUCT_P_EX(zend_trait_alias, dst[0], src[0], `[0]', `', ` ')
|
|
|
|
FIXPOINTER_EX(zend_trait_alias, dst[0])
|
|
|
|
')
|
|
|
|
DONE_SIZE(sizeof(zend_trait_alias))
|
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
DEF_STRUCT_P_FUNC(`zend_trait_precedence_ptr', , `dnl {{{
|
|
|
|
IFDASM(`
|
|
|
|
pushdefFUNC_NAME(`zend_trait_precedence')
|
|
|
|
FUNC_NAME (dst, src[0] TSRMLS_CC);
|
|
|
|
popdef(`FUNC_NAME')
|
|
|
|
', `
|
|
|
|
ALLOC(dst[0], zend_trait_precedence)
|
|
|
|
STRUCT_P_EX(zend_trait_precedence, dst[0], src[0], `[0]', `', ` ')
|
|
|
|
FIXPOINTER_EX(zend_trait_precedence, dst[0])
|
|
|
|
')
|
|
|
|
DONE_SIZE(sizeof(zend_trait_precedence))
|
|
|
|
')
|
2006-05-09 10:58:38 +00:00
|
|
|
dnl }}}
|
2012-03-25 02:14:44 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
|
2006-09-24 08:33:31 +00:00
|
|
|
IFCALCCOPY(`
|
2006-05-09 10:58:38 +00:00
|
|
|
processor->active_class_entry_src = src;
|
2006-09-24 08:33:31 +00:00
|
|
|
IFCOPY(`processor->active_class_entry_dst = dst;')
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(char, type)
|
|
|
|
PROCESS(zend_uint, name_length)
|
2006-08-27 05:09:02 +00:00
|
|
|
PROC_ZSTRING_L(, name, name_length)
|
2006-05-09 10:58:38 +00:00
|
|
|
IFRESTORE(`
|
|
|
|
#ifndef ZEND_ENGINE_2
|
|
|
|
/* just copy parent and resolve on install_class */
|
|
|
|
COPY(parent)
|
|
|
|
#else
|
|
|
|
PROC_CLASS_ENTRY_P(parent)
|
|
|
|
#endif
|
|
|
|
', `
|
|
|
|
PROC_CLASS_ENTRY_P(parent)
|
|
|
|
')
|
|
|
|
#ifdef ZEND_ENGINE_2
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, refcount)
|
2006-05-09 10:58:38 +00:00
|
|
|
#else
|
|
|
|
STRUCT_P(int, refcount)
|
|
|
|
#endif
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifndef ZEND_ENGINE_2_4
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_bool, constants_updated)
|
2011-04-09 07:07:48 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
#ifdef ZEND_ENGINE_2
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, ce_flags)
|
2006-05-09 10:58:38 +00:00
|
|
|
#endif
|
|
|
|
|
2011-04-09 11:05:07 +00:00
|
|
|
#ifdef ZEND_ENGINE_2
|
|
|
|
STRUCT(HashTable, properties_info, HashTable_zend_property_info)
|
|
|
|
#endif
|
|
|
|
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
2012-03-22 18:18:05 +00:00
|
|
|
STRUCT_ARRAY(default_properties_count, zval_ptr_nullable, default_properties_table)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, default_properties_count)
|
2012-03-22 18:18:05 +00:00
|
|
|
STRUCT_ARRAY(default_static_members_count, zval_ptr_nullable, default_static_members_table)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(int, default_static_members_count)
|
2011-04-10 07:58:58 +00:00
|
|
|
IFCOPY(`dst->static_members_table = dst->default_static_members_table;')
|
2011-04-09 07:07:48 +00:00
|
|
|
DONE(static_members_table)
|
|
|
|
#else
|
2006-05-09 10:58:38 +00:00
|
|
|
IFCOPY(`dst->builtin_functions = src->builtin_functions;')
|
|
|
|
DONE(builtin_functions)
|
2011-04-09 07:07:48 +00:00
|
|
|
STRUCT(HashTable, default_properties, HashTable_zval_ptr)
|
2011-04-09 11:05:07 +00:00
|
|
|
# ifdef ZEND_ENGINE_2_1
|
2006-10-10 00:46:00 +00:00
|
|
|
STRUCT(HashTable, default_static_members, HashTable_zval_ptr)
|
2006-05-09 10:58:38 +00:00
|
|
|
IFCOPY(`dst->static_members = &dst->default_static_members;')
|
|
|
|
DONE(static_members)
|
2011-04-09 11:05:07 +00:00
|
|
|
# elif defined(ZEND_ENGINE_2)
|
2006-10-10 00:46:00 +00:00
|
|
|
STRUCT_P(HashTable, static_members, HashTable_zval_ptr)
|
2006-05-09 10:58:38 +00:00
|
|
|
# endif
|
2011-04-09 07:07:48 +00:00
|
|
|
#endif /* ZEND_ENGINE_2_4 */
|
|
|
|
|
|
|
|
#ifdef ZEND_ENGINE_2
|
2006-05-09 10:58:38 +00:00
|
|
|
STRUCT(HashTable, constants_table, HashTable_zval_ptr)
|
|
|
|
|
2012-03-25 02:14:44 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_2
|
2006-05-09 10:58:38 +00:00
|
|
|
dnl runtime binding: ADD_INTERFACE will deal with it
|
2012-03-25 02:14:44 +00:00
|
|
|
COPYNULL(`interfaces')
|
|
|
|
COPYNULL(`num_interfaces')
|
|
|
|
|
|
|
|
# ifdef ZEND_ENGINE_2_4
|
2011-04-09 07:07:48 +00:00
|
|
|
dnl runtime binding: ADD_TRAIT will deal with it
|
2012-03-25 02:14:44 +00:00
|
|
|
COPYNULL(traits)
|
|
|
|
COPYNULL(num_traits)
|
|
|
|
# endif
|
|
|
|
#else
|
2006-05-09 10:58:38 +00:00
|
|
|
IFRESTORE(`
|
|
|
|
if (src->num_interfaces) {
|
|
|
|
CALLOC(dst->interfaces, zend_class_entry*, src->num_interfaces)
|
2006-05-13 01:54:55 +00:00
|
|
|
DONE(`interfaces')
|
2012-03-22 18:18:05 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
COPYNULL(`interfaces')
|
|
|
|
}
|
2012-03-25 02:14:44 +00:00
|
|
|
', `
|
|
|
|
DONE(`interfaces')
|
2006-05-13 01:54:55 +00:00
|
|
|
')
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, num_interfaces)
|
2012-03-25 02:14:44 +00:00
|
|
|
#endif
|
|
|
|
STRUCT_ARRAY(, zend_trait_alias_ptr, trait_aliases)
|
|
|
|
STRUCT_ARRAY(, zend_trait_precedence_ptr, trait_precedences)
|
2006-05-09 10:58:38 +00:00
|
|
|
|
2011-04-09 07:07:48 +00:00
|
|
|
# ifdef ZEND_ENGINE_2_4
|
|
|
|
DISABLECHECK(`
|
|
|
|
IFRESTORE(`dst->info.user.filename = processor->entry_src->filepath;', `PROC_STRING(info.user.filename)')
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, info.user.line_start)
|
|
|
|
PROCESS(zend_uint, info.user.line_end)
|
|
|
|
PROCESS(zend_uint, info.user.doc_comment_len)
|
2011-04-09 07:07:48 +00:00
|
|
|
PROC_ZSTRING_L(, info.user.doc_comment, info.user.doc_comment_len)
|
|
|
|
')
|
|
|
|
DONE(info)
|
|
|
|
# else
|
2009-09-29 14:17:18 +00:00
|
|
|
IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)')
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, line_start)
|
|
|
|
PROCESS(zend_uint, line_end)
|
2011-04-09 07:07:48 +00:00
|
|
|
# ifdef ZEND_ENGINE_2_1
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, doc_comment_len)
|
2006-11-05 03:00:32 +00:00
|
|
|
PROC_ZSTRING_L(, doc_comment, doc_comment_len)
|
2011-04-09 07:07:48 +00:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
|
2006-05-09 10:58:38 +00:00
|
|
|
/* # NOT DONE */
|
|
|
|
COPY(serialize_func)
|
|
|
|
COPY(unserialize_func)
|
|
|
|
COPY(iterator_funcs)
|
|
|
|
COPY(create_object)
|
|
|
|
COPY(get_iterator)
|
|
|
|
COPY(interface_gets_implemented)
|
2011-04-09 07:07:48 +00:00
|
|
|
# ifdef ZEND_ENGINE_2_3
|
2007-10-01 11:24:34 +00:00
|
|
|
COPY(get_static_method)
|
2011-04-09 07:07:48 +00:00
|
|
|
# endif
|
2006-05-09 10:58:38 +00:00
|
|
|
COPY(serialize)
|
|
|
|
COPY(unserialize)
|
|
|
|
/* deal with it inside xc_fix_method */
|
|
|
|
SETNULL(constructor)
|
|
|
|
COPY(destructor)
|
|
|
|
COPY(clone)
|
|
|
|
COPY(__get)
|
|
|
|
COPY(__set)
|
|
|
|
/* should be >5.1 */
|
2011-04-09 07:07:48 +00:00
|
|
|
# ifdef ZEND_ENGINE_2_1
|
2006-05-09 10:58:38 +00:00
|
|
|
COPY(__unset)
|
|
|
|
COPY(__isset)
|
2011-04-09 07:07:48 +00:00
|
|
|
# if defined(ZEND_ENGINE_2_2) || PHP_MAJOR_VERSION >= 6
|
2006-05-09 10:58:38 +00:00
|
|
|
COPY(__tostring)
|
2011-04-09 07:07:48 +00:00
|
|
|
# endif
|
|
|
|
# endif
|
2006-05-09 10:58:38 +00:00
|
|
|
COPY(__call)
|
2011-04-09 07:07:48 +00:00
|
|
|
# ifdef ZEND_CALLSTATIC_FUNC_NAME
|
2007-10-01 11:24:34 +00:00
|
|
|
COPY(__callstatic)
|
2011-04-09 07:07:48 +00:00
|
|
|
# endif
|
|
|
|
# ifndef ZEND_ENGINE_2_4
|
2006-05-09 10:58:38 +00:00
|
|
|
/* # NOT DONE */
|
|
|
|
COPY(module)
|
2011-04-09 07:07:48 +00:00
|
|
|
# endif
|
|
|
|
#else /* ZEND_ENGINE_2 */
|
2006-05-09 10:58:38 +00:00
|
|
|
COPY(handle_function_call)
|
|
|
|
COPY(handle_property_get)
|
|
|
|
COPY(handle_property_set)
|
|
|
|
#endif
|
2006-07-16 06:00:42 +00:00
|
|
|
dnl must do after SETNULL(constructor) and dst->parent
|
2006-05-09 10:58:38 +00:00
|
|
|
STRUCT(HashTable, function_table, HashTable_zend_function)
|
2006-08-26 07:35:18 +00:00
|
|
|
IFRESTORE(`dst->function_table.pDestructor = ZEND_FUNCTION_DTOR;')
|
2006-09-24 08:33:31 +00:00
|
|
|
IFCALCCOPY(`
|
2006-07-16 06:00:42 +00:00
|
|
|
processor->active_class_entry_src = NULL;
|
2006-09-24 08:33:31 +00:00
|
|
|
IFCOPY(`processor->active_class_entry_dst = NULL;')
|
2006-07-16 06:00:42 +00:00
|
|
|
')
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
|
|
|
dnl }}}
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
|
|
|
undefine(`UNION_znode_op')
|
|
|
|
define(`UNION_znode_op', `dnl {{{
|
2012-03-22 16:22:37 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
switch ((src->$1_type ifelse($1, `result', & ~EXT_TYPE_UNUSED))) {
|
2011-04-09 11:05:07 +00:00
|
|
|
case IS_CONST:
|
|
|
|
case IS_VAR:
|
|
|
|
case IS_CV:
|
|
|
|
case IS_TMP_VAR:
|
|
|
|
case IS_UNUSED:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2012-03-22 16:22:37 +00:00
|
|
|
#endif
|
2011-04-09 11:05:07 +00:00
|
|
|
|
2011-04-09 07:07:48 +00:00
|
|
|
dnl dirty dispatch
|
|
|
|
DISABLECHECK(`
|
2012-03-22 16:22:37 +00:00
|
|
|
switch ((src->$1_type ifelse($1, `result', & ~EXT_TYPE_UNUSED))) {
|
2011-04-09 07:07:48 +00:00
|
|
|
case IS_CONST:
|
2012-03-22 16:22:37 +00:00
|
|
|
ifelse($1, `result', `
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, $1.constant)
|
2012-03-22 16:22:37 +00:00
|
|
|
', `
|
|
|
|
IFDASM(`{
|
|
|
|
zval *zv;
|
|
|
|
ALLOC_INIT_ZVAL(zv);
|
|
|
|
*zv = src->$1.literal->constant;
|
|
|
|
zval_copy_ctor(zv);
|
|
|
|
add_assoc_zval_ex(dst, ZEND_STRS("$1.constant"), zv);
|
|
|
|
}
|
|
|
|
', `
|
|
|
|
IFCOPY(`
|
|
|
|
dst->$1 = src->$1;
|
|
|
|
', `
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, $1.constant)
|
2012-03-22 16:22:37 +00:00
|
|
|
')
|
|
|
|
')
|
2011-04-09 07:07:48 +00:00
|
|
|
')
|
|
|
|
break;
|
|
|
|
IFCOPY(`
|
|
|
|
IFNOTMEMCPY(`
|
|
|
|
default:
|
2012-03-22 16:22:37 +00:00
|
|
|
$1 = $2;
|
2011-04-09 07:07:48 +00:00
|
|
|
')
|
|
|
|
', `
|
|
|
|
case IS_VAR:
|
|
|
|
case IS_TMP_VAR:
|
|
|
|
case IS_CV:
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, $1.var)
|
2011-04-09 07:07:48 +00:00
|
|
|
break;
|
|
|
|
case IS_UNUSED:
|
2012-03-25 07:01:16 +00:00
|
|
|
IFDASM(`PROCESS(zend_uint, $1.var)')
|
|
|
|
PROCESS(zend_uint, $1.opline_num)
|
2011-04-09 07:07:48 +00:00
|
|
|
break;
|
|
|
|
')
|
|
|
|
}
|
|
|
|
')
|
|
|
|
DONE($1)
|
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
#else
|
2006-05-09 10:58:38 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`znode', , `dnl {{{
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(xc_op_type, op_type)
|
2006-05-09 10:58:38 +00:00
|
|
|
|
|
|
|
#ifdef IS_CV
|
2006-05-24 07:52:48 +00:00
|
|
|
# define XCACHE_IS_CV IS_CV
|
2006-05-09 10:58:38 +00:00
|
|
|
#else
|
2006-05-24 07:52:48 +00:00
|
|
|
/* compatible with zend optimizer */
|
|
|
|
# define XCACHE_IS_CV 16
|
2006-05-09 10:58:38 +00:00
|
|
|
#endif
|
2006-05-24 07:52:48 +00:00
|
|
|
assert(src->op_type == IS_CONST ||
|
|
|
|
src->op_type == IS_VAR ||
|
|
|
|
src->op_type == XCACHE_IS_CV ||
|
2006-05-09 10:58:38 +00:00
|
|
|
src->op_type == IS_TMP_VAR ||
|
|
|
|
src->op_type == IS_UNUSED);
|
|
|
|
dnl dirty dispatch
|
|
|
|
DISABLECHECK(`
|
|
|
|
switch (src->op_type) {
|
|
|
|
case IS_CONST:
|
|
|
|
STRUCT(zval, u.constant)
|
|
|
|
break;
|
|
|
|
IFCOPY(`
|
|
|
|
IFNOTMEMCPY(`
|
|
|
|
default:
|
|
|
|
memcpy(&dst->u, &src->u, sizeof(src->u));
|
|
|
|
')
|
|
|
|
', `
|
|
|
|
case IS_VAR:
|
|
|
|
case IS_TMP_VAR:
|
2006-12-09 10:01:17 +00:00
|
|
|
case XCACHE_IS_CV:
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, u.var)
|
|
|
|
PROCESS(zend_uint, u.EA.type)
|
2006-05-09 10:58:38 +00:00
|
|
|
break;
|
|
|
|
case IS_UNUSED:
|
2012-03-25 07:01:16 +00:00
|
|
|
IFDASM(`PROCESS(zend_uint, u.var)')
|
|
|
|
PROCESS(zend_uint, u.opline_num)
|
2006-05-09 10:58:38 +00:00
|
|
|
#ifndef ZEND_ENGINE_2
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, u.fetch_type)
|
2006-05-09 10:58:38 +00:00
|
|
|
#endif
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, u.EA.type)
|
2006-05-09 10:58:38 +00:00
|
|
|
break;
|
|
|
|
')
|
|
|
|
}
|
|
|
|
')
|
|
|
|
DONE(u)
|
2011-04-09 07:07:48 +00:00
|
|
|
#if 0
|
|
|
|
DONE(EA)
|
|
|
|
#endif
|
2006-12-09 10:01:17 +00:00
|
|
|
#undef XCACHE_IS_CV
|
2006-05-09 10:58:38 +00:00
|
|
|
')
|
|
|
|
dnl }}}
|
2011-04-09 07:07:48 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(xc_opcode, opcode)
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
2012-03-23 09:34:24 +00:00
|
|
|
IFRESTORE(`', `
|
|
|
|
switch (src->opcode) {
|
|
|
|
case ZEND_BIND_TRAITS:
|
|
|
|
((zend_op *) src)->op2_type = IS_UNUSED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
')
|
2011-04-09 07:07:48 +00:00
|
|
|
UNION_znode_op(result)
|
|
|
|
UNION_znode_op(op1)
|
|
|
|
UNION_znode_op(op2)
|
|
|
|
#else
|
2006-05-09 10:58:38 +00:00
|
|
|
STRUCT(znode, result)
|
|
|
|
STRUCT(znode, op1)
|
|
|
|
STRUCT(znode, op2)
|
2011-04-09 07:07:48 +00:00
|
|
|
#endif
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(ulong, extended_value)
|
|
|
|
PROCESS(uint, lineno)
|
2006-05-09 10:58:38 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_1
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uchar, op1_type)
|
|
|
|
PROCESS(zend_uchar, op2_type)
|
|
|
|
PROCESS(zend_uchar, result_type)
|
2011-04-09 07:07:48 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
IFCOPY(`
|
2012-03-23 16:17:34 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
2012-03-22 16:22:37 +00:00
|
|
|
pushdef(`UNION_znode_op_literal', `
|
2012-03-23 16:17:34 +00:00
|
|
|
if (src->$1_type == IS_CONST) {
|
|
|
|
dst->$1.constant = src->$1.literal - processor->active_op_array_src->literals;
|
|
|
|
dst->$1.literal = &processor->active_op_array_dst->literals[dst->$1.constant];
|
2012-03-22 16:22:37 +00:00
|
|
|
}
|
|
|
|
')
|
|
|
|
UNION_znode_op_literal(op1)
|
|
|
|
UNION_znode_op_literal(op2)
|
2012-03-23 16:17:34 +00:00
|
|
|
#endif
|
2012-03-22 16:22:37 +00:00
|
|
|
popdef(`UNION_znode_op_literal')
|
2006-05-09 10:58:38 +00:00
|
|
|
switch (src->opcode) {
|
2008-01-05 11:52:35 +00:00
|
|
|
#ifdef ZEND_GOTO
|
|
|
|
case ZEND_GOTO:
|
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
case ZEND_JMP:
|
2011-04-25 06:53:01 +00:00
|
|
|
assert(Z_OP(src->op1).jmp_addr >= processor->active_opcodes_src && Z_OP(src->op1).jmp_addr - processor->active_opcodes_src < processor->active_op_array_src->last);
|
2011-04-09 07:07:48 +00:00
|
|
|
Z_OP(dst->op1).jmp_addr = processor->active_opcodes_dst + (Z_OP(src->op1).jmp_addr - processor->active_opcodes_src);
|
2011-04-25 06:53:01 +00:00
|
|
|
assert(Z_OP(dst->op1).jmp_addr >= processor->active_opcodes_dst && Z_OP(dst->op1).jmp_addr - processor->active_opcodes_dst < processor->active_op_array_dst->last);
|
2006-05-09 10:58:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ZEND_JMPZ:
|
|
|
|
case ZEND_JMPNZ:
|
|
|
|
case ZEND_JMPZ_EX:
|
|
|
|
case ZEND_JMPNZ_EX:
|
2007-12-28 10:16:12 +00:00
|
|
|
#ifdef ZEND_JMP_SET
|
|
|
|
case ZEND_JMP_SET:
|
|
|
|
#endif
|
2011-04-25 06:53:01 +00:00
|
|
|
assert(Z_OP(src->op2).jmp_addr >= processor->active_opcodes_src && Z_OP(src->op2).jmp_addr - processor->active_opcodes_src < processor->active_op_array_src->last);
|
2011-04-09 07:07:48 +00:00
|
|
|
Z_OP(dst->op2).jmp_addr = processor->active_opcodes_dst + (Z_OP(src->op2).jmp_addr - processor->active_opcodes_src);
|
2011-04-25 06:53:01 +00:00
|
|
|
assert(Z_OP(dst->op2).jmp_addr >= processor->active_opcodes_dst && Z_OP(dst->op2).jmp_addr - processor->active_opcodes_dst < processor->active_op_array_dst->last);
|
2006-05-09 10:58:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
')
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(opcode_handler_t, handler)
|
2006-05-09 10:58:38 +00:00
|
|
|
#endif
|
|
|
|
')
|
|
|
|
dnl }}}
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
|
|
|
DEF_STRUCT_P_FUNC(`zend_literal', , `dnl {{{
|
|
|
|
STRUCT(zval, constant)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_ulong, hash_value)
|
|
|
|
PROCESS(zend_uint, cache_slot)
|
2011-04-09 07:07:48 +00:00
|
|
|
')
|
|
|
|
dnl }}}
|
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
|
|
|
|
IFRESTORE(`
|
2011-04-18 09:11:22 +00:00
|
|
|
const xc_op_array_info_t *op_array_info = &processor->active_op_array_infos_src[processor->active_op_array_index++];
|
2006-10-04 00:38:45 +00:00
|
|
|
dnl shadow copy must NOT meet:
|
|
|
|
dnl readonly_protection=on
|
|
|
|
dnl main op_array && have early binding
|
2008-03-21 14:36:17 +00:00
|
|
|
#ifdef ZEND_COMPILE_DELAYED_BINDING
|
|
|
|
zend_bool need_early_binding = 0;
|
|
|
|
#else
|
|
|
|
zend_bool need_early_binding = processor->php_src->have_early_binding;
|
|
|
|
#endif
|
2009-08-03 08:15:53 +00:00
|
|
|
zend_bool shallow_copy = !processor->readonly_protection && !(src == processor->php_src->op_array && need_early_binding);
|
|
|
|
if (shallow_copy) {
|
|
|
|
zend_bool gc_arg_info = 0;
|
2012-03-22 16:22:37 +00:00
|
|
|
zend_bool gc_opcodes = 0;
|
2006-05-09 10:58:38 +00:00
|
|
|
/* really fast shallow copy */
|
|
|
|
memcpy(dst, src, sizeof(src[0]));
|
|
|
|
dst->refcount[0] = 1000;
|
|
|
|
/* deep */
|
|
|
|
STRUCT_P(HashTable, static_variables, HashTable_zval_ptr)
|
2008-01-05 09:17:02 +00:00
|
|
|
#ifdef ZEND_ENGINE_2
|
2009-08-03 08:15:53 +00:00
|
|
|
STRUCT_ARRAY(num_args, zend_arg_info, arg_info)
|
|
|
|
gc_arg_info = 1;
|
|
|
|
#endif
|
2012-03-22 16:22:37 +00:00
|
|
|
dst->filename = processor->entry_src->filepath;
|
|
|
|
#ifdef ZEND_ENGINE_2_4
|
|
|
|
if (src->literals /* || op_array_info->literalsinfo_cnt */) {
|
|
|
|
gc_opcodes = 1;
|
|
|
|
}
|
|
|
|
#else
|
2009-08-03 08:15:53 +00:00
|
|
|
if (op_array_info->oplineinfo_cnt) {
|
|
|
|
gc_opcodes = 1;
|
2012-03-22 16:22:37 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (gc_opcodes) {
|
|
|
|
zend_op *opline, *end;
|
2009-08-03 08:15:53 +00:00
|
|
|
COPY_N_EX(last, zend_op, opcodes)
|
2011-04-22 07:51:38 +00:00
|
|
|
|
|
|
|
for (opline = dst->opcodes, end = opline + src->last; opline < end; ++opline) {
|
2012-03-22 16:22:37 +00:00
|
|
|
#ifdef ZEND_ENGINE_2_4
|
|
|
|
pushdef(`UNION_znode_op_literal', `
|
|
|
|
if (opline->$1_type == IS_CONST) {
|
|
|
|
opline->$1.constant = opline->$1.literal - src->literals;
|
|
|
|
opline->$1.literal = &dst->literals[opline->$1.constant];
|
|
|
|
}
|
|
|
|
')
|
|
|
|
UNION_znode_op_literal(op1)
|
|
|
|
UNION_znode_op_literal(op2)
|
|
|
|
popdef(`UNION_znode_op_literal')
|
|
|
|
#endif
|
|
|
|
|
2011-04-22 07:51:38 +00:00
|
|
|
switch (opline->opcode) {
|
|
|
|
#ifdef ZEND_GOTO
|
|
|
|
case ZEND_GOTO:
|
|
|
|
#endif
|
|
|
|
case ZEND_JMP:
|
|
|
|
Z_OP(opline->op1).jmp_addr = dst->opcodes + (Z_OP(opline->op1).jmp_addr - src->opcodes);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ZEND_JMPZ:
|
|
|
|
case ZEND_JMPNZ:
|
|
|
|
case ZEND_JMPZ_EX:
|
|
|
|
case ZEND_JMPNZ_EX:
|
|
|
|
#ifdef ZEND_JMP_SET
|
|
|
|
case ZEND_JMP_SET:
|
|
|
|
#endif
|
|
|
|
Z_OP(opline->op2).jmp_addr = dst->opcodes + (Z_OP(opline->op2).jmp_addr - src->opcodes);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-08-03 08:15:53 +00:00
|
|
|
}
|
|
|
|
if (gc_arg_info || gc_opcodes) {
|
|
|
|
xc_gc_op_array_t gc_op_array;
|
|
|
|
#ifdef ZEND_ENGINE_2
|
|
|
|
gc_op_array.num_args = gc_arg_info ? dst->num_args : 0;
|
|
|
|
gc_op_array.arg_info = gc_arg_info ? dst->arg_info : NULL;
|
2008-01-05 09:17:02 +00:00
|
|
|
#endif
|
2009-08-03 08:15:53 +00:00
|
|
|
gc_op_array.opcodes = gc_opcodes ? dst->opcodes : NULL;
|
|
|
|
xc_gc_add_op_array(&gc_op_array TSRMLS_CC);
|
|
|
|
}
|
2006-05-09 10:58:38 +00:00
|
|
|
define(`SKIPASSERT_ONCE')
|
|
|
|
}
|
|
|
|
else
|
|
|
|
')
|
|
|
|
do {
|
|
|
|
dnl RESTORE is done above!
|
|
|
|
|
|
|
|
/* Common elements */
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uchar, type)
|
2006-08-27 05:09:02 +00:00
|
|
|
PROC_ZSTRING(, function_name)
|
2006-05-09 10:58:38 +00:00
|
|
|
#ifdef ZEND_ENGINE_2
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, fn_flags)
|
2009-08-03 08:15:53 +00:00
|
|
|
STRUCT_ARRAY(num_args, zend_arg_info, arg_info)
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_uint, num_args)
|
|
|
|
PROCESS(zend_uint, required_num_args)
|
2011-04-09 07:07:48 +00:00
|
|
|
# ifndef ZEND_ENGINE_2_4
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(zend_bool, pass_rest_by_reference)
|
2011-04-09 07:07:48 +00:00
|
|
|
# endif
|
2006-05-09 10:58:38 +00:00
|
|
|
#else
|
|
|
|
if (src->arg_types) {
|
|
|
|
ALLOC(dst->arg_types, zend_uchar, src->arg_types[0] + 1)
|
|
|
|
IFCOPY(`memcpy(dst->arg_types, src->arg_types, sizeof(src->arg_types[0]) * (src->arg_types[0]+1));')
|
|
|
|
IFDASM(`do {
|
|
|
|
int i;
|
|
|
|
zval *zv;
|
|
|
|
ALLOC_INIT_ZVAL(zv);
|
|
|
|
array_init(zv);
|
|
|
|
for (i = 0; i < src->arg_types[0]; i ++) {
|
|
|
|
add_next_index_long(zv, src->arg_types[i + 1]);
|
|
|
|
}
|
|
|
|
add_assoc_zval_ex(dst, ZEND_STRS("arg_types"), zv);
|
|
|
|
} while (0);')
|
|
|
|
DONE(arg_types)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
COPYNULL(arg_types)
|
|
|
|
}
|
|
|
|
#endif
|
2011-04-09 07:07:48 +00:00
|
|
|
#ifndef ZEND_ENGINE_2_4
|
2012-03-25 07:01:16 +00:00
|
|
|
PROCESS(unsigned char, return_reference)
|
2011-04-09 07:07:48 +00:00
|
|
|
#endif
|
2006-05-09 10:58:38 +00:00
|
|
|
/* END of common elements */
|
|
|
|
#ifdef IS_UNICODE
|
2006-08-27 05:09:02 +00:00
|
|
|
dnl SETNULL(u_twin)
|
2006-05-09 10:58:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
STRUCT_P(zend_uint, refcount)
|
|
|
|
UNFIXPOINTER(zend_uint, refcount)
|
2006-10-07 04:21:44 +00:00
|
|
|
IFSTORE(`dst->refcount[0] = 1;')
|
2006-05-09 10:58:38 +00:00
|
|
|
|
|