XCache is a fast, stable PHP opcode cacher that has been proven and is now running on production servers under high load. https://xcache.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1512 lines
38 KiB

dnl ================
/* {{{ Pre-declare */
DECL_STRUCT_P_FUNC(`zval')
DECL_STRUCT_P_FUNC(`zval_ptr')
DECL_STRUCT_P_FUNC(`zval_ptr_nullable')
DECL_STRUCT_P_FUNC(`zend_op_array')
DECL_STRUCT_P_FUNC(`zend_class_entry')
#ifdef HAVE_XCACHE_CONSTANT
DECL_STRUCT_P_FUNC(`zend_constant')
#endif
DECL_STRUCT_P_FUNC(`zend_function')
DECL_STRUCT_P_FUNC(`xc_entry_var_t')
DECL_STRUCT_P_FUNC(`xc_entry_php_t')
#ifdef ZEND_ENGINE_2
DECL_STRUCT_P_FUNC(`zend_property_info')
#endif
/* }}} */
dnl ====================================================
#ifdef IS_CV
DEF_STRUCT_P_FUNC(`zend_compiled_variable', , `dnl {{{
PROCESS(int, name_len)
PROC_ZSTRING_L(, name, name_len)
PROCESS(ulong, hash_value)
')
dnl }}}
#endif
DEF_STRUCT_P_FUNC(`zend_uint', , `dnl {{{
IFCOPY(`DST()[0] = SRC()[0];')
IFDPRINT(`
INDENT()
fprintf(stderr, "%u\n", SRC()[0]);
')
DONE_SIZE(sizeof(SRC()[0]))
')
dnl }}}
#ifndef ZEND_ENGINE_2
DEF_STRUCT_P_FUNC(`int', , `dnl {{{
IFCOPY(`*DST() = *SRC();')
IFDPRINT(`
INDENT()
fprintf(stderr, "%d\n", SRC()[0]);
')
DONE_SIZE(sizeof(SRC()[0]))
')
dnl }}}
#endif
#ifdef ZEND_ENGINE_2
DEF_STRUCT_P_FUNC(`zend_try_catch_element', , `dnl {{{
PROCESS(zend_uint, try_op)
PROCESS(zend_uint, catch_op)
#ifdef ZEND_ENGINE_2_5
PROCESS(zend_uint, finally_op)
PROCESS(zend_uint, finally_end)
#endif
')
dnl }}}
#endif
DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , `dnl {{{
#ifdef ZEND_ENGINE_2_2
PROCESS(int, start)
#endif
PROCESS(int, cont)
PROCESS(int, brk)
PROCESS(int, parent)
')
dnl }}}
DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr', `zval_ptr')
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
#ifdef IS_CONSTANT_AST
define(`ZEND_AST_HELPER', `dnl {{{
{
IFCALCCOPY(`
size_t zend_ast_size = ($1->kind == ZEND_CONST)
? sizeof(zend_ast) + sizeof(zval)
: sizeof(zend_ast) + sizeof(zend_ast *) * ($1->children - 1);
')
pushdef(`ALLOC_SIZE_HELPER', `zend_ast_size')
$2
popdef(`ALLOC_SIZE_HELPER')
}
')
dnl }}}
DEF_STRUCT_P_FUNC(`zend_ast', , `dnl {{{
zend_ushort i;
PROCESS(zend_ushort, kind)
PROCESS(zend_ushort, children)
DONE(u)
DISABLECHECK(`
if (SRC()->kind == ZEND_CONST) {
assert(SRC()->u.val);
IFCOPY(`
DST()->u.val = (zval *) (DST() + 1);
memcpy(DST()->u.val, SRC()->u.val, sizeof(zval));
')
STRUCT_P_EX(zval, DST()->u.val, SRC()->u.val, `[]', `', ` ')
RELOCATE_EX(zval, DST()->u.val)
}
else {
for (i = 0; i < SRC()->children; ++i) {
zend_ast *src_ast = (&SRC()->u.child)[i];
if (src_ast) {
ZEND_AST_HELPER(`src_ast', `
ALLOC(`(&DST()->u.child)[i]', zend_ast)
STRUCT_P_EX(zend_ast, (&DST()->u.child)[i], src_ast, `[]', `', ` ')
')
RELOCATE_EX(zend_ast, (&DST()->u.child)[i])
}
else {
SETNULL_EX(`(&DST()->u.child)[i]', `[]')
}
}
}
')
')
dnl }}}
#endif
DEF_STRUCT_P_FUNC(`zend_object', , `dnl {{{
IFCALC(`
xc_var_collect_class(processor, SRC(ce) TSRMLS_CC);
DONE(ce)
', `IFSTORE(`
DST(ce) = (zend_class_entry *) xc_var_store_ce(processor, SRC(ce) TSRMLS_CC);
DONE(ce)
', `IFRESTORE(`
assert(processor->index_to_ce);
DST(ce) = processor->index_to_ce[(size_t) SRC(ce)];
DONE(ce)
', `
PROCESS_SCALAR(ce, lu, unsigned long)
')')')
STRUCT_P(HashTable, properties, HashTable_zval_ptr)
#ifdef ZEND_ENGINE_2_4
dnl TODO: how to rebuild properties_table
STRUCT_ARRAY(int, IFRESTORE(`DST(`ce->default_properties_count')', `SRC(`ce->default_properties_count')'), zval_ptr, properties_table)
#endif
#ifdef ZEND_ENGINE_2
COPYNULL(`guards')
#endif
')
dnl }}}
#ifdef ZEND_ENGINE_2
DEF_STRUCT_P_FUNC(`zend_object_value', , `dnl {{{
IFCALC(`
xc_var_collect_object(processor, SRC(handle) TSRMLS_CC);
DONE(handle)
', `IFSTORE(`
DST(handle) = (zend_object_handle) xc_var_store_handle(processor, SRC(handle) TSRMLS_CC);
DONE(handle)
', `IFRESTORE(`
DST(handle) = xc_var_restore_handle(processor, (size_t) SRC(handle) TSRMLS_CC);
DONE(handle)
', `
PROCESS(zend_object_handle, handle)
')')')
COPY(handlers)
')
dnl }}}
#endif
DEF_STRUCT_P_FUNC(`zval', , `dnl {{{
IFDASM(`do {
zval_dtor(DST());
*DST() = *SRC();
zval_copy_ctor(DST());
Z_SET_REFCOUNT(*DST(), 1);
DONE(value)
DONE(type)
#ifdef ZEND_ENGINE_2_3
DONE(is_ref__gc)
DONE(refcount__gc)
#else
DONE(is_ref)
DONE(refcount)
#endif
} while(0);
', `
dnl IFDASM else
/* Variable information */
dnl {{{ zvalue_value
DISABLECHECK(`
switch ((Z_TYPE_P(SRC()) & IS_CONSTANT_TYPE_MASK)) {
case IS_LONG:
case IS_BOOL:
PROCESS(long, value.lval)
break;
case IS_DOUBLE:
PROCESS(double, value.dval)
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
PROCESS(int, value.str.len)
IFRESTORE(`
TRACE("%p, %p, %d", src->value.str.val, processor->entry_php_src->filepath.str, src->value.str.val == processor->entry_php_src->filepath.str);
')
PROC_STRING_L(value.str.val, value.str.len)
dnl IFSTORE(`
dnl TRACE("%s, %d", dst->value.str.val, dst->value.str.val == processor->entry_php_dst->filepath.str);
dnl ')
break;
#ifdef IS_UNICODE
case IS_UNICODE:
proc_unicode:
PROCESS(int32_t, value.uni.len)
PROC_ZSTRING_L(1, value.uni.val, value.uni.len)
break;
#endif
case IS_ARRAY:
#ifdef IS_CONSTANT_ARRAY
case IS_CONSTANT_ARRAY:
#endif
assert(SRC()->value.ht);
STRUCT_P(HashTable, value.ht, HashTable_zval_ptr)
break;
#ifdef IS_CONSTANT_AST
case IS_CONSTANT_AST:
assert(SRC()->value.ast);
ZEND_AST_HELPER(`SRC()->value.ast', `STRUCT_P(zend_ast, value.ast)')
break;
#endif
case IS_OBJECT:
#ifdef ZEND_ENGINE_2
STRUCT(zend_object_value, value.obj)
#else
STRUCT(zend_object, value.obj)
#endif
break;
default:
/* IS_RESOURCE */
IFCOPY(`Z_TYPE_P(DST()) = IS_LONG;')
PROCESS(long, value.lval)
break;
}
')
dnl }}}
DONE(value)
PROCESS(xc_zval_type_t, type)
#ifdef ZEND_ENGINE_2_3
PROCESS(zend_uchar, is_ref__gc)
#else
PROCESS(zend_uchar, is_ref)
#endif
#ifdef ZEND_ENGINE_2_3
PROCESS(zend_uint, refcount__gc)
#elif defined(ZEND_ENGINE_2)
PROCESS(zend_uint, refcount)
#else
PROCESS(zend_ushort, refcount)
#endif
')dnl IFDASM
')
dnl }}}
DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{
IFDASM(`
pushdefFUNC_NAME(`zval')
FUNC_NAME (dasm, DST(), SRC()[0] TSRMLS_CC);
popdef(`FUNC_NAME')
', `
do {
IFCALCCOPY(`
if (processor->handle_reference) {
zval_ptr *ppzv;
if (zend_hash_find(&processor->zvalptrs, (char *) &SRC()[0], sizeof(SRC()[0]), (void **) &ppzv) == SUCCESS) {
IFCOPY(`
DST()[0] = *ppzv;
IFSTORE(`
Z_ADDREF(**DST());
TRACE("add refcount to %d", Z_REFCOUNT(**DST()));
')
/* *DST() is updated */
TRACE("*DST() is set to %p, PROCESSOR_TYPE is_shm %d", (void *) DST()[0], xc_is_shm(DST()[0]));
')
IFCALCSTORE(`processor->have_references = 1;')
IFSTORE(`assert(xc_is_shm(DST()[0]));')
IFRESTORE(`assert(!xc_is_shm(DST()[0]));')
break;
}
}
')
ALLOC(DST()[0], zval)
IFCALCCOPY(`
if (processor->handle_reference) {
IFCALC(`
/* make dummy */
zval_ptr pzv = (zval_ptr)-1;
', `
zval_ptr pzv = DST()[0];
RELOCATE_EX(zval, pzv)
')
if (zend_hash_add(&processor->zvalptrs, (char *) &SRC()[0], sizeof(SRC()[0]), (void *) &pzv, sizeof(pzv), NULL) == SUCCESS) { /* first add, go on */
dnl IFSTORE(`fprintf(stderr, "mark[%p] = %p\n", (void *) SRC()[0], (void *) pzv);')
}
else {
assert(0);
}
}
')
IFCOPY(`
TRACE("copy from %p to %p", SRC()[0], DST()[0]);
')
IFDPRINT(`INDENT()`'fprintf(stderr, "[%p] ", (void *) SRC()[0]);')
STRUCT_P_EX(zval, DST()[0], SRC()[0], `[0]', `', ` ')
dnl set refcount here instead of struct zval?
IFSTORE(`
Z_SET_REFCOUNT(**DST(), 1);
TRACE("set refcount to %d", Z_REFCOUNT(**DST()));
')
RELOCATE_EX(zval, DST()[0])
} while (0);
')
DONE_SIZE(sizeof(zval_ptr))
')
dnl }}}
DEF_STRUCT_P_FUNC(`zval_ptr_nullable', , `dnl {{{
if (SRC()[0]) {
pushdef(`DASM_STRUCT_DIRECT')
STRUCT_P_EX(zval_ptr, DST(), SRC(), `', `', ` ')
popdef(`DASM_STRUCT_DIRECT')
}
else {
IFCOPY(`COPYNULL_EX(DST()[0], SRC())')
}
DONE_SIZE(sizeof(zval_ptr_nullable))
')
dnl }}}
#ifdef ZEND_ENGINE_2
DEF_STRUCT_P_FUNC(`zend_arg_info', , `dnl {{{
PROCESS(zend_uint, name_len)
PROC_ZSTRING_L(, name, name_len)
PROCESS(zend_uint, class_name_len)
PROC_ZSTRING_L(, class_name, class_name_len)
#ifdef ZEND_ENGINE_2_4
PROCESS(zend_uchar, type_hint)
#elif defined(ZEND_ENGINE_2_1)
PROCESS(zend_bool, array_type_hint)
#endif
#ifdef ZEND_ENGINE_2_6
PROCESS(zend_uchar, pass_by_reference)
#endif
PROCESS(zend_bool, allow_null)
#ifdef ZEND_ENGINE_2_6
PROCESS(zend_bool, is_variadic)
#else
PROCESS(zend_bool, pass_by_reference)
#endif
#ifndef ZEND_ENGINE_2_4
PROCESS(zend_bool, return_reference)
PROCESS(int, required_num_args)
#endif
')
dnl }}}
#endif
#ifdef HAVE_XCACHE_CONSTANT
DEF_STRUCT_P_FUNC(`zend_constant', , `dnl {{{
STRUCT(zval, value)
PROCESS(int, flags)
PROCESS(uint, name_len)
pushdef(`estrndup', `zend_strndup')
PROC_ZSTRING_N(, name, name_len)
popdef(`estrndup')
PROCESS(int, module_number)
')
dnl }}}
#endif
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
DEF_STRUCT_P_FUNC(`zend_property_info', , `dnl {{{
PROCESS(zend_uint, flags)
PROCESS(int, name_length)
PROC_ZSTRING_L(, name, name_length)
PROCESS(ulong, h)
#ifdef ZEND_ENGINE_2_4
PROCESS(int, offset)
#endif
#ifdef ZEND_ENGINE_2_1
PROCESS(int, doc_comment_len)
PROC_ZSTRING_L(, doc_comment, doc_comment_len)
#endif
dnl isnt in php6 yet
#if defined(ZEND_ENGINE_2_2)
PROC_CLASS_ENTRY_P(ce)
#endif
')
dnl }}}
#endif
#ifdef ZEND_ENGINE_2_4
DEF_STRUCT_P_FUNC(`zend_trait_method_reference', , `dnl {{{
PROCESS(unsigned int, mname_len)
PROC_STRING_L(method_name, mname_len)
COPYNULL(ce)
PROCESS(unsigned int, cname_len)
PROC_STRING_L(class_name, cname_len)
')
dnl }}}
DEF_STRUCT_P_FUNC(`zend_trait_alias', , `dnl {{{
STRUCT_P(zend_trait_method_reference, trait_method)
PROCESS(unsigned int, alias_len)
PROC_STRING_L(alias, alias_len)
PROCESS(zend_uint, modifiers)
#ifndef ZEND_ENGINE_2_5
COPYNULL(function)
#endif
')
dnl }}}
DEF_STRUCT_P_FUNC(`zend_trait_precedence', , `dnl {{{
STRUCT_P(zend_trait_method_reference, trait_method)
PROCESS_ARRAY(, xc_ztstring, exclude_from_classes, zend_class_entry*)
#ifndef ZEND_ENGINE_2_5
COPYNULL(function)
#endif
')
dnl }}}
DEF_STRUCT_P_FUNC(`zend_trait_alias_ptr', , `dnl {{{
IFDASM(`
pushdefFUNC_NAME(`zend_trait_alias')
FUNC_NAME (dasm, 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]', `', ` ')
RELOCATE_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 (dasm, 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]', `', ` ')
RELOCATE_EX(zend_trait_precedence, DST()[0])
')
DONE_SIZE(sizeof(zend_trait_precedence))
')
dnl }}}
#endif
DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
IFCALCCOPY(`
processor->active_class_entry_src = SRC();
IFCOPY(`processor->active_class_entry_dst = DST();')
')
PROCESS(char, type)
PROCESS(zend_uint, name_length)
PROC_ZSTRING_L(, name, name_length)
IFRESTORE(`
#ifndef ZEND_ENGINE_2
/* just copy parent and resolve on install_class */
COPYPOINTER(parent)
#else
PROC_CLASS_ENTRY_P(parent)
#endif
', `
PROC_CLASS_ENTRY_P(parent)
')
#ifdef ZEND_ENGINE_2
PROCESS(int, refcount)
#else
STRUCT_P(int, refcount)
#endif
#ifndef ZEND_ENGINE_2_4
PROCESS(zend_bool, constants_updated)
#endif
#ifdef ZEND_ENGINE_2
PROCESS(zend_uint, ce_flags)
#endif
#ifdef ZEND_ENGINE_2
STRUCT(HashTable, properties_info, HashTable_zend_property_info)
#endif
#ifdef ZEND_ENGINE_2_4
STRUCT_ARRAY(int, SRC(`default_properties_count'), zval_ptr_nullable, default_properties_table)
PROCESS(int, default_properties_count)
STRUCT_ARRAY(int, SRC(`default_static_members_count'), zval_ptr_nullable, default_static_members_table)
PROCESS(int, default_static_members_count)
IFCOPY(`DST(`static_members_table') = DST(`default_static_members_table');')
DONE(static_members_table)
#else
IFCOPY(`DST(`builtin_functions') = SRC(`builtin_functions');')
DONE(builtin_functions)
STRUCT(HashTable, default_properties, HashTable_zval_ptr)
# ifdef ZEND_ENGINE_2_1
STRUCT(HashTable, default_static_members, HashTable_zval_ptr)
IFCOPY(`DST(`static_members') = &DST(`default_static_members');')
DONE(static_members)
# elif defined(ZEND_ENGINE_2)
STRUCT_P(HashTable, static_members, HashTable_zval_ptr)
# endif
#endif /* ZEND_ENGINE_2_4 */
#ifdef ZEND_ENGINE_2
STRUCT(HashTable, constants_table, HashTable_zval_ptr)
#ifdef ZEND_ENGINE_2_2
dnl runtime binding: ADD_INTERFACE will deal with it
COPYNULL(`interfaces')
COPYZERO(`num_interfaces')
# ifdef ZEND_ENGINE_2_4
dnl runtime binding: ADD_TRAIT will deal with it
COPYNULL(traits)
COPYZERO(num_traits)
STRUCT_ARRAY(, , zend_trait_alias_ptr, trait_aliases)
STRUCT_ARRAY(, , zend_trait_precedence_ptr, trait_precedences)
# endif
#else
IFRESTORE(`
if (SRC(`num_interfaces')) {
CALLOC(DST(`interfaces'), zend_class_entry*, SRC(`num_interfaces'))
DONE(`interfaces')
}
else {
COPYNULL(`interfaces')
}
', `
DONE(`interfaces')
')
PROCESS(zend_uint, num_interfaces)
#endif
# ifdef ZEND_ENGINE_2_4
DISABLECHECK(`
IFRESTORE(`DST(`info.user.filename') = processor->entry_php_src->filepath.str;', `PROC_STRING(info.user.filename)')
PROCESS(zend_uint, info.user.line_start)
PROCESS(zend_uint, info.user.line_end)
PROCESS(zend_uint, info.user.doc_comment_len)
PROC_ZSTRING_L(, info.user.doc_comment, info.user.doc_comment_len)
')
DONE(info)
# else
IFRESTORE(`DST(`filename') = processor->entry_php_src->filepath.str;DONE(filename)', `PROC_STRING(filename)')
PROCESS(zend_uint, line_start)
PROCESS(zend_uint, line_end)
PROCESS(zend_uint, doc_comment_len)
PROC_ZSTRING_L(, doc_comment, doc_comment_len)
# endif
/* # NOT DONE */
# ifdef ZEND_ENGINE_2_1
PROCESS_CTEXTPOINTER(serialize_func)
PROCESS_CTEXTPOINTER(unserialize_func)
# endif
PROCESS_CTEXTPOINTER(iterator_funcs)
PROCESS_CTEXTPOINTER(create_object)
PROCESS_CTEXTPOINTER(get_iterator)
PROCESS_CTEXTPOINTER(interface_gets_implemented)
# ifdef ZEND_ENGINE_2_3
PROCESS_CTEXTPOINTER(get_static_method)
# endif
# ifdef ZEND_ENGINE_2_1
PROCESS_CTEXTPOINTER(serialize)
PROCESS_CTEXTPOINTER(unserialize)
# endif
/* deal with it inside xc_fix_method */
SETNULL(constructor)
PROCESS_CTEXTPOINTER(destructor)
PROCESS_CTEXTPOINTER(clone)
PROCESS_CTEXTPOINTER(__get)
PROCESS_CTEXTPOINTER(__set)
/* should be >5.1 */
# ifdef ZEND_ENGINE_2_1
PROCESS_CTEXTPOINTER(__unset)
PROCESS_CTEXTPOINTER(__isset)
# endif
PROCESS_CTEXTPOINTER(__call)
# ifdef ZEND_CALLSTATIC_FUNC_NAME
PROCESS_CTEXTPOINTER(__callstatic)
# endif
# if defined(ZEND_ENGINE_2_2) || PHP_MAJOR_VERSION >= 6
PROCESS_CTEXTPOINTER(__tostring)
# endif
# if defined(ZEND_ENGINE_2_6)
PROCESS_CTEXTPOINTER(__debugInfo)
# endif
# ifndef ZEND_ENGINE_2_4
/* # NOT DONE */
PROCESS_CTEXTPOINTER(module)
# endif
#else /* ZEND_ENGINE_2 */
PROCESS_CTEXTPOINTER(handle_function_call)
PROCESS_CTEXTPOINTER(handle_property_get)
PROCESS_CTEXTPOINTER(handle_property_set)
#endif
dnl must do after SETNULL(constructor) and DST()->parent
STRUCT(HashTable, function_table, HashTable_zend_function)
IFRESTORE(`DST(`function_table.pDestructor') = ZEND_FUNCTION_DTOR;')
IFCALCCOPY(`
processor->active_class_entry_src = NULL;
IFCOPY(`processor->active_class_entry_dst = NULL;')
')
')
dnl }}}
#ifdef ZEND_ENGINE_2_4
undefine(`UNION_znode_op')
define(`UNION_znode_op', `dnl {{{
#ifndef NDEBUG
switch ((SRC(`$1_type') ifelse($1, `result', & ~EXT_TYPE_UNUSED))) {
case IS_CONST:
case IS_VAR:
case IS_CV:
case IS_TMP_VAR:
case IS_UNUSED:
break;
default:
assert(0);
}
#endif
dnl dirty dispatch
DISABLECHECK(`
switch ((SRC(`$1_type') ifelse($1, `result', & ~EXT_TYPE_UNUSED))) {
case IS_CONST:
ifelse($1, `result', `
PROCESS(zend_uint, $1.constant)
', `
IFDASM(`{
zval *zv;
zval *srczv;
PROCESS(zend_uint, $1.var)
if (SRC(`$1.constant') < dasm->active_op_array_src->last_literal) {
srczv = &dasm->active_op_array_src->literals[SRC(`$1.constant')].constant;
ALLOC_ZVAL(zv);
MAKE_COPY_ZVAL(&srczv, zv);
add_assoc_zval_ex(DST(), XCACHE_STRS("$1.constant"), zv);
}
else {
dnl fprintf(stderr, "opcode %s $1 want literal %d\n", xc_get_opcode(SRC(`opcode')), SRC(`$1.constant'));
}
}
', `
IFCOPY(`
DST(`$1') = SRC(`$1');
', `
PROCESS(zend_uint, $1.constant)
')
')
')
break;
IFCOPY(`
IFNOTMEMCPY(`
default:
DST(`$1') = SRC(`$1');
')
', `
case IS_VAR:
case IS_TMP_VAR:
IFDASM(`
#ifdef ZEND_ENGINE_2_5
add_assoc_long_ex(DST(), XCACHE_STRS("$1.var"), (temp_variable *)0 - (temp_variable *)((int) SRC($1.var)) - 1);
break;
#endif
', `
/* no break */
')
case IS_CV:
PROCESS(zend_uint, $1.var)
break;
case IS_UNUSED:
IFDASM(`PROCESS(zend_uint, $1.var)')
PROCESS(zend_uint, $1.opline_num)
break;
')
}
')
DONE($1)