Lines Matching refs:f

430 function out($f, $s) {  argument
433 fputs($f,$s);
438 function out_line($f) { argument
441 fputs($f,"#line ".($line_no+1)." \"".$executor_file."\"\n");
465 function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) { argument
680 out($f, $code);
684 function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno) { argument
688 out($f, "#line $lineno \"$definition_file\"\n");
694 …out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$pre…
698 …out($f,"case ".((string)($opnames[$name]*25+($typecode[$op1=="TMPVAR"?"TMP":$op1]*5)+$typecode[$op…
700 out($f,"case ".$name.":");
704 out($f," ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_LABEL:\n");
706 out($f,"\n");
710 …out($f,$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_HANDLER: ZEND_VM_GUARD(".$name.($spe…
715 gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name);
719 function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno) { argument
723 out($f, "#line $lineno \"$definition_file\"\n");
731 …out($f, "static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$pr…
734 …out($f, "static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$pr…
738 out($f, $name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2].":\n");
741 out($f, $name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2].":\n");
746 gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name);
750 function gen_labels($f, $spec, $kind, $prolog) { argument
773 out($f,$prolog."ZEND_NULL_HANDLER,\n");
776 out($f,$prolog."(void*)(uintptr_t)-1,\n");
779 out($f,$prolog."(void*)&&ZEND_NULL_HANDLER,\n");
819 out($f,$prolog.$dsc["op"]."_SPEC".$prefix[$op1].$prefix[$op2]."_HANDLER,\n");
822 …out($f,$prolog."(void*)(uintptr_t)".((string)($num*25+$typecode[$op1=="TMPVAR"?"TMP":$op1]*5+$type…
825 out($f,$prolog."(void*)&&".$dsc["op"]."_SPEC".$prefix[$op1].$prefix[$op2]."_HANDLER,\n");
832 out($f,$prolog."ZEND_NULL_HANDLER,\n");
835 out($f,$prolog."(void*)(uintptr_t)-1,\n");
838 out($f,$prolog."(void*)&&ZEND_NULL_HANDLER,\n");
857 out($f,$prolog."ZEND_NULL_HANDLER,\n");
860 out($f,$prolog."(void*)(uintptr_t)-1,\n");
863 out($f,$prolog."(void*)&&ZEND_NULL_HANDLER,\n");
875 out($f,$prolog.$dsc["op"]."_HANDLER,\n");
878 out($f,$prolog."(void*)(uintptr_t)".((string)$num).",\n");
881 out($f,$prolog."(void*)&&".$dsc["op"]."_HANDLER,\n");
887 out($f,$prolog."ZEND_NULL_HANDLER,\n");
890 out($f,$prolog."(void*)(uintptr_t)-1,\n");
893 out($f,$prolog."(void*)&&ZEND_NULL_HANDLER,\n");
903 out($f,$prolog."ZEND_NULL_HANDLER\n");
906 out($f,$prolog."(void*)(uintptr_t)-1\n");
909 out($f,$prolog."(void*)&&ZEND_NULL_HANDLER\n");
915 function gen_null_handler($f) { argument
922 …out($f,"static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n…
923 out($f,"{\n");
924 out($f,"\tUSE_OPLINE\n");
925 out($f,"\n");
926 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
927 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
928 out($f,"}\n\n");
933 function gen_executor_code($f, $spec, $kind, $prolog) { argument
952 …gen_handler($f, 1, $kind, $opcodes[$num]["op"], $op1, $op2, isset($opcodes[$num]["use"]), $opcodes…
960 …gen_helper($f, 1, $kind, $num, $op1, $op2, $helpers[$num]["param"], $helpers[$num]["code"], $linen…
977 …gen_handler($f, 0, $kind, $opcodes[$num]["op"], "ANY", "ANY", isset($opcodes[$num]["use"]), $opcod…
981 …gen_helper($f, 0, $kind, $num, "ANY", "ANY", $helpers[$num]["param"], $helpers[$num]["code"], $lin…
991 out_line($f);
997 gen_null_handler($f);
1000 out($f,"default:\n");
1001 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
1002 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
1005 out($f,"ZEND_NULL_HANDLER:\n");
1006 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
1007 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
1012 function skip_blanks($f, $prolog, $epilog) { argument
1014 out($f, $prolog.$epilog);
1019 function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name) { argument
1029 out($f,"static const void **zend_opcode_handlers;\n");
1030 …out($f,"static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op);\n\n");
1033 out($f,"\n");
1034 out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
1035 out($f,"#pragma GCC diagnostic ignored \"-Wvolatile-register-var\"\n");
1036 … out($f,"register zend_execute_data* volatile execute_data __asm__(ZEND_VM_FP_GLOBAL_REG);\n");
1037 out($f,"#pragma GCC diagnostic warning \"-Wvolatile-register-var\"\n");
1038 out($f,"#endif\n");
1039 out($f,"\n");
1040 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
1041 out($f,"#pragma GCC diagnostic ignored \"-Wvolatile-register-var\"\n");
1042 out($f,"register const zend_op* volatile opline __asm__(ZEND_VM_IP_GLOBAL_REG);\n");
1043 out($f,"#pragma GCC diagnostic warning \"-Wvolatile-register-var\"\n");
1044 out($f,"#endif\n");
1045 out($f,"\n");
1046 out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
1047 out($f,"# define ZEND_OPCODE_HANDLER_ARGS void\n");
1048 out($f,"# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU\n");
1049 out($f,"# define ZEND_OPCODE_HANDLER_ARGS_DC\n");
1050 out($f,"# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC\n");
1051 out($f,"#else\n");
1052 out($f,"# define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data\n");
1053 out($f,"# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data\n");
1054 out($f,"# define ZEND_OPCODE_HANDLER_ARGS_DC , ZEND_OPCODE_HANDLER_ARGS\n");
1055 … out($f,"# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC , ZEND_OPCODE_HANDLER_ARGS_PASSTHRU\n");
1056 out($f,"#endif\n");
1057 out($f,"\n");
1058 out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
1059 out($f,"# define ZEND_OPCODE_HANDLER_RET void\n");
1060 out($f,"# define ZEND_VM_TAIL_CALL(call) call; return\n");
1061 out($f,"# ifdef ZEND_VM_TAIL_CALL_DISPATCH\n");
1062 …out($f,"# define ZEND_VM_CONTINUE() ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_A…
1063 out($f,"# else\n");
1064 out($f,"# define ZEND_VM_CONTINUE() return\n");
1065 out($f,"# endif\n");
1066 out($f,"# define ZEND_VM_RETURN() opline = NULL; return\n");
1067 out($f,"#else\n");
1068 out($f,"# define ZEND_OPCODE_HANDLER_RET int\n");
1069 out($f,"# define ZEND_VM_TAIL_CALL(call) return call\n");
1070 out($f,"# define ZEND_VM_CONTINUE() return 0\n");
1071 out($f,"# define ZEND_VM_RETURN() return -1\n");
1072 out($f,"#endif\n");
1073 out($f,"\n");
1074 …out($f,"typedef ZEND_OPCODE_HANDLER_RET (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARG…
1075 out($f,"\n");
1076 out($f,"#undef OPLINE\n");
1077 out($f,"#undef DCL_OPLINE\n");
1078 out($f,"#undef USE_OPLINE\n");
1079 out($f,"#undef LOAD_OPLINE\n");
1080 out($f,"#undef LOAD_OPLINE_EX\n");
1081 out($f,"#undef SAVE_OPLINE\n");
1082 out($f,"#define DCL_OPLINE\n");
1083 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
1084 out($f,"# define OPLINE opline\n");
1085 out($f,"# define USE_OPLINE\n");
1086 out($f,"# define LOAD_OPLINE() opline = EX(opline)\n");
1087 out($f,"# define LOAD_NEXT_OPLINE() opline = EX(opline) + 1\n");
1088 out($f,"# define SAVE_OPLINE() EX(opline) = opline\n");
1089 out($f,"#else\n");
1090 out($f,"# define OPLINE EX(opline)\n");
1091 out($f,"# define USE_OPLINE const zend_op *opline = EX(opline);\n");
1092 out($f,"# define LOAD_OPLINE()\n");
1093 out($f,"# define LOAD_NEXT_OPLINE() ZEND_VM_INC_OPCODE()\n");
1094 out($f,"# define SAVE_OPLINE()\n");
1095 out($f,"#endif\n");
1096 out($f,"#undef HANDLE_EXCEPTION\n");
1097 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
1098 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
1099 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
1100 out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG)\n");
1101 …out($f,"# define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE();…
1102 out($f,"# define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
1103 out($f,"#elif defined(ZEND_VM_IP_GLOBAL_REG)\n");
1104 …out($f,"# define ZEND_VM_ENTER() opline = EG(current_execute_data)->opline; return 1\n");
1105 out($f,"# define ZEND_VM_LEAVE() return 2\n");
1106 out($f,"#else\n");
1107 out($f,"# define ZEND_VM_ENTER() return 1\n");
1108 out($f,"# define ZEND_VM_LEAVE() return 2\n");
1109 out($f,"#endif\n");
1110 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) ZEND_VM_TAIL_CALL(((opcode_handler_t)zend_vm_get_…
1111 out($f,"\n");
1114 out($f,"\n");
1115 out($f,"#undef OPLINE\n");
1116 out($f,"#undef DCL_OPLINE\n");
1117 out($f,"#undef USE_OPLINE\n");
1118 out($f,"#undef LOAD_OPLINE\n");
1119 out($f,"#undef LOAD_NEXT_OPLINE\n");
1120 out($f,"#undef SAVE_OPLINE\n");
1121 out($f,"#define OPLINE opline\n");
1122 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
1123 … out($f,"# define DCL_OPLINE register const zend_op *opline __asm__(ZEND_VM_IP_GLOBAL_REG);\n");
1124 out($f,"#else\n");
1125 out($f,"# define DCL_OPLINE const zend_op *opline;\n");
1126 out($f,"#endif\n");
1127 out($f,"#define USE_OPLINE\n");
1128 out($f,"#define LOAD_OPLINE() opline = EX(opline)\n");
1129 out($f,"#define LOAD_NEXT_OPLINE() opline = EX(opline) + 1\n");
1130 out($f,"#define SAVE_OPLINE() EX(opline) = opline\n");
1131 out($f,"#undef HANDLE_EXCEPTION\n");
1132 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
1133 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
1134 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
1135 out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n");
1136 out($f,"#define ZEND_VM_RETURN() return\n");
1137 …out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM…
1138 out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
1139 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opc…
1140 out($f,"\n");
1143 out($f,"\n");
1144 out($f,"#undef OPLINE\n");
1145 out($f,"#undef DCL_OPLINE\n");
1146 out($f,"#undef USE_OPLINE\n");
1147 out($f,"#undef LOAD_OPLINE\n");
1148 out($f,"#undef LOAD_NEXT_OPLINE\n");
1149 out($f,"#undef SAVE_OPLINE\n");
1150 out($f,"#define OPLINE opline\n");
1151 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
1152 … out($f,"# define DCL_OPLINE register const zend_op *opline __asm__(ZEND_VM_IP_GLOBAL_REG);\n");
1153 out($f,"#else\n");
1154 out($f,"# define DCL_OPLINE const zend_op *opline;\n");
1155 out($f,"#endif\n");
1156 out($f,"#define USE_OPLINE\n");
1157 out($f,"#define LOAD_OPLINE() opline = EX(opline)\n");
1158 out($f,"#define LOAD_NEXT_OPLINE() opline = EX(opline) + 1\n");
1159 out($f,"#define SAVE_OPLINE() EX(opline) = opline\n");
1160 out($f,"#undef HANDLE_EXCEPTION\n");
1161 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
1163 out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
1164 out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
1166 out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
1167 out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
1169 out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
1170 out($f,"#define ZEND_VM_RETURN() return\n");
1171 …out($f,"#define ZEND_VM_ENTER() execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM…
1172 out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
1173 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode,…
1174 out($f,"\n");
1179 out($f, $m[1].$executor_name.$m[3]."\n");
1184 out($f,$m[1]."const void *dispatch_handler;\n");
1188 out($f,$m[1].$param.";\n");
1190 out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
1191 … out($f,$m[1]."register zend_execute_data *execute_data __asm__(ZEND_VM_FP_GLOBAL_REG) = ex;\n");
1192 out($f,"#else\n");
1193 out($f,$m[1]."zend_execute_data *execute_data = ex;\n");
1194 out($f,"#endif\n");
1196 out($f,"#ifdef ZEND_VM_IP_GLOBAL_REG\n");
1197 out($f,$m[1]."const zend_op *orig_opline = opline;\n");
1198 out($f,"#endif\n");
1199 out($f,"#ifdef ZEND_VM_FP_GLOBAL_REG\n");
1200 out($f,$m[1]."zend_execute_data *orig_execute_data = execute_data;\n");
1201 out($f,$m[1]."execute_data = ex;\n");
1202 out($f,"#else\n");
1203 out($f,$m[1]."zend_execute_data *execute_data = ex;\n");
1204 out($f,"#endif\n");
1212 out($f,$prolog."if (UNEXPECTED(execute_data == NULL)) {\n");
1213 out($f,$prolog."\tstatic const void* labels[] = {\n");
1214 gen_labels($f, $spec, $kind, $prolog."\t\t");
1215 out($f,$prolog."\t};\n");
1216 out($f,$prolog."\tzend_opcode_handlers = (const void **)labels;\n");
1217 out($f,$prolog."\treturn;\n");
1218 out($f,$prolog."}\n");
1220 skip_blanks($f, $m[1], $m[3]);
1226 out($f,"#if !defined(ZEND_VM_FP_GLOBAL_REG) || !defined(ZEND_VM_IP_GLOBAL_REG)\n");
1227 out($f,$m[1]."\tint ret;".$m[3]."\n");
1228 out($f,"#endif\n");
1231 out($f,"zend_vm_continue:".$m[3]."\n");
1233 skip_blanks($f, $m[1], $m[3]);
1240 out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
1241 out($f, $m[1]."((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
1242 out($f, $m[1]."if (UNEXPECTED(!OPLINE))".$m[3]."\n");
1243 out($f,"#else\n");
1244 …out($f, $m[1]."if (UNEXPECTED((ret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_…
1245 out($f,"#endif\n");
1248 …out($f, $m[1]."dispatch_handler = OPLINE->handler;\nzend_vm_dispatch:\n".$m[1]."switch ((int)(uint…
1251 out($f, $m[1]."goto *(void**)(OPLINE->handler);".$m[3]."\n");
1258 out($f,
1277 gen_executor_code($f, $spec, $kind, $m[1]);
1282 gen_executor_code($f, $spec, $kind, $m[1]);
1286 out($f, $m[1].$initializer_name.$m[3]."\n");
1294 out($f,$prolog."");
1295 out($f,$prolog.$executor_name."_ex(NULL);\n");
1297 out($f,$prolog."static const void *labels[] = {\n");
1298 gen_labels($f, $spec, $kind, $prolog."\t");
1299 out($f,$prolog."};\n");
1300 out($f,$prolog."zend_opcode_handlers = labels;\n");
1308 out($f, $line);
1484 …$f = fopen(__DIR__ . "/zend_vm_opcodes.h", "w+") or die("ERROR: Cannot create zend_vm_opcodes.h\n"…
1487 out($f, $GLOBALS['header_text']);
1488 fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n");
1489 fputs($f, "#define ZEND_VM_SPEC\t\t" . ZEND_VM_SPEC . "\n");
1490 fputs($f, "#define ZEND_VM_LINES\t\t" . ZEND_VM_LINES . "\n");
1491 fputs($f, "#define ZEND_VM_KIND_CALL\t" . ZEND_VM_KIND_CALL . "\n");
1492 fputs($f, "#define ZEND_VM_KIND_SWITCH\t" . ZEND_VM_KIND_SWITCH . "\n");
1493 fputs($f, "#define ZEND_VM_KIND_GOTO\t" . ZEND_VM_KIND_GOTO . "\n");
1494 fputs($f, "#define ZEND_VM_KIND\t\t" . $GLOBALS["vm_kind_name"][ZEND_VM_KIND] . "\n");
1495 fputs($f, "\n");
1496 fputs($f, "BEGIN_EXTERN_C()\n\n");
1497 fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n");
1498 fputs($f, "END_EXTERN_C()\n\n");
1503 fputs($f,"#define $op $code\n");
1506 fputs($f, "\n#endif\n");
1507 fclose($f);
1511 …$f = fopen(__DIR__ . "/zend_vm_opcodes.c", "w+") or die("ERROR: Cannot create zend_vm_opcodes.c\n"…
1514 out($f, $GLOBALS['header_text']);
1515 fputs($f,"#include <stdio.h>\n");
1516 fputs($f,"#include <zend.h>\n\n");
1518 fputs($f,"const char *zend_vm_opcodes_map[".($max_opcode + 1)."] = {\n");
1520 fputs($f,"\t".(isset($opcodes[$i]["op"])?'"'.$opcodes[$i]["op"].'"':"NULL").",\n");
1522 fputs($f, "};\n\n");
1524 fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n");
1525 fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n");
1526 fputs($f, "}\n");
1528 fclose($f);
1532 …$f = fopen(__DIR__ . "/zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n"…
1536 out($f, $GLOBALS['header_text']);
1538 out($f, "#ifdef ZEND_WIN32\n");
1540 out($f, "# pragma warning(once : 4101)\n");
1543 out($f, "# pragma warning(once : 6235)\n");
1545 out($f, "# pragma warning(once : 6237)\n");
1547 out($f, "# pragma warning(once : 6239)\n");
1549 out($f, "# pragma warning(once : 6240)\n");
1551 out($f, "# pragma warning(once : 6285)\n");
1553 out($f, "# pragma warning(once : 6286)\n");
1555 out($f, "# pragma warning(once : 6326)\n");
1557 out($f, "#endif\n");
1560 out($f, "static user_opcode_handler_t zend_user_opcode_handlers[256] = {\n");
1562 out($f, "\t(user_opcode_handler_t)NULL,\n");
1564 out($f, "\t(user_opcode_handler_t)NULL\n};\n\n");
1566 out($f, "static zend_uchar zend_user_opcodes[256] = {");
1568 if ($i % 16 == 1) out($f, "\n\t");
1569 out($f, "$i,");
1571 out($f, "255\n};\n\n");
1574 gen_executor($f, $skl, ZEND_VM_SPEC, ZEND_VM_KIND, "execute", "zend_init_opcodes_handlers");
1577 out($f, "static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op)\n");
1578 out($f, "{\n");
1580 out($f, "\treturn zend_opcode_handlers[opcode];\n");
1582 out($f, "\t\tstatic const int zend_vm_decode[] = {\n");
1583 out($f, "\t\t\t_UNUSED_CODE, /* 0 */\n");
1584 out($f, "\t\t\t_CONST_CODE, /* 1 = IS_CONST */\n");
1585 out($f, "\t\t\t_TMP_CODE, /* 2 = IS_TMP_VAR */\n");
1586 out($f, "\t\t\t_UNUSED_CODE, /* 3 */\n");
1587 out($f, "\t\t\t_VAR_CODE, /* 4 = IS_VAR */\n");
1588 out($f, "\t\t\t_UNUSED_CODE, /* 5 */\n");
1589 out($f, "\t\t\t_UNUSED_CODE, /* 6 */\n");
1590 out($f, "\t\t\t_UNUSED_CODE, /* 7 */\n");
1591 out($f, "\t\t\t_UNUSED_CODE, /* 8 = IS_UNUSED */\n");
1592 out($f, "\t\t\t_UNUSED_CODE, /* 9 */\n");
1593 out($f, "\t\t\t_UNUSED_CODE, /* 10 */\n");
1594 out($f, "\t\t\t_UNUSED_CODE, /* 11 */\n");
1595 out($f, "\t\t\t_UNUSED_CODE, /* 12 */\n");
1596 out($f, "\t\t\t_UNUSED_CODE, /* 13 */\n");
1597 out($f, "\t\t\t_UNUSED_CODE, /* 14 */\n");
1598 out($f, "\t\t\t_UNUSED_CODE, /* 15 */\n");
1599 out($f, "\t\t\t_CV_CODE /* 16 = IS_CV */\n");
1600 out($f, "\t\t};\n");
1601 …out($f, "\t\treturn zend_opcode_handlers[opcode * 25 + zend_vm_decode[op->op1_type] * 5 + zend_vm_…
1603 out($f, "}\n\n");
1606 out($f, "ZEND_API void zend_vm_set_opcode_handler(zend_op* op)\n");
1607 out($f, "{\n");
1608 out($f, "\top->handler = zend_vm_get_opcode_handler(zend_user_opcodes[op->opcode], op);\n");
1609 out($f, "}\n\n");
1613 out($f, "ZEND_API int zend_vm_call_opcode_handler(zend_execute_data* ex)\n");
1614 out($f, "{\n");
1615 out($f, "\tint ret;\n");
1616 out($f, "#ifdef ZEND_VM_IP_GLOBAL_REG\n");
1617 out($f, "\tconst zend_op *orig_opline = opline;\n");
1618 out($f, "#endif\n");
1619 out($f, "#ifdef ZEND_VM_FP_GLOBAL_REG\n");
1620 out($f, "\tzend_execute_data *orig_execute_data = execute_data;\n");
1621 out($f, "\texecute_data = ex;\n");
1622 out($f, "#else\n");
1623 out($f, "\tzend_execute_data *execute_data = ex;\n");
1624 out($f, "#endif\n");
1625 out($f, "\n");
1626 out($f, "\tLOAD_OPLINE();\n");
1627 out($f,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
1628 out($f, "\t((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
1629 out($f, "\tif (EXPECTED(opline)) {\n");
1630 out($f, "\t\tret = execute_data != ex ? (int)(execute_data->prev_execute_data != ex) + 1 : 0;\n");
1631 out($f, "\t\tSAVE_OPLINE();\n");
1632 out($f, "\t} else {\n");
1633 out($f, "\t\tret = -1;\n");
1634 out($f, "\t}\n");
1635 out($f, "#else\n");
1636 out($f, "\tret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
1637 out($f, "\tSAVE_OPLINE();\n");
1638 out($f, "#endif\n");
1639 out($f, "#ifdef ZEND_VM_FP_GLOBAL_REG\n");
1640 out($f, "\texecute_data = orig_execute_data;\n");
1641 out($f, "#endif\n");
1642 out($f, "#ifdef ZEND_VM_IP_GLOBAL_REG\n");
1643 out($f, "\topline = orig_opline;\n");
1644 out($f, "#endif\n");
1645 out($f, "\treturn ret;\n");
1646 out($f, "}\n\n");
1648 out($f, "ZEND_API int zend_vm_call_opcode_handler(zend_execute_data* ex)\n");
1649 out($f, "{\n");
1650 …out($f, "\tzend_error_noreturn(E_CORE_ERROR, \"zend_vm_call_opcode_handler() is not supported\");\…
1651 out($f, "\treturn 0;\n");
1652 out($f, "}\n\n");
1658 out($f,"#undef OPLINE\n");
1659 out($f,"#undef DCL_OPLINE\n");
1660 out($f,"#undef USE_OPLINE\n");
1661 out($f,"#undef LOAD_OPLINE\n");
1662 out($f,"#undef LOAD_NEXT_OPLINE\n");
1663 out($f,"#undef SAVE_OPLINE\n");
1664 out($f,"#define OPLINE EX(opline)\n");
1665 out($f,"#define DCL_OPLINE\n");
1666 out($f,"#define USE_OPLINE const zend_op *opline = EX(opline);\n");
1667 out($f,"#define LOAD_OPLINE()\n");
1668 out($f,"#define LOAD_NEXT_OPLINE() ZEND_VM_INC_OPCODE()\n");
1669 out($f,"#define SAVE_OPLINE()\n");
1670 out($f,"#undef HANDLE_EXCEPTION\n");
1671 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
1672 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
1673 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
1674 out($f,"#undef ZEND_VM_CONTINUE\n");
1675 out($f,"#undef ZEND_VM_RETURN\n");
1676 out($f,"#undef ZEND_VM_ENTER\n");
1677 out($f,"#undef ZEND_VM_LEAVE\n");
1678 out($f,"#undef ZEND_VM_DISPATCH\n");
1679 out($f,"#define ZEND_VM_CONTINUE() return 0\n");
1680 out($f,"#define ZEND_VM_RETURN() return -1\n");
1681 out($f,"#define ZEND_VM_ENTER() return 1\n");
1682 out($f,"#define ZEND_VM_LEAVE() return 2\n");
1683 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)…
1684 out($f,"\n");
1688 out($f, "ZEND_API int $func(");
1690 out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
1695 out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
1697 out($f, $h['param']. " ZEND_OPCODE_HANDLER_ARGS_DC)\n");
1706 …out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU…
1712 …out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\…
1718 gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY', $name);
1722 fclose($f);