Lines Matching refs:f
628 function out($f, $s) { argument
631 fputs($f,$s);
636 function out_line($f) { argument
639 fputs($f,"#line ".($line_no+1)." \"".$executor_file."\"\n");
763 function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_spec=null) { argument
1030 out($f, $code);
1093 function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno, $opcode, $extra_spe… argument
1119 out($f, "#line $lineno \"$definition_file\"\n");
1150 out($f, $code);
1156 …out($f,"static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_INLINE_HANDLE…
1159 …out($f,"static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_…
1162 …out($f,"static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE…
1164 …out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS…
1170 out($f,"case $cur: /* $spec_name */");
1173 out($f,"case ".$name.":");
1177 out($f," {$spec_name}_LABEL:\n");
1179 out($f,"\n");
1183 out($f,"{$spec_name}_LABEL: ZEND_VM_GUARD($spec_name);\n");
1188 gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name, $extra_spec);
1191 …out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL {$spec_name}_HANDLER(ZEND_OPCODE_HANDLER_ARGS…
1192 out($f,"{\n");
1193 … out($f,"\tZEND_VM_TAIL_CALL({$spec_name}_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));\n");
1194 out($f,"}\n");
1195 out($f,"\n");
1200 function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno, $inline, $cold = f… argument
1212 out($f, "#line $lineno \"$definition_file\"\n");
1220 out($f, $spec_name . "_LABEL:\n");
1236 …out($f, "static$zend_attributes ZEND_OPCODE_HANDLER_RET$zend_fastcall $spec_name(ZEND_OPCODE_HANDL…
1239 …out($f, "static$zend_attributes ZEND_OPCODE_HANDLER_RET$zend_fastcall $spec_name($param ZEND_OPCOD…
1243 out($f, "$spec_name:\n");
1246 out($f, "$spec_name:\n");
1251 gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name, $extra_spec);
1255 function gen_null_label($f, $kind, $prolog) { argument
1258 out($f,$prolog."ZEND_NULL_HANDLER,\n");
1261 out($f,$prolog."(void*)(uintptr_t)-1,\n");
1264 out($f,$prolog."(void*)&&ZEND_NULL_LABEL,\n");
1270 function gen_labels($f, $spec, $kind, $prolog, &$specs, $switch_labels = array()) { argument
1413 …$generate = function ($op1, $op2, $extra_spec = array()) use ($f, $kind, $dsc, $prefix, $prolog, $…
1422 gen_null_label($f, $kind, $prolog);
1442 out($f,"$prolog{$spec_name}_HANDLER,\n");
1445 out($f,$prolog."(void*)(uintptr_t)$switch_labels[$spec_name],\n");
1448 out($f,$prolog."(void*)&&{$spec_name}_LABEL,\n");
1455 gen_null_label($f, $kind, $prolog);
1490 out($f,$prolog."ZEND_NULL_HANDLER,\n");
1493 out($f,$prolog."(void*)(uintptr_t)-1,\n");
1496 out($f,$prolog."(void*)&&ZEND_NULL_LABEL,\n");
1510 out($f,$prolog.$dsc['alias']."_HANDLER,\n");
1513 out($f,$prolog."(void*)&&".$dsc['alias']."_LABEL,\n");
1521 out($f,$prolog.$dsc["op"]."_HANDLER,\n");
1524 out($f,$prolog."(void*)(uintptr_t)".((string)$num).",\n");
1527 out($f,$prolog."(void*)&&".$dsc["op"]."_LABEL,\n");
1534 out($f,$prolog."ZEND_NULL_HANDLER,\n");
1537 out($f,$prolog."(void*)(uintptr_t)-1,\n");
1540 out($f,$prolog."(void*)&&ZEND_NULL_LABEL,\n");
1551 out($f,$prolog."ZEND_NULL_HANDLER\n");
1554 out($f,$prolog."(void*)(uintptr_t)-1\n");
1557 out($f,$prolog."(void*)&&ZEND_NULL_LABEL\n");
1574 function gen_specs($f, $prolog, $specs) { argument
1579 out($f, "$prolog$lastdef,\n");
1582 out($f, "$prolog$def,\n");
1584 out($f, "$prolog$lastdef\n");
1588 function gen_null_handler($f) { argument
1595 …out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n…
1596 out($f,"{\n");
1597 out($f,"\tUSE_OPLINE\n");
1598 out($f,"\n");
1599 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
1600 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
1601 out($f,"}\n\n");
1678 $f = function($specs) use (&$f) {
1682 $next = $f($specs);
1694 return $f($specs);
1698 $f = fopen($fn, "r");
1699 if (!is_resource($f)) {
1703 while (!feof($f)) {
1704 $op = trim(fgets($f));
1709 fclose($f);
1714 function gen_executor_code($f, $spec, $kind, $prolog, &$switch_labels = array()) { argument
1740 …gen_handler($f, 1, $kind, $opcodes[$num]["op"], $op1, $op2, isset($opcodes[$num]["use"]), $opcodes…
1750 …gen_helper($f, 1, $kind, $num, $op1, $op2, $helpers[$num]["param"], $helpers[$num]["code"], $linen…
1769 …gen_handler($f, 0, $kind, $opcodes[$num]["op"], "ANY", "ANY", isset($opcodes[$num]["use"]), $opcod…
1774 …gen_helper($f, 0, $kind, $num, "ANY", "ANY", $helpers[$num]["param"], $helpers[$num]["code"], $lin…
1785 out($f, $txt);
1792 out_line($f);
1798 gen_null_handler($f);
1801 out($f,"default: ZEND_NULL_LABEL:\n");
1802 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
1803 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
1806 out($f,"ZEND_NULL_LABEL:\n");
1807 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
1808 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
1811 out($f,"\t\t\tHYBRID_CASE(HYBRID_HALT):\n");
1812 out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
1813 out($f,"\t\t\t\texecute_data = orig_execute_data;\n");
1814 out($f,"#endif\n");
1815 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
1816 out($f,"\t\t\t\topline = orig_opline;\n");
1817 out($f,"#endif\n");
1818 out($f,"\t\t\t\treturn;\n");
1819 out($f,"\t\t\tHYBRID_DEFAULT:\n");
1820 out($f,"\t\t\t\tVM_TRACE(ZEND_NULL)\n");
1821 out($f,"\t\t\t\tZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
1822 out($f,"\t\t\t\tHYBRID_BREAK(); /* Never reached */\n");
1827 function skip_blanks($f, $prolog, $epilog) { argument
1829 out($f, $prolog.$epilog);
1834 function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) { argument
1845 out($f,"#define SPEC_START_MASK 0x0000ffff\n");
1846 out($f,"#define SPEC_EXTRA_MASK 0xfffc0000\n");
1847 out($f,"#define SPEC_RULE_OP1 0x00010000\n");
1848 out($f,"#define SPEC_RULE_OP2 0x00020000\n");
1849 out($f,"#define SPEC_RULE_OP_DATA 0x00040000\n");
1850 out($f,"#define SPEC_RULE_RETVAL 0x00080000\n");
1851 out($f,"#define SPEC_RULE_QUICK_ARG 0x00100000\n");
1852 out($f,"#define SPEC_RULE_SMART_BRANCH 0x00200000\n");
1853 out($f,"#define SPEC_RULE_COMMUTATIVE 0x00800000\n");
1854 out($f,"#define SPEC_RULE_ISSET 0x01000000\n");
1855 out($f,"\n");
1856 out($f,"static const uint32_t *zend_spec_handlers;\n");
1857 out($f,"static const void * const *zend_opcode_handlers;\n");
1858 out($f,"static int zend_handlers_count;\n");
1860 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
1861 out($f,"static const void * const * zend_opcode_handler_funcs;\n");
1862 out($f,"static zend_op hybrid_halt_op;\n");
1863 out($f,"#endif\n");
1865 out($f,"#if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC\n");
1866 … out($f,"static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op);\n");
1867 out($f,"#endif\n\n");
1869 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
1870 …out($f,"static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op);\…
1871 out($f,"#else\n");
1872 … out($f,"# define zend_vm_get_opcode_handler_func zend_vm_get_opcode_handler\n");
1873 out($f,"#endif\n\n");
1875 out($f,"#ifndef VM_TRACE\n");
1876 out($f,"# define VM_TRACE(op)\n");
1877 out($f,"#endif\n");
1878 out($f,"#ifndef VM_TRACE_START\n");
1879 out($f,"# define VM_TRACE_START()\n");
1880 out($f,"#endif\n");
1881 out($f,"#ifndef VM_TRACE_END\n");
1882 out($f,"# define VM_TRACE_END()\n");
1883 out($f,"#endif\n");
1886 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
1887 out($f,"#define HYBRID_NEXT() goto *(void**)(OPLINE->handler)\n");
1888 out($f,"#define HYBRID_SWITCH() HYBRID_NEXT();\n");
1889 out($f,"#define HYBRID_CASE(op) op ## _LABEL\n");
1890 out($f,"#define HYBRID_BREAK() HYBRID_NEXT()\n");
1891 out($f,"#define HYBRID_DEFAULT ZEND_NULL_LABEL\n");
1892 out($f,"#endif\n");
1894 out($f,"\n");
1895 out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
1896 out($f,"# define ZEND_OPCODE_HANDLER_ARGS void\n");
1897 out($f,"# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU\n");
1898 out($f,"# define ZEND_OPCODE_HANDLER_ARGS_DC\n");
1899 out($f,"# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC\n");
1900 out($f,"#else\n");
1901 … out($f,"# define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data\n");
1902 out($f,"# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data\n");
1903 … out($f,"# define ZEND_OPCODE_HANDLER_ARGS_DC , ZEND_OPCODE_HANDLER_ARGS\n");
1904 … out($f,"# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC , ZEND_OPCODE_HANDLER_ARGS_PASSTHRU\n");
1905 out($f,"#endif\n");
1906 out($f,"\n");
1907 … out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
1908 out($f,"# define ZEND_OPCODE_HANDLER_RET void\n");
1909 out($f,"# define ZEND_VM_TAIL_CALL(call) call; return\n");
1910 out($f,"# ifdef ZEND_VM_TAIL_CALL_DISPATCH\n");
1911 …out($f,"# define ZEND_VM_CONTINUE() ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_A…
1912 out($f,"# else\n");
1913 out($f,"# define ZEND_VM_CONTINUE() return\n");
1914 out($f,"# endif\n");
1916 out($f,"# if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
1917 … out($f,"# define ZEND_VM_RETURN() opline = &hybrid_halt_op; return\n");
1918 … out($f,"# define ZEND_VM_HOT zend_always_inline ZEND_COLD ZEND_OPT_SIZE\n");
1919 … out($f,"# define ZEND_VM_COLD ZEND_COLD ZEND_OPT_SIZE\n");
1920 out($f,"# else\n");
1921 out($f,"# define ZEND_VM_RETURN() opline = NULL; return\n");
1922 out($f,"# define ZEND_VM_HOT\n");
1923 … out($f,"# define ZEND_VM_COLD ZEND_COLD ZEND_OPT_SIZE\n");
1924 out($f,"# endif\n");
1926 out($f,"# define ZEND_VM_RETURN() opline = NULL; return\n");
1927 … out($f,"# define ZEND_VM_COLD ZEND_COLD ZEND_OPT_SIZE\n");
1929 out($f,"#else\n");
1930 out($f,"# define ZEND_OPCODE_HANDLER_RET int\n");
1931 out($f,"# define ZEND_VM_TAIL_CALL(call) return call\n");
1932 out($f,"# define ZEND_VM_CONTINUE() return 0\n");
1933 out($f,"# define ZEND_VM_RETURN() return -1\n");
1935 out($f,"# define ZEND_VM_HOT\n");
1937 out($f,"# define ZEND_VM_COLD ZEND_COLD ZEND_OPT_SIZE\n");
1938 out($f,"#endif\n");
1939 out($f,"\n");
1940 …out($f,"typedef ZEND_OPCODE_HANDLER_RET (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARG…
1941 out($f,"\n");
1942 out($f,"#undef OPLINE\n");
1943 out($f,"#undef DCL_OPLINE\n");
1944 out($f,"#undef USE_OPLINE\n");
1945 out($f,"#undef LOAD_OPLINE\n");
1946 out($f,"#undef LOAD_OPLINE_EX\n");
1947 out($f,"#undef SAVE_OPLINE\n");
1948 out($f,"#undef SAVE_OPLINE_EX\n");
1949 out($f,"#define DCL_OPLINE\n");
1950 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
1951 out($f,"# define OPLINE opline\n");
1952 out($f,"# define USE_OPLINE\n");
1953 out($f,"# define LOAD_OPLINE() opline = EX(opline)\n");
1954 out($f,"# define LOAD_OPLINE_EX()\n");
1955 out($f,"# define LOAD_NEXT_OPLINE() opline = EX(opline) + 1\n");
1956 out($f,"# define SAVE_OPLINE() EX(opline) = opline\n");
1957 out($f,"# define SAVE_OPLINE_EX() SAVE_OPLINE()\n");
1958 out($f,"#else\n");
1959 out($f,"# define OPLINE EX(opline)\n");
1960 out($f,"# define USE_OPLINE const zend_op *opline = EX(opline);\n");
1961 out($f,"# define LOAD_OPLINE()\n");
1962 out($f,"# define LOAD_OPLINE_EX()\n");
1963 out($f,"# define LOAD_NEXT_OPLINE() ZEND_VM_INC_OPCODE()\n");
1964 out($f,"# define SAVE_OPLINE()\n");
1965 out($f,"# define SAVE_OPLINE_EX()\n");
1966 out($f,"#endif\n");
1967 out($f,"#undef HANDLE_EXCEPTION\n");
1968 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
1969 … out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
1970 … out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
1971 out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG)\n");
1972 … out($f,"# define ZEND_VM_ENTER_EX() ZEND_VM_INTERRUPT_CHECK(); ZEND_VM_CONTINUE()\n");
1973 …out($f,"# define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE();…
1974 out($f,"# define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
1975 out($f,"#elif defined(ZEND_VM_IP_GLOBAL_REG)\n");
1976 out($f,"# define ZEND_VM_ENTER_EX() return 1\n");
1977 …out($f,"# define ZEND_VM_ENTER() opline = EG(current_execute_data)->opline; ZEND_VM_ENTE…
1978 out($f,"# define ZEND_VM_LEAVE() return 2\n");
1979 out($f,"#else\n");
1980 out($f,"# define ZEND_VM_ENTER_EX() return 1\n");
1981 out($f,"# define ZEND_VM_ENTER() return 1\n");
1982 out($f,"# define ZEND_VM_LEAVE() return 2\n");
1983 out($f,"#endif\n");
1984 …out($f,"#define ZEND_VM_INTERRUPT() ZEND_VM_TAIL_CALL(zend_interrupt_helper".($spec?"_SPEC":"…
1985 …out($f,"#define ZEND_VM_LOOP_INTERRUPT() zend_interrupt_helper".($spec?"_SPEC":"")."(ZEND_OPCODE_H…
1987 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) ZEND_VM_TAIL_CALL(((opcode_handler_t)zend_vm_get_…
1989 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) ZEND_VM_TAIL_CALL(((opcode_handler_t)zend_vm_get_…
1991 out($f,"\n");
1992 …out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_interrupt_helper".($spec?"_SPEC":"")."(Z…
1993 …out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS);\…
1994 out($f,"\n");
1997 out($f,"\n");
1998 out($f,"#undef OPLINE\n");
1999 out($f,"#undef DCL_OPLINE\n");
2000 out($f,"#undef USE_OPLINE\n");
2001 out($f,"#undef LOAD_OPLINE\n");
2002 out($f,"#undef LOAD_OPLINE_EX\n");
2003 out($f,"#undef LOAD_NEXT_OPLINE\n");
2004 out($f,"#undef SAVE_OPLINE\n");
2005 out($f,"#undef SAVE_OPLINE_EX\n");
2006 out($f,"#define OPLINE opline\n");
2007 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
2008 … out($f,"# define DCL_OPLINE register const zend_op *opline __asm__(ZEND_VM_IP_GLOBAL_REG);\n");
2009 out($f,"#else\n");
2010 out($f,"# define DCL_OPLINE const zend_op *opline;\n");
2011 out($f,"#endif\n");
2012 out($f,"#define USE_OPLINE\n");
2013 out($f,"#define LOAD_OPLINE() opline = EX(opline)\n");
2014 out($f,"# define LOAD_OPLINE_EX() LOAD_OPLINE()\n");
2015 out($f,"#define LOAD_NEXT_OPLINE() opline = EX(opline) + 1\n");
2016 out($f,"#define SAVE_OPLINE() EX(opline) = opline\n");
2017 out($f,"#define SAVE_OPLINE_EX()\n");
2018 out($f,"#undef HANDLE_EXCEPTION\n");
2019 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
2020 … out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
2021 … out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
2022 out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n");
2023 out($f,"#define ZEND_VM_RETURN() return\n");
2024 … out($f,"#define ZEND_VM_ENTER_EX() ZEND_VM_INTERRUPT_CHECK(); ZEND_VM_CONTINUE()\n");
2025 …out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM…
2026 out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
2027 …out($f,"#define ZEND_VM_INTERRUPT() goto zend_interrupt_helper".($spec?"_SPEC":"").";…
2028 …out($f,"#define ZEND_VM_LOOP_INTERRUPT() goto zend_interrupt_helper".($spec?"_SPEC":"").";…
2029 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opc…
2030 out($f,"\n");
2033 out($f,"\n");
2034 out($f,"#undef OPLINE\n");
2035 out($f,"#undef DCL_OPLINE\n");
2036 out($f,"#undef USE_OPLINE\n");
2037 out($f,"#undef LOAD_OPLINE\n");
2038 out($f,"#undef LOAD_OPLINE_EX\n");
2039 out($f,"#undef LOAD_NEXT_OPLINE\n");
2040 out($f,"#undef SAVE_OPLINE\n");
2041 out($f,"#undef SAVE_OPLINE_EX\n");
2042 out($f,"#define OPLINE opline\n");
2043 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
2044 … out($f,"# define DCL_OPLINE register const zend_op *opline __asm__(ZEND_VM_IP_GLOBAL_REG);\n");
2045 out($f,"#else\n");
2046 out($f,"# define DCL_OPLINE const zend_op *opline;\n");
2047 out($f,"#endif\n");
2048 out($f,"#define USE_OPLINE\n");
2049 out($f,"#define LOAD_OPLINE() opline = EX(opline)\n");
2050 out($f,"#define LOAD_OPLINE_EX() LOAD_OPLINE()\n");
2051 out($f,"#define LOAD_NEXT_OPLINE() opline = EX(opline) + 1\n");
2052 out($f,"#define SAVE_OPLINE() EX(opline) = opline\n");
2053 out($f,"#define SAVE_OPLINE_EX()\n");
2054 out($f,"#undef HANDLE_EXCEPTION\n");
2055 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
2057 … out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_SPEC_LABEL\n");
2058 … out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_SPEC_LABEL\n");
2060 … out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_LABEL\n");
2061 … out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_LABEL\n");
2063 out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
2064 out($f,"#define ZEND_VM_RETURN() return\n");
2065 … out($f,"#define ZEND_VM_ENTER_EX() ZEND_VM_INTERRUPT_CHECK(); ZEND_VM_CONTINUE()\n");
2066 …out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM…
2067 out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
2068 …out($f,"#define ZEND_VM_INTERRUPT() goto zend_interrupt_helper".($spec?"_SPEC":"").";…
2069 …out($f,"#define ZEND_VM_LOOP_INTERRUPT() goto zend_interrupt_helper".($spec?"_SPEC":"").";…
2070 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode,…
2071 out($f,"\n");
2075 gen_executor_code($f, $spec, ZEND_VM_KIND_CALL, $m[1]);
2076 out($f,"\n");
2077 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
2078 out($f,"# undef ZEND_VM_TAIL_CALL\n");
2079 out($f,"# undef ZEND_VM_CONTINUE\n");
2080 out($f,"# undef ZEND_VM_RETURN\n");
2082 out($f,"\n");
2083 out($f,"# define ZEND_VM_TAIL_CALL(call) call; ZEND_VM_CONTINUE()\n");
2084 out($f,"# define ZEND_VM_CONTINUE() HYBRID_NEXT()\n");
2085 out($f,"# define ZEND_VM_RETURN() goto HYBRID_HALT_LABEL\n");
2087 out($f,"#endif\n\n");
2091 out($f, $m[1].$executor_name.$m[3]."\n");
2095 out($f,$m[1]."const void *dispatch_handler;\n");
2099 out($f, "#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
2103 out($f,$m[1].$param.";\n");
2106 out($f, "#endif\n");
2110 out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
2111 … out($f,$m[1]."register zend_execute_data *execute_data __asm__(ZEND_VM_FP_GLOBAL_REG) = ex;\n");
2112 out($f,"#else\n");
2113 out($f,$m[1]."zend_execute_data *execute_data = ex;\n");
2114 out($f,"#endif\n");
2116 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
2117 out($f,$m[1]."const zend_op *orig_opline = opline;\n");
2118 out($f,"#endif\n");
2119 out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
2120 out($f,$m[1]."zend_execute_data *orig_execute_data = execute_data;\n");
2121 out($f,$m[1]."execute_data = ex;\n");
2122 out($f,"#else\n");
2123 out($f,$m[1]."zend_execute_data *execute_data = ex;\n");
2124 out($f,"#endif\n");
2132 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
2135 out($f,$prolog."if (UNEXPECTED(execute_data == NULL)) {\n");
2136 out($f,$prolog."\tstatic const void * const labels[] = {\n");
2137 …gen_labels($f, $spec, ($kind == ZEND_VM_KIND_HYBRID) ? ZEND_VM_KIND_GOTO : $kind, $prolog."\t\t", …
2138 out($f,$prolog."\t};\n");
2139 out($f,$prolog."\tzend_opcode_handlers = (const void **) labels;\n");
2140 out($f,$prolog."\tzend_handlers_count = sizeof(labels) / sizeof(void*);\n");
2142 … out($f,$prolog."\tmemset(&hybrid_halt_op, 0, sizeof(hybrid_halt_op));\n");
2143 … out($f,$prolog."\thybrid_halt_op.handler = (void*)&&HYBRID_HALT_LABEL;\n");
2144 out($f,$prolog."\tgoto HYBRID_HALT_LABEL;\n");
2146 out($f,$prolog."\treturn;\n");
2148 out($f,$prolog."}\n");
2150 out($f,"#endif\n");
2153 skip_blanks($f, $m[1], $m[3]);
2159 … out($f,"#if !defined(ZEND_VM_FP_GLOBAL_REG) || !defined(ZEND_VM_IP_GLOBAL_REG)\n");
2160 out($f,$m[1]."\tint ret;".$m[3]."\n");
2161 out($f,"#endif\n");
2164 out($f,"zend_vm_continue:".$m[3]."\n");
2166 skip_blanks($f, $m[1], $m[3]);
2173 …out($f, $m[1]."dispatch_handler = OPLINE->handler;\nzend_vm_dispatch:\n".$m[1]."switch ((int)(uint…
2176 out($f, $m[1]."goto *(void**)(OPLINE->handler);".$m[3]."\n");
2179 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
2180 out($f, $m[1]."HYBRID_SWITCH()".$m[3]."\n");
2181 out($f,"#else\n");
2183 … out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
2184 … out($f, $m[1]."((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
2185 out($f, $m[1]."if (UNEXPECTED(!OPLINE))".$m[3]."\n");
2186 out($f,"#else\n");
2187 …out($f, $m[1]."if (UNEXPECTED((ret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_…
2188 out($f,"#endif\n");
2190 out($f,"#endif\n");
2199 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
2201 gen_executor_code($f, $spec, $kind, $m[1], $switch_labels);
2206 out($f,"#else\n");
2208 out($f,
2227 out($f,"#endif\n");
2233 gen_executor_code($f, $spec, $kind, $m[1]);
2237 out($f, $m[1].$initializer_name.$m[3]."\n");
2245 out($f,$prolog."static const uint32_t specs[] = {\n");
2246 gen_specs($f, $prolog."\t", $specs);
2247 out($f,$prolog."};\n");
2248 out($f,$prolog."zend_spec_handlers = specs;\n");
2249 out($f,$prolog.$executor_name."_ex(NULL);\n");
2251 out($f,$prolog."static const void * const labels[] = {\n");
2252 …gen_labels($f, $spec, ($kind == ZEND_VM_KIND_HYBRID) ? ZEND_VM_KIND_CALL : $kind, $prolog."\t", $s…
2253 out($f,$prolog."};\n");
2254 out($f,$prolog."static const uint32_t specs[] = {\n");
2255 gen_specs($f, $prolog."\t", $specs);
2256 out($f,$prolog."};\n");
2258 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
2259 out($f,$prolog."zend_opcode_handler_funcs = labels;\n");
2260 out($f,$prolog."zend_spec_handlers = specs;\n");
2261 out($f,$prolog.$executor_name."_ex(NULL);\n");
2262 out($f,"#else\n");
2264 out($f,$prolog."zend_opcode_handlers = labels;\n");
2265 out($f,$prolog."zend_handlers_count = sizeof(labels) / sizeof(void*);\n");
2266 out($f,$prolog."zend_spec_handlers = specs;\n");
2268 out($f,"#endif\n");
2277 out($f, $line);
2625 …$f = fopen(__DIR__ . "/zend_vm_opcodes.h", "w+") or die("ERROR: Cannot create zend_vm_opcodes.h\n"…
2628 out($f, HEADER_TEXT);
2629 fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n");
2630 fputs($f, "#define ZEND_VM_SPEC\t\t" . ZEND_VM_SPEC . "\n");
2631 fputs($f, "#define ZEND_VM_LINES\t\t" . ZEND_VM_LINES . "\n");
2632 fputs($f, "#define ZEND_VM_KIND_CALL\t" . ZEND_VM_KIND_CALL . "\n");
2633 fputs($f, "#define ZEND_VM_KIND_SWITCH\t" . ZEND_VM_KIND_SWITCH . "\n");
2634 fputs($f, "#define ZEND_VM_KIND_GOTO\t" . ZEND_VM_KIND_GOTO . "\n");
2635 fputs($f, "#define ZEND_VM_KIND_HYBRID\t" . ZEND_VM_KIND_HYBRID . "\n");
2637 fputs($f, "/* HYBRID requires support for computed GOTO and global register variables*/\n");
2638 fputs($f, "#if (defined(__GNUC__) && defined(HAVE_GCC_GLOBAL_REGS))\n");
2639 fputs($f, "# define ZEND_VM_KIND\t\tZEND_VM_KIND_HYBRID\n");
2640 fputs($f, "#else\n");
2641 fputs($f, "# define ZEND_VM_KIND\t\tZEND_VM_KIND_CALL\n");
2642 fputs($f, "#endif\n");
2644 fputs($f, "#define ZEND_VM_KIND\t\t" . $GLOBALS["vm_kind_name"][ZEND_VM_KIND] . "\n");
2646 fputs($f, "\n");
2648 fprintf($f, "#define %-24s 0x%08x\n", $name, $val);
2650 fputs($f, "#define ZEND_VM_OP1_FLAGS(flags) (flags & 0xff)\n");
2651 fputs($f, "#define ZEND_VM_OP2_FLAGS(flags) ((flags >> 8) & 0xff)\n");
2652 fputs($f, "\n");
2653 fputs($f, "BEGIN_EXTERN_C()\n\n");
2654 fputs($f, "ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode);\n");
2655 fputs($f, "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode);\n\n");
2656 fputs($f, "END_EXTERN_C()\n\n");
2662 fputs($f,"#define $op $code\n");
2668 fputs($f,"\n#define $op $code\n");
2670 fputs($f, "\n#endif\n");
2671 fclose($f);
2675 …$f = fopen(__DIR__ . "/zend_vm_opcodes.c", "w+") or die("ERROR: Cannot create zend_vm_opcodes.c\n"…
2678 out($f, HEADER_TEXT);
2679 fputs($f,"#include <stdio.h>\n");
2680 fputs($f,"#include <zend.h>\n");
2681 fputs($f,"#include <zend_vm_opcodes.h>\n\n");
2683 fputs($f,"static const char *zend_vm_opcodes_names[".($max_opcode + 1)."] = {\n");
2685 fputs($f,"\t".(isset($opcodes[$i]["op"])?'"'.$opcodes[$i]["op"].'"':"NULL").",\n");
2687 fputs($f, "};\n\n");
2689 fputs($f,"static uint32_t zend_vm_opcodes_flags[".($max_opcode + 1)."] = {\n");
2691 fprintf($f, "\t0x%08x,\n", isset($opcodes[$i]["flags"]) ? $opcodes[$i]["flags"] : 0);
2693 fputs($f, "};\n\n");
2695 fputs($f, "ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode) {\n");
2696 fputs($f, "\tif (UNEXPECTED(opcode > ZEND_VM_LAST_OPCODE)) {\n");
2697 fputs($f, "\t\treturn NULL;\n");
2698 fputs($f, "\t}\n");
2699 fputs($f, "\treturn zend_vm_opcodes_names[opcode];\n");
2700 fputs($f, "}\n");
2702 fputs($f, "ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode) {\n");
2703 fputs($f, "\tif (UNEXPECTED(opcode > ZEND_VM_LAST_OPCODE)) {\n");
2704 fputs($f, "\t\topcode = ZEND_NOP;\n");
2705 fputs($f, "\t}\n");
2706 fputs($f, "\treturn zend_vm_opcodes_flags[opcode];\n");
2707 fputs($f, "}\n");
2709 fclose($f);
2713 …$f = fopen(__DIR__ . "/zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n"…
2717 out($f, HEADER_TEXT);
2719 out($f, "#ifdef ZEND_WIN32\n");
2721 out($f, "# pragma warning(disable : 4101)\n");
2724 out($f, "# pragma warning(once : 6235)\n");
2726 out($f, "# pragma warning(once : 6237)\n");
2728 out($f, "# pragma warning(once : 6239)\n");
2730 out($f, "# pragma warning(once : 6240)\n");
2732 out($f, "# pragma warning(once : 6285)\n");
2734 out($f, "# pragma warning(once : 6286)\n");
2736 out($f, "# pragma warning(once : 6326)\n");
2738 out($f, "#endif\n");
2741 out($f, "static user_opcode_handler_t zend_user_opcode_handlers[256] = {\n");
2743 out($f, "\t(user_opcode_handler_t)NULL,\n");
2745 out($f, "\t(user_opcode_handler_t)NULL\n};\n\n");
2747 out($f, "static zend_uchar zend_user_opcodes[256] = {");
2749 if ($i % 16 == 1) out($f, "\n\t");
2750 out($f, "$i,");
2752 out($f, "255\n};\n\n");
2755 gen_executor($f, $skl, ZEND_VM_SPEC, ZEND_VM_KIND, "execute", "zend_vm_init");
2756 out($f, "\n");
2759 …out($f, "static const void* ZEND_FASTCALL zend_vm_get_opcode_handler_ex(uint32_t spec, const zend_…
2760 out($f, "{\n");
2762 out($f, "\treturn zend_opcode_handlers[spec];\n");
2764 out($f, "\tstatic const int zend_vm_decode[] = {\n");
2765 out($f, "\t\t_UNUSED_CODE, /* 0 = IS_UNUSED */\n");
2766 out($f, "\t\t_CONST_CODE, /* 1 = IS_CONST */\n");
2767 out($f, "\t\t_TMP_CODE, /* 2 = IS_TMP_VAR */\n");
2768 out($f, "\t\t_UNUSED_CODE, /* 3 */\n");
2769 out($f, "\t\t_VAR_CODE, /* 4 = IS_VAR */\n");
2770 out($f, "\t\t_UNUSED_CODE, /* 5 */\n");
2771 out($f, "\t\t_UNUSED_CODE, /* 6 */\n");
2772 out($f, "\t\t_UNUSED_CODE, /* 7 */\n");
2773 out($f, "\t\t_CV_CODE /* 8 = IS_CV */\n");
2774 out($f, "\t};\n");
2775 out($f, "\tuint32_t offset = 0;\n");
2776 … out($f, "\tif (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];\n");
2777 … out($f, "\tif (spec & SPEC_RULE_OP2) offset = offset * 5 + zend_vm_decode[op->op2_type];\n");
2786 out($f, "\tif (spec & SPEC_EXTRA_MASK) {\n");
2789 out($f, "\t\t{$else}if (spec & SPEC_RULE_RETVAL) {\n");
2790 out($f, "\t\t\toffset = offset * 2 + (op->result_type != IS_UNUSED);\n");
2794 out($f, "\t\t{$else}if (spec & SPEC_RULE_QUICK_ARG) {\n");
2795 out($f, "\t\t\toffset = offset * 2 + (op->op2.num <= MAX_ARG_FLAG_NUM);\n");
2799 out($f, "\t\t{$else}if (spec & SPEC_RULE_OP_DATA) {\n");
2800 out($f, "\t\t\toffset = offset * 5 + zend_vm_decode[(op + 1)->op1_type];\n");
2804 out($f, "\t\t{$else}if (spec & SPEC_RULE_ISSET) {\n");
2805 out($f, "\t\t\toffset = offset * 2 + (op->extended_value & ZEND_ISEMPTY);\n");
2809 out($f, "\t\t{$else}if (spec & SPEC_RULE_SMART_BRANCH) {\n");
2810 out($f, "\t\t\toffset = offset * 3;\n");
2811 out($f, "\t\t\tif ((op+1)->opcode == ZEND_JMPZ) {\n");
2812 out($f, "\t\t\t\toffset += 1;\n");
2813 out($f, "\t\t\t} else if ((op+1)->opcode == ZEND_JMPNZ) {\n");
2814 out($f, "\t\t\t\toffset += 2;\n");
2815 out($f, "\t\t\t}\n");
2819 out($f, "\t\t}\n");
2821 out($f, "\t}\n");
2823 out($f, "\treturn zend_opcode_handlers[(spec & SPEC_START_MASK) + offset];\n");
2825 out($f, "}\n\n");
2826 out($f, "#if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC\n");
2827 … out($f, "static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op)\n");
2828 out($f, "{\n");
2830 out($f, "\treturn zend_vm_get_opcode_handler_ex(opcode, op);\n");
2832 out($f, "\treturn zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);\n");
2834 out($f, "}\n");
2835 out($f, "#endif\n\n");
2839 out($f, "#if ZEND_VM_KIND == ZEND_VM_KIND_HYBRID\n");
2840 …out($f,"static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op)\n…
2841 out($f, "{\n");
2842 out($f, "\tuint32_t spec = zend_spec_handlers[opcode];\n");
2844 out($f, "\treturn zend_opcode_handler_funcs[spec];\n");
2846 out($f, "\tstatic const int zend_vm_decode[] = {\n");
2847 out($f, "\t\t_UNUSED_CODE, /* 0 = IS_UNUSED */\n");
2848 out($f, "\t\t_CONST_CODE, /* 1 = IS_CONST */\n");
2849 out($f, "\t\t_TMP_CODE, /* 2 = IS_TMP_VAR */\n");
2850 out($f, "\t\t_UNUSED_CODE, /* 3 */\n");
2851 out($f, "\t\t_VAR_CODE, /* 4 = IS_VAR */\n");
2852 out($f, "\t\t_UNUSED_CODE, /* 5 */\n");
2853 out($f, "\t\t_UNUSED_CODE, /* 6 */\n");
2854 out($f, "\t\t_UNUSED_CODE, /* 7 */\n");
2855 out($f, "\t\t_CV_CODE /* 8 = IS_CV */\n");
2856 out($f, "\t};\n");
2857 out($f, "\tuint32_t offset = 0;\n");
2858 … out($f, "\tif (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];\n");
2859 … out($f, "\tif (spec & SPEC_RULE_OP2) offset = offset * 5 + zend_vm_decode[op->op2_type];\n");
2868 out($f, "\tif (spec & SPEC_EXTRA_MASK) {\n");
2871 …out($f, "\t\t{$else}if (spec & SPEC_RULE_OP_DATA) offset = offset * 5 + zend_vm_decode[(op + 1)->o…
2875 …out($f, "\t\t{$else}if (spec & SPEC_RULE_RETVAL) offset = offset * 2 + (op->result_type != IS_UNUS…
2879 …out($f, "\t\t{$else}if (spec & SPEC_RULE_QUICK_ARG) offset = offset * 2 + (op->op2.num <= MAX_ARG_…
2883 out($f, "\t\t{$else}if (spec & SPEC_RULE_SMART_BRANCH) {\n");
2884 out($f, "\t\t\toffset = offset * 3;\n");
2885 out($f, "\t\t\tif ((op+1)->opcode == ZEND_JMPZ) {\n");
2886 out($f, "\t\t\t\toffset += 1;\n");
2887 out($f, "\t\t\t} else if ((op+1)->opcode == ZEND_JMPNZ) {\n");
2888 out($f, "\t\t\t\toffset += 2;\n");
2889 out($f, "\t\t\t}\n");
2890 out($f, "\t\t}\n");
2894 …out($f, "\t\t{$else}if (spec & SPEC_RULE_ISSET) offset = offset * 2 + (op->extended_value & ZEND_I…
2897 out($f, "\t}\n");
2900 out($f, "\treturn zend_opcode_handler_funcs[(spec & SPEC_START_MASK) + offset];\n");
2902 out($f, "}\n\n");
2903 out($f, "#endif\n\n");
2907 out($f, "ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* op)\n");
2908 out($f, "{\n");
2909 out($f, "\tzend_uchar opcode = zend_user_opcodes[op->opcode];\n");
2911 out($f, "\top->handler = zend_vm_get_opcode_handler(opcode, op);\n");
2913 out($f, "\n");
2914 out($f, "\tif (zend_spec_handlers[op->opcode] & SPEC_RULE_COMMUTATIVE) {\n");
2915 out($f, "\t\tif (op->op1_type < op->op2_type) {\n");
2916 out($f, "\t\t\tzend_swap_operands(op);\n");
2917 out($f, "\t\t}\n");
2918 out($f, "\t}\n");
2919 out($f, "\top->handler = zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);\n");
2921 out($f, "}\n\n");
2924 …out($f, "ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info,…
2925 out($f, "{\n");
2926 out($f, "\tzend_uchar opcode = zend_user_opcodes[op->opcode];\n");
2928 out($f, "\top->handler = zend_vm_get_opcode_handler_ex(opcode, op);\n");
2930 out($f, "\tuint32_t spec = zend_spec_handlers[opcode];\n");
2932 out($f, "\tswitch (opcode) {\n");
2936 out($f, "\t\tcase $orig_op:\n");
2938 out($f, "\t\t\tif (op->op1_type < op->op2_type) {\n");
2939 out($f, "\t\t\t\tzend_swap_operands(op);\n");
2940 out($f, "\t\t\t}\n");
2946 out($f, "\t\t\tif $condition {\n");
2949 out($f, "\t\t\t} else if $condition {\n");
2953 … out($f, "\t\t\t\tif (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {\n");
2954 out($f, "\t\t\t\t\tbreak;\n");
2955 out($f, "\t\t\t\t}\n");
2957 out($f, "\t\t\t\tspec = ${spec_dsc['spec_code']};\n");
2959 out($f, "\t\t\t\tif (op->op1_type < op->op2_type) {\n");
2960 out($f, "\t\t\t\t\tzend_swap_operands(op);\n");
2961 out($f, "\t\t\t\t}\n");
2965 out($f, "\t\t\t}\n");
2967 out($f, "\t\t\tbreak;\n");
2976 out($f, "\t\tcase $orig_op:\n");
2981 out($f, "\t\t\tif (op->op1_type < op->op2_type) {\n");
2982 out($f, "\t\t\t\tzend_swap_operands(op);\n");
2983 out($f, "\t\t\t}\n");
2984 out($f, "\t\t\tbreak;\n");
2985 out($f, "\t\tcase ZEND_USER_OPCODE:\n");
2986 out($f, "\t\t\tif (zend_spec_handlers[op->opcode] & SPEC_RULE_COMMUTATIVE) {\n");
2987 out($f, "\t\t\t\tif (op->op1_type < op->op2_type) {\n");
2988 out($f, "\t\t\t\t\tzend_swap_operands(op);\n");
2989 out($f, "\t\t\t\t}\n");
2990 out($f, "\t\t\t}\n");
2991 out($f, "\t\t\tbreak;\n");
2993 out($f, "\t\tdefault:\n");
2994 out($f, "\t\t\tbreak;\n");
2995 out($f, "\t}\n");
2997 out($f, "\top->handler = zend_vm_get_opcode_handler_ex(spec, op);\n");
2999 out($f, "}\n\n");
3003 out($f, "ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data* ex)\n");
3004 out($f, "{\n");
3006 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
3007 out($f, "\topcode_handler_t handler;\n");
3008 out($f,"#endif\n");
3010 out($f, "\tint ret;\n");
3011 out($f, "#ifdef ZEND_VM_IP_GLOBAL_REG\n");
3012 out($f, "\tconst zend_op *orig_opline = opline;\n");
3013 out($f, "#endif\n");
3014 out($f, "#ifdef ZEND_VM_FP_GLOBAL_REG\n");
3015 out($f, "\tzend_execute_data *orig_execute_data = execute_data;\n");
3016 out($f, "\texecute_data = ex;\n");
3017 out($f, "#else\n");
3018 out($f, "\tzend_execute_data *execute_data = ex;\n");
3019 out($f, "#endif\n");
3020 out($f, "\n");
3021 out($f, "\tLOAD_OPLINE();\n");
3022 out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
3024 out($f,"#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
3025 …out($f, "\thandler = (opcode_handler_t)zend_vm_get_opcode_handler_func(zend_user_opcodes[opline->o…
3026 out($f, "\thandler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
3027 out($f, "\tif (EXPECTED(opline != &hybrid_halt_op)) {\n");
3028 out($f,"#else\n");
3030 out($f, "\t((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
3032 out($f, "\tif (EXPECTED(opline)) {\n");
3033 out($f,"#endif\n");
3035 out($f, "\tif (EXPECTED(opline)) {\n");
3037 … out($f, "\t\tret = execute_data != ex ? (int)(execute_data->prev_execute_data != ex) + 1 : 0;\n");
3038 out($f, "\t\tSAVE_OPLINE();\n");
3039 out($f, "\t} else {\n");
3040 out($f, "\t\tret = -1;\n");
3041 out($f, "\t}\n");
3042 out($f, "#else\n");
3043 … out($f, "\tret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
3044 out($f, "\tSAVE_OPLINE();\n");
3045 out($f, "#endif\n");
3046 out($f, "#ifdef ZEND_VM_FP_GLOBAL_REG\n");
3047 out($f, "\texecute_data = orig_execute_data;\n");
3048 out($f, "#endif\n");
3049 out($f, "#ifdef ZEND_VM_IP_GLOBAL_REG\n");
3050 out($f, "\topline = orig_opline;\n");
3051 out($f, "#endif\n");
3052 out($f, "\treturn ret;\n");
3053 out($f, "}\n\n");
3055 out($f, "ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data* ex)\n");
3056 out($f, "{\n");
3057 …out($f, "\tzend_error_noreturn(E_CORE_ERROR, \"zend_vm_call_opcode_handler() is not supported\");\…
3058 out($f, "\treturn 0;\n");
3059 out($f, "}\n\n");
3065 out($f,"#undef OPLINE\n");
3066 out($f,"#undef DCL_OPLINE\n");
3067 out($f,"#undef USE_OPLINE\n");
3068 out($f,"#undef LOAD_OPLINE\n");
3069 out($f,"#undef LOAD_OPLINE_EX\n");
3070 out($f,"#undef LOAD_NEXT_OPLINE\n");
3071 out($f,"#undef SAVE_OPLINE\n");
3072 out($f,"#undef SAVE_OPLINE_EX\n");
3073 out($f,"#define OPLINE EX(opline)\n");
3074 out($f,"#define DCL_OPLINE\n");
3075 out($f,"#define USE_OPLINE const zend_op *opline = EX(opline);\n");
3076 out($f,"#define LOAD_OPLINE()\n");
3077 out($f,"#define LOAD_OPLINE_EX()\n");
3078 out($f,"#define LOAD_NEXT_OPLINE() ZEND_VM_INC_OPCODE()\n");
3079 out($f,"#define SAVE_OPLINE()\n");
3080 out($f,"#define SAVE_OPLINE_EX()\n");
3081 out($f,"#undef HANDLE_EXCEPTION\n");
3082 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
3083 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
3084 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
3085 out($f,"#undef ZEND_VM_CONTINUE\n");
3086 out($f,"#undef ZEND_VM_RETURN\n");
3087 out($f,"#undef ZEND_VM_ENTER_EX\n");
3088 out($f,"#undef ZEND_VM_ENTER\n");
3089 out($f,"#undef ZEND_VM_LEAVE\n");
3090 out($f,"#undef ZEND_VM_DISPATCH\n");
3091 out($f,"#define ZEND_VM_CONTINUE() return 0\n");
3092 out($f,"#define ZEND_VM_RETURN() return -1\n");
3093 out($f,"#define ZEND_VM_ENTER_EX() return 1\n");
3094 out($f,"#define ZEND_VM_ENTER() return 1\n");
3095 out($f,"#define ZEND_VM_LEAVE() return 2\n");
3096 …out($f,"#define ZEND_VM_INTERRUPT() return zend_interrupt_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHR…
3097 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)…
3098 out($f,"\n");
3102 out($f, "ZEND_API int $func(");
3104 out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
3109 out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
3111 out($f, $h['param']. " ZEND_OPCODE_HANDLER_ARGS_DC)\n");
3120 …out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU…
3126 …out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\…
3132 gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY', $name);
3136 fclose($f);