Lines Matching refs:f

272 function out($f, $s) {  argument
275 fputs($f,$s);
280 function out_line($f) { argument
283 fputs($f,"#line ".($line_no+1)." \"".$executor_file."\"\n");
307 function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) { argument
492 out($f, $code);
496 function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno) { argument
500 out($f, "#line $lineno \"$definition_file\"\n");
506 …out($f,"static int ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_HANDLER…
510 …out($f,"case ".((string)($opnames[$name]*25+($typecode[$op1]*5)+$typecode[$op2])).": /*".$name."_S…
512 out($f,"case ".$name.":");
516 out($f," ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_LABEL:\n");
518 out($f,"\n");
522 …out($f,$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_HANDLER: ZEND_VM_GUARD(".$name.($spe…
527 gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name);
531 function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno) { argument
535 out($f, "#line $lineno \"$definition_file\"\n");
543 …out($f, "static int ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."(ZEND_OP…
546 …out($f, "static int ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."(".$para…
550 out($f, $name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2].":\n");
553 out($f, $name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2].":\n");
558 gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name);
562 function gen_labels($f, $spec, $kind, $prolog) { argument
585 out($f,$prolog."ZEND_NULL_HANDLER,\n");
588 out($f,$prolog."(opcode_handler_t)-1,\n");
591 out($f,$prolog."(opcode_handler_t)&&ZEND_NULL_HANDLER,\n");
623 out($f,$prolog.$dsc["op"]."_SPEC".$prefix[$op1].$prefix[$op2]."_HANDLER,\n");
626 … out($f,$prolog."(opcode_handler_t)".((string)($num*25+$typecode[$op1]*5+$typecode[$op2])).",\n");
629 …out($f,$prolog."(opcode_handler_t)&&".$dsc["op"]."_SPEC".$prefix[$op1].$prefix[$op2]."_HANDLER,\n"…
636 out($f,$prolog."ZEND_NULL_HANDLER,\n");
639 out($f,$prolog."(opcode_handler_t)-1,\n");
642 out($f,$prolog."(opcode_handler_t)&&ZEND_NULL_HANDLER,\n");
661 out($f,$prolog."ZEND_NULL_HANDLER,\n");
664 out($f,$prolog."(opcode_handler_t)-1,\n");
667 out($f,$prolog."(opcode_handler_t)&&ZEND_NULL_HANDLER,\n");
676 out($f,$prolog.$dsc["op"]."_HANDLER,\n");
679 out($f,$prolog."(opcode_handler_t)".((string)$num).",\n");
682 out($f,$prolog."(opcode_handler_t)&&".$dsc["op"]."_HANDLER,\n");
691 out($f,$prolog."ZEND_NULL_HANDLER\n");
694 out($f,$prolog."(opcode_handler_t)-1\n");
697 out($f,$prolog."(opcode_handler_t)&&ZEND_NULL_HANDLER\n");
703 function gen_null_handler($f) { argument
710 out($f,"static int ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
711 out($f,"{\n");
712 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
713 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
714 out($f,"}\n\n");
719 function gen_executor_code($f, $spec, $kind, $prolog) { argument
738 …gen_handler($f, 1, $kind, $opcodes[$num]["op"], $op1, $op2, isset($opcodes[$num]["use"]), $opcodes…
746 …gen_helper($f, 1, $kind, $num, $op1, $op2, $helpers[$num]["param"], $helpers[$num]["code"], $linen…
763 …gen_handler($f, 0, $kind, $opcodes[$num]["op"], "ANY", "ANY", isset($opcodes[$num]["use"]), $opcod…
767 …gen_helper($f, 0, $kind, $num, "ANY", "ANY", $helpers[$num]["param"], $helpers[$num]["code"], $lin…
777 out_line($f);
783 gen_null_handler($f);
786 out($f,"default:\n");
787 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
788 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
791 out($f,"ZEND_NULL_HANDLER:\n");
792 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
793 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
798 function skip_blanks($f, $prolog, $epilog) { argument
800 out($f, $prolog.$epilog);
805 function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, $old) { argument
816 out($f,"static int zend_vm_old_executor = 0;\n\n");
818 … out($f,"static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op);\n\n");
821 out($f,"\n");
822 out($f,"#undef OPLINE\n");
823 out($f,"#undef DCL_OPLINE\n");
824 out($f,"#undef USE_OPLINE\n");
825 out($f,"#undef LOAD_OPLINE\n");
826 out($f,"#undef SAVE_OPLINE\n");
827 out($f,"#define OPLINE EX(opline)\n");
828 out($f,"#define DCL_OPLINE\n");
829 out($f,"#define USE_OPLINE zend_op *opline = EX(opline);\n");
830 out($f,"#define LOAD_OPLINE()\n");
831 out($f,"#define SAVE_OPLINE()\n");
832 out($f,"#undef CHECK_EXCEPTION\n");
833 out($f,"#undef HANDLE_EXCEPTION\n");
834 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
835 out($f,"#define CHECK_EXCEPTION() LOAD_OPLINE()\n");
836 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
837 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
838 out($f,"#define LOAD_REGS()\n");
839 out($f,"#define ZEND_VM_CONTINUE() return 0\n");
840 out($f,"#define ZEND_VM_RETURN() return 1\n");
841 out($f,"#define ZEND_VM_ENTER() return 2\n");
842 out($f,"#define ZEND_VM_LEAVE() return 3\n");
843 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)…
844 out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
847 out($f,"\n");
848 out($f,"#undef OPLINE\n");
849 out($f,"#undef DCL_OPLINE\n");
850 out($f,"#undef USE_OPLINE\n");
851 out($f,"#undef LOAD_OPLINE\n");
852 out($f,"#undef SAVE_OPLINE\n");
853 out($f,"#define OPLINE opline\n");
854 out($f,"#define DCL_OPLINE zend_op *opline;\n");
855 out($f,"#define USE_OPLINE\n");
856 out($f,"#define LOAD_OPLINE() opline = EX(opline)\n");
857 out($f,"#define SAVE_OPLINE() EX(opline) = opline\n");
858 out($f,"#undef CHECK_EXCEPTION\n");
859 out($f,"#undef HANDLE_EXCEPTION\n");
860 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
861 out($f,"#define CHECK_EXCEPTION() LOAD_OPLINE()\n");
862 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
863 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
864 out($f,"#define LOAD_REGS()\n");
865 out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n");
866 out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
867 out($f,"#define ZEND_VM_ENTER() goto zend_vm_enter\n");
868 out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
869 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opc…
870 out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
873 out($f,"\n");
874 out($f,"#undef OPLINE\n");
875 out($f,"#undef DCL_OPLINE\n");
876 out($f,"#undef USE_OPLINE\n");
877 out($f,"#undef LOAD_OPLINE\n");
878 out($f,"#undef SAVE_OPLINE\n");
879 out($f,"#define OPLINE opline\n");
880 out($f,"#define DCL_OPLINE zend_op *opline;\n");
881 out($f,"#define USE_OPLINE\n");
882 out($f,"#define LOAD_OPLINE() opline = EX(opline)\n");
883 out($f,"#define SAVE_OPLINE() EX(opline) = opline\n");
884 out($f,"#undef CHECK_EXCEPTION\n");
885 out($f,"#undef HANDLE_EXCEPTION\n");
886 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
888 …out($f,"#define CHECK_EXCEPTION() if (UNEXPECTED(EG(exception) != NULL)) goto ZEND_HANDLE_EXCEPTIO…
889 out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
890 out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
892 …out($f,"#define CHECK_EXCEPTION() if (UNEXPECTED(EG(exception) != NULL)) goto ZEND_HANDLE_EXCEPTIO…
893 out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
894 out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
896 out($f,"#define LOAD_REGS()\n");
897 out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
898 out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
899 out($f,"#define ZEND_VM_ENTER() goto zend_vm_enter\n");
900 out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
901 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode,…
902 out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
907 out($f, $m[1].$executor_name.$m[3]."\n");
912 out($f,$m[1]."opcode_handler_t dispatch_handler;\n");
916 out($f,$m[1].$param.";\n");
919 skip_blanks($f, $m[1], $m[3]."\n");
927 out($f,$prolog."if (execute_data == NULL) {\n");
928 out($f,$prolog."\tstatic const opcode_handler_t labels[] = {\n");
929 gen_labels($f, $spec, $kind, $prolog."\t\t");
930 out($f,$prolog."\t};\n");
931 out($f,$prolog."\tzend_opcode_handlers = (opcode_handler_t*)labels;\n");
932 out($f,$prolog."\treturn;\n");
933 out($f,$prolog."}\n");
935 skip_blanks($f, $m[1], $m[3]);
941 out($f,$m[1]."\tint ret;".$m[3]."\n");
944 out($f,"zend_vm_continue:".$m[3]."\n");
946 skip_blanks($f, $m[1], $m[3]);
953 out($f, $m[1]."if ((ret = OPLINE->handler(execute_data TSRMLS_CC)) > 0)".$m[3]."\n");
956 …out($f, $m[1]."dispatch_handler = OPLINE->handler;\nzend_vm_dispatch:\n".$m[1]."switch ((int)dispa…
959 out($f, $m[1]."goto *(void**)(OPLINE->handler);".$m[3]."\n");
966 out($f, $m[1]."switch (ret) {\n" .
981 gen_executor_code($f, $spec, $kind, $m[1]);
990 gen_executor_code($f, $spec, $kind, $m[1]);
995 out($f, $m[1].$initializer_name.$m[3]."\n");
1003 out($f,$prolog."TSRMLS_FETCH();\n");
1004 out($f,$prolog.$executor_name."_ex(NULL TSRMLS_CC);\n");
1008 out($f,$prolog."static opcode_handler_t labels[512] = {\n");
1010 out($f,$prolog."static const opcode_handler_t labels[] = {\n");
1012 gen_labels($f, $spec, $kind, $prolog."\t");
1013 out($f,$prolog."};\n");
1014 out($f,$prolog."zend_opcode_handlers = (opcode_handler_t*)labels;\n");
1017 out($f,$prolog."zend_vm_old_executor = 1;\n");
1018 out($f,$prolog."zend_execute = old_execute;\n");
1027 out($f, $line);
1178 …$f = fopen(__DIR__ . "/zend_vm_opcodes.h", "w+") or die("ERROR: Cannot create zend_vm_opcodes.h\n"…
1181 out($f, $GLOBALS['header_text']);
1183 fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n");
1184 fputs($f, "BEGIN_EXTERN_C()\n\n");
1185 fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n");
1186 fputs($f, "END_EXTERN_C()\n\n");
1191 fputs($f,"#define $op $code\n");
1194 fputs($f, "\n#endif\n");
1195 fclose($f);
1199 …$f = fopen(__DIR__ . "/zend_vm_opcodes.c", "w+") or die("ERROR: Cannot create zend_vm_opcodes.c\n"…
1202 out($f, $GLOBALS['header_text']);
1203 fputs($f,"#include <stdio.h>\n");
1204 fputs($f,"#include <zend.h>\n\n");
1206 fputs($f,"const char *zend_vm_opcodes_map[".($max_opcode + 1)."] = {\n");
1208 fputs($f,"\t".(isset($opcodes[$i]["op"])?'"'.$opcodes[$i]["op"].'"':"NULL").",\n");
1210 fputs($f, "};\n\n");
1212 fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n");
1213 fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n");
1214 fputs($f, "}\n");
1216 fclose($f);
1220 …$f = fopen(__DIR__ . "/zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n"…
1224 out($f, $GLOBALS['header_text']);
1226 out($f, "#ifdef ZEND_WIN32\n");
1228 out($f, "# pragma warning(once : 4101)\n");
1231 out($f, "# pragma warning(once : 6235)\n");
1233 out($f, "# pragma warning(once : 6237)\n");
1235 out($f, "# pragma warning(once : 6239)\n");
1237 out($f, "# pragma warning(once : 6240)\n");
1239 out($f, "# pragma warning(once : 6285)\n");
1241 out($f, "# pragma warning(once : 6286)\n");
1243 out($f, "# pragma warning(once : 6326)\n");
1245 out($f, "#endif\n");
1248 out($f, "static user_opcode_handler_t zend_user_opcode_handlers[256] = {\n");
1250 out($f, "\t(user_opcode_handler_t)NULL,\n");
1252 out($f, "\t(user_opcode_handler_t)NULL\n};\n\n");
1254 out($f, "static zend_uchar zend_user_opcodes[256] = {");
1256 if ($i % 16 == 1) out($f, "\n\t");
1257 out($f, "$i,");
1259 out($f, "255\n};\n\n");
1262 gen_executor($f, $skl, ZEND_VM_SPEC, ZEND_VM_KIND, "execute", "zend_init_opcodes_handlers", 0);
1266 out($f,"\n/* Old executor */\n\n");
1267 out($f,"#undef ZEND_VM_CONTINUE\n\n");
1268 out($f,"#undef ZEND_VM_RETURN\n\n");
1269 out($f,"#undef ZEND_VM_ENTER\n\n");
1270 out($f,"#undef ZEND_VM_LEAVE\n\n");
1271 out($f,"#undef ZEND_VM_DISPATCH\n\n");
1272 out($f,"#undef ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL\n\n");
1273 gen_executor($f, $skl, 0, ZEND_VM_KIND_CALL, "old_execute", "zend_vm_use_old_executor", 1);
1277 out($f, "static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op)\n");
1278 out($f, "{\n");
1280 out($f, "\treturn zend_opcode_handlers[opcode];\n");
1283 out($f, "\tif (zend_vm_old_executor) {\n");
1284 out($f, "\t\treturn zend_opcode_handlers[opcode];\n");
1285 out($f, "\t} else {\n");
1287 out($f, "\t\tstatic const int zend_vm_decode[] = {\n");
1288 out($f, "\t\t\t_UNUSED_CODE, /* 0 */\n");
1289 out($f, "\t\t\t_CONST_CODE, /* 1 = IS_CONST */\n");
1290 out($f, "\t\t\t_TMP_CODE, /* 2 = IS_TMP_VAR */\n");
1291 out($f, "\t\t\t_UNUSED_CODE, /* 3 */\n");
1292 out($f, "\t\t\t_VAR_CODE, /* 4 = IS_VAR */\n");
1293 out($f, "\t\t\t_UNUSED_CODE, /* 5 */\n");
1294 out($f, "\t\t\t_UNUSED_CODE, /* 6 */\n");
1295 out($f, "\t\t\t_UNUSED_CODE, /* 7 */\n");
1296 out($f, "\t\t\t_UNUSED_CODE, /* 8 = IS_UNUSED */\n");
1297 out($f, "\t\t\t_UNUSED_CODE, /* 9 */\n");
1298 out($f, "\t\t\t_UNUSED_CODE, /* 10 */\n");
1299 out($f, "\t\t\t_UNUSED_CODE, /* 11 */\n");
1300 out($f, "\t\t\t_UNUSED_CODE, /* 12 */\n");
1301 out($f, "\t\t\t_UNUSED_CODE, /* 13 */\n");
1302 out($f, "\t\t\t_UNUSED_CODE, /* 14 */\n");
1303 out($f, "\t\t\t_UNUSED_CODE, /* 15 */\n");
1304 out($f, "\t\t\t_CV_CODE /* 16 = IS_CV */\n");
1305 out($f, "\t\t};\n");
1306 …out($f, "\t\treturn zend_opcode_handlers[opcode * 25 + zend_vm_decode[op->op1_type] * 5 + zend_vm_…
1308 out($f, "\t}\n");
1311 out($f, "}\n\n");
1314 out($f, "ZEND_API void zend_vm_set_opcode_handler(zend_op* op)\n");
1315 out($f, "{\n");
1316 out($f, "\top->handler = zend_vm_get_opcode_handler(zend_user_opcodes[op->opcode], op);\n");
1317 out($f, "}\n\n");
1323 out($f,"#undef OPLINE\n");
1324 out($f,"#undef DCL_OPLINE\n");
1325 out($f,"#undef USE_OPLINE\n");
1326 out($f,"#undef LOAD_OPLINE\n");
1327 out($f,"#undef SAVE_OPLINE\n");
1328 out($f,"#define OPLINE EX(opline)\n");
1329 out($f,"#define DCL_OPLINE\n");
1330 out($f,"#define USE_OPLINE zend_op *opline = EX(opline);\n");
1331 out($f,"#define LOAD_OPLINE()\n");
1332 out($f,"#define SAVE_OPLINE()\n");
1333 out($f,"#undef CHECK_EXCEPTION\n");
1334 out($f,"#undef HANDLE_EXCEPTION\n");
1335 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
1336 out($f,"#define CHECK_EXCEPTION() LOAD_OPLINE()\n");
1337 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
1338 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
1339 out($f,"#undef ZEND_VM_CONTINUE\n");
1340 out($f,"#undef ZEND_VM_RETURN\n");
1341 out($f,"#undef ZEND_VM_ENTER\n");
1342 out($f,"#undef ZEND_VM_LEAVE\n");
1343 out($f,"#undef ZEND_VM_DISPATCH\n");
1344 out($f,"#undef ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL\n\n");
1345 out($f,"#define ZEND_VM_CONTINUE() return 0\n");
1346 out($f,"#define ZEND_VM_RETURN() return 1\n");
1347 out($f,"#define ZEND_VM_ENTER() return 2\n");
1348 out($f,"#define ZEND_VM_LEAVE() return 3\n");
1349 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)…
1350 out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n\n");
1354 out($f, "ZEND_API int $func(");
1356 out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
1361 out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
1363 out($f, $h['param']. ", ZEND_OPCODE_HANDLER_ARGS)\n");
1370 out($f, "{\n\treturn ".$name."_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
1373 out($f, "{\n\treturn ".$name."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
1380 …out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU…
1386 …out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\…
1392 gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY', $name);
1396 fclose($f);