Lines Matching refs:f
284 function out($f, $s) { argument
287 fputs($f,$s);
292 function out_line($f) { argument
295 fputs($f,"#line ".($line_no+1)." \"".$executor_file."\"\n");
319 function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name) { argument
519 out($f, $code);
523 function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno) { argument
527 out($f, "#line $lineno \"$definition_file\"\n");
533 …out($f,"static int ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_HANDLER…
537 …out($f,"case ".((string)($opnames[$name]*25+($typecode[$op1]*5)+$typecode[$op2])).": /*".$name."_S…
539 out($f,"case ".$name.":");
543 out($f," ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_LABEL:\n");
545 out($f,"\n");
549 …out($f,$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."_HANDLER: ZEND_VM_GUARD(".$name.($spe…
554 gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name);
558 function gen_helper($f, $spec, $kind, $name, $op1, $op2, $param, $code, $lineno) { argument
562 out($f, "#line $lineno \"$definition_file\"\n");
570 …out($f, "static int ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."(ZEND_OP…
573 …out($f, "static int ZEND_FASTCALL ".$name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2]."(".$para…
577 out($f, $name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2].":\n");
580 out($f, $name.($spec?"_SPEC":"").$prefix[$op1].$prefix[$op2].":\n");
585 gen_code($f, $spec, $kind, 0, $code, $op1, $op2, $name);
589 function gen_labels($f, $spec, $kind, $prolog) { argument
612 out($f,$prolog."ZEND_NULL_HANDLER,\n");
615 out($f,$prolog."(opcode_handler_t)-1,\n");
618 out($f,$prolog."(opcode_handler_t)&&ZEND_NULL_HANDLER,\n");
650 out($f,$prolog.$dsc["op"]."_SPEC".$prefix[$op1].$prefix[$op2]."_HANDLER,\n");
653 … out($f,$prolog."(opcode_handler_t)".((string)($num*25+$typecode[$op1]*5+$typecode[$op2])).",\n");
656 …out($f,$prolog."(opcode_handler_t)&&".$dsc["op"]."_SPEC".$prefix[$op1].$prefix[$op2]."_HANDLER,\n"…
663 out($f,$prolog."ZEND_NULL_HANDLER,\n");
666 out($f,$prolog."(opcode_handler_t)-1,\n");
669 out($f,$prolog."(opcode_handler_t)&&ZEND_NULL_HANDLER,\n");
688 out($f,$prolog."ZEND_NULL_HANDLER,\n");
691 out($f,$prolog."(opcode_handler_t)-1,\n");
694 out($f,$prolog."(opcode_handler_t)&&ZEND_NULL_HANDLER,\n");
703 out($f,$prolog.$dsc["op"]."_HANDLER,\n");
706 out($f,$prolog."(opcode_handler_t)".((string)$num).",\n");
709 out($f,$prolog."(opcode_handler_t)&&".$dsc["op"]."_HANDLER,\n");
718 out($f,$prolog."ZEND_NULL_HANDLER\n");
721 out($f,$prolog."(opcode_handler_t)-1\n");
724 out($f,$prolog."(opcode_handler_t)&&ZEND_NULL_HANDLER\n");
730 function gen_null_handler($f) { argument
737 out($f,"static int ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)\n");
738 out($f,"{\n");
739 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
740 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
741 out($f,"}\n\n");
746 function gen_executor_code($f, $spec, $kind, $prolog) { argument
765 …gen_handler($f, 1, $kind, $opcodes[$num]["op"], $op1, $op2, isset($opcodes[$num]["use"]), $opcodes…
773 …gen_helper($f, 1, $kind, $num, $op1, $op2, $helpers[$num]["param"], $helpers[$num]["code"], $linen…
790 …gen_handler($f, 0, $kind, $opcodes[$num]["op"], "ANY", "ANY", isset($opcodes[$num]["use"]), $opcod…
794 …gen_helper($f, 0, $kind, $num, "ANY", "ANY", $helpers[$num]["param"], $helpers[$num]["code"], $lin…
804 out_line($f);
810 gen_null_handler($f);
813 out($f,"default:\n");
814 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
815 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
818 out($f,"ZEND_NULL_HANDLER:\n");
819 …out($f,"\tzend_error_noreturn(E_ERROR, \"Invalid opcode %d/%d/%d.\", OPLINE->opcode, OPLINE->op1_t…
820 out($f,"\tZEND_VM_NEXT_OPCODE(); /* Never reached */\n");
825 function skip_blanks($f, $prolog, $epilog) { argument
827 out($f, $prolog.$epilog);
832 function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name, $old) { argument
843 out($f,"static int zend_vm_old_executor = 0;\n\n");
845 … out($f,"static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op);\n\n");
848 out($f,"\n");
849 out($f,"#undef OPLINE\n");
850 out($f,"#undef DCL_OPLINE\n");
851 out($f,"#undef USE_OPLINE\n");
852 out($f,"#undef LOAD_OPLINE\n");
853 out($f,"#undef SAVE_OPLINE\n");
854 out($f,"#define OPLINE EX(opline)\n");
855 out($f,"#define DCL_OPLINE\n");
856 out($f,"#define USE_OPLINE zend_op *opline = EX(opline);\n");
857 out($f,"#define LOAD_OPLINE()\n");
858 out($f,"#define SAVE_OPLINE()\n");
859 out($f,"#undef CHECK_EXCEPTION\n");
860 out($f,"#undef HANDLE_EXCEPTION\n");
861 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
862 out($f,"#define CHECK_EXCEPTION() LOAD_OPLINE()\n");
863 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
864 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
865 out($f,"#define LOAD_REGS()\n");
866 out($f,"#define ZEND_VM_CONTINUE() return 0\n");
867 out($f,"#define ZEND_VM_RETURN() return 1\n");
868 out($f,"#define ZEND_VM_ENTER() return 2\n");
869 out($f,"#define ZEND_VM_LEAVE() return 3\n");
870 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)…
871 out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
874 out($f,"\n");
875 out($f,"#undef OPLINE\n");
876 out($f,"#undef DCL_OPLINE\n");
877 out($f,"#undef USE_OPLINE\n");
878 out($f,"#undef LOAD_OPLINE\n");
879 out($f,"#undef SAVE_OPLINE\n");
880 out($f,"#define OPLINE opline\n");
881 out($f,"#define DCL_OPLINE zend_op *opline;\n");
882 out($f,"#define USE_OPLINE\n");
883 out($f,"#define LOAD_OPLINE() opline = EX(opline)\n");
884 out($f,"#define SAVE_OPLINE() EX(opline) = opline\n");
885 out($f,"#undef CHECK_EXCEPTION\n");
886 out($f,"#undef HANDLE_EXCEPTION\n");
887 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
888 out($f,"#define CHECK_EXCEPTION() LOAD_OPLINE()\n");
889 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
890 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
891 out($f,"#define LOAD_REGS()\n");
892 out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n");
893 out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
894 out($f,"#define ZEND_VM_ENTER() goto zend_vm_enter\n");
895 out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
896 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opc…
897 out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
900 out($f,"\n");
901 out($f,"#undef OPLINE\n");
902 out($f,"#undef DCL_OPLINE\n");
903 out($f,"#undef USE_OPLINE\n");
904 out($f,"#undef LOAD_OPLINE\n");
905 out($f,"#undef SAVE_OPLINE\n");
906 out($f,"#define OPLINE opline\n");
907 out($f,"#define DCL_OPLINE zend_op *opline;\n");
908 out($f,"#define USE_OPLINE\n");
909 out($f,"#define LOAD_OPLINE() opline = EX(opline)\n");
910 out($f,"#define SAVE_OPLINE() EX(opline) = opline\n");
911 out($f,"#undef CHECK_EXCEPTION\n");
912 out($f,"#undef HANDLE_EXCEPTION\n");
913 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
915 …out($f,"#define CHECK_EXCEPTION() if (UNEXPECTED(EG(exception) != NULL)) goto ZEND_HANDLE_EXCEPTIO…
916 out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
917 out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_SPEC_HANDLER\n");
919 …out($f,"#define CHECK_EXCEPTION() if (UNEXPECTED(EG(exception) != NULL)) goto ZEND_HANDLE_EXCEPTIO…
920 out($f,"#define HANDLE_EXCEPTION() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
921 out($f,"#define HANDLE_EXCEPTION_LEAVE() goto ZEND_HANDLE_EXCEPTION_HANDLER\n");
923 out($f,"#define LOAD_REGS()\n");
924 out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
925 out($f,"#define ZEND_VM_RETURN() EG(in_execution) = original_in_execution; return\n");
926 out($f,"#define ZEND_VM_ENTER() goto zend_vm_enter\n");
927 out($f,"#define ZEND_VM_LEAVE() ZEND_VM_CONTINUE()\n");
928 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode,…
929 out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n");
934 out($f, $m[1].$executor_name.$m[3]."\n");
939 out($f,$m[1]."opcode_handler_t dispatch_handler;\n");
943 out($f,$m[1].$param.";\n");
946 skip_blanks($f, $m[1], $m[3]."\n");
954 out($f,$prolog."if (execute_data == NULL) {\n");
955 out($f,$prolog."\tstatic const opcode_handler_t labels[] = {\n");
956 gen_labels($f, $spec, $kind, $prolog."\t\t");
957 out($f,$prolog."\t};\n");
958 out($f,$prolog."\tzend_opcode_handlers = (opcode_handler_t*)labels;\n");
959 out($f,$prolog."\treturn;\n");
960 out($f,$prolog."}\n");
962 skip_blanks($f, $m[1], $m[3]);
968 out($f,$m[1]."\tint ret;".$m[3]."\n");
971 out($f,"zend_vm_continue:".$m[3]."\n");
973 skip_blanks($f, $m[1], $m[3]);
980 out($f, $m[1]."if ((ret = OPLINE->handler(execute_data TSRMLS_CC)) > 0)".$m[3]."\n");
983 …out($f, $m[1]."dispatch_handler = OPLINE->handler;\nzend_vm_dispatch:\n".$m[1]."switch ((int)dispa…
986 out($f, $m[1]."goto *(void**)(OPLINE->handler);".$m[3]."\n");
993 out($f, $m[1]."switch (ret) {\n" .
1008 gen_executor_code($f, $spec, $kind, $m[1]);
1017 gen_executor_code($f, $spec, $kind, $m[1]);
1022 out($f, $m[1].$initializer_name.$m[3]."\n");
1030 out($f,$prolog."TSRMLS_FETCH();\n");
1031 out($f,$prolog.$executor_name."_ex(NULL TSRMLS_CC);\n");
1035 out($f,$prolog."static opcode_handler_t labels[512] = {\n");
1037 out($f,$prolog."static const opcode_handler_t labels[] = {\n");
1039 gen_labels($f, $spec, $kind, $prolog."\t");
1040 out($f,$prolog."};\n");
1041 out($f,$prolog."zend_opcode_handlers = (opcode_handler_t*)labels;\n");
1044 out($f,$prolog."zend_vm_old_executor = 1;\n");
1045 out($f,$prolog."zend_execute = old_execute;\n");
1054 out($f, $line);
1205 …$f = fopen(__DIR__ . "/zend_vm_opcodes.h", "w+") or die("ERROR: Cannot create zend_vm_opcodes.h\n"…
1208 out($f, $GLOBALS['header_text']);
1210 fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n");
1211 fputs($f, "BEGIN_EXTERN_C()\n\n");
1212 fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n");
1213 fputs($f, "END_EXTERN_C()\n\n");
1218 fputs($f,"#define $op $code\n");
1221 fputs($f, "\n#endif\n");
1222 fclose($f);
1226 …$f = fopen(__DIR__ . "/zend_vm_opcodes.c", "w+") or die("ERROR: Cannot create zend_vm_opcodes.c\n"…
1229 out($f, $GLOBALS['header_text']);
1230 fputs($f,"#include <stdio.h>\n");
1231 fputs($f,"#include <zend.h>\n\n");
1233 fputs($f,"const char *zend_vm_opcodes_map[".($max_opcode + 1)."] = {\n");
1235 fputs($f,"\t".(isset($opcodes[$i]["op"])?'"'.$opcodes[$i]["op"].'"':"NULL").",\n");
1237 fputs($f, "};\n\n");
1239 fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n");
1240 fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n");
1241 fputs($f, "}\n");
1243 fclose($f);
1247 …$f = fopen(__DIR__ . "/zend_vm_execute.h", "w+") or die("ERROR: Cannot create zend_vm_execute.h\n"…
1251 out($f, $GLOBALS['header_text']);
1253 out($f, "#ifdef ZEND_WIN32\n");
1255 out($f, "# pragma warning(once : 4101)\n");
1258 out($f, "# pragma warning(once : 6235)\n");
1260 out($f, "# pragma warning(once : 6237)\n");
1262 out($f, "# pragma warning(once : 6239)\n");
1264 out($f, "# pragma warning(once : 6240)\n");
1266 out($f, "# pragma warning(once : 6285)\n");
1268 out($f, "# pragma warning(once : 6286)\n");
1270 out($f, "# pragma warning(once : 6326)\n");
1272 out($f, "#endif\n");
1275 out($f, "static user_opcode_handler_t zend_user_opcode_handlers[256] = {\n");
1277 out($f, "\t(user_opcode_handler_t)NULL,\n");
1279 out($f, "\t(user_opcode_handler_t)NULL\n};\n\n");
1281 out($f, "static zend_uchar zend_user_opcodes[256] = {");
1283 if ($i % 16 == 1) out($f, "\n\t");
1284 out($f, "$i,");
1286 out($f, "255\n};\n\n");
1289 gen_executor($f, $skl, ZEND_VM_SPEC, ZEND_VM_KIND, "execute", "zend_init_opcodes_handlers", 0);
1293 out($f,"\n/* Old executor */\n\n");
1294 out($f,"#undef ZEND_VM_CONTINUE\n\n");
1295 out($f,"#undef ZEND_VM_RETURN\n\n");
1296 out($f,"#undef ZEND_VM_ENTER\n\n");
1297 out($f,"#undef ZEND_VM_LEAVE\n\n");
1298 out($f,"#undef ZEND_VM_DISPATCH\n\n");
1299 out($f,"#undef ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL\n\n");
1300 gen_executor($f, $skl, 0, ZEND_VM_KIND_CALL, "old_execute", "zend_vm_use_old_executor", 1);
1304 out($f, "static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op)\n");
1305 out($f, "{\n");
1307 out($f, "\treturn zend_opcode_handlers[opcode];\n");
1310 out($f, "\tif (zend_vm_old_executor) {\n");
1311 out($f, "\t\treturn zend_opcode_handlers[opcode];\n");
1312 out($f, "\t} else {\n");
1314 out($f, "\t\tstatic const int zend_vm_decode[] = {\n");
1315 out($f, "\t\t\t_UNUSED_CODE, /* 0 */\n");
1316 out($f, "\t\t\t_CONST_CODE, /* 1 = IS_CONST */\n");
1317 out($f, "\t\t\t_TMP_CODE, /* 2 = IS_TMP_VAR */\n");
1318 out($f, "\t\t\t_UNUSED_CODE, /* 3 */\n");
1319 out($f, "\t\t\t_VAR_CODE, /* 4 = IS_VAR */\n");
1320 out($f, "\t\t\t_UNUSED_CODE, /* 5 */\n");
1321 out($f, "\t\t\t_UNUSED_CODE, /* 6 */\n");
1322 out($f, "\t\t\t_UNUSED_CODE, /* 7 */\n");
1323 out($f, "\t\t\t_UNUSED_CODE, /* 8 = IS_UNUSED */\n");
1324 out($f, "\t\t\t_UNUSED_CODE, /* 9 */\n");
1325 out($f, "\t\t\t_UNUSED_CODE, /* 10 */\n");
1326 out($f, "\t\t\t_UNUSED_CODE, /* 11 */\n");
1327 out($f, "\t\t\t_UNUSED_CODE, /* 12 */\n");
1328 out($f, "\t\t\t_UNUSED_CODE, /* 13 */\n");
1329 out($f, "\t\t\t_UNUSED_CODE, /* 14 */\n");
1330 out($f, "\t\t\t_UNUSED_CODE, /* 15 */\n");
1331 out($f, "\t\t\t_CV_CODE /* 16 = IS_CV */\n");
1332 out($f, "\t\t};\n");
1333 …out($f, "\t\treturn zend_opcode_handlers[opcode * 25 + zend_vm_decode[op->op1_type] * 5 + zend_vm_…
1335 out($f, "\t}\n");
1338 out($f, "}\n\n");
1341 out($f, "ZEND_API void zend_vm_set_opcode_handler(zend_op* op)\n");
1342 out($f, "{\n");
1343 out($f, "\top->handler = zend_vm_get_opcode_handler(zend_user_opcodes[op->opcode], op);\n");
1344 out($f, "}\n\n");
1350 out($f,"#undef OPLINE\n");
1351 out($f,"#undef DCL_OPLINE\n");
1352 out($f,"#undef USE_OPLINE\n");
1353 out($f,"#undef LOAD_OPLINE\n");
1354 out($f,"#undef SAVE_OPLINE\n");
1355 out($f,"#define OPLINE EX(opline)\n");
1356 out($f,"#define DCL_OPLINE\n");
1357 out($f,"#define USE_OPLINE zend_op *opline = EX(opline);\n");
1358 out($f,"#define LOAD_OPLINE()\n");
1359 out($f,"#define SAVE_OPLINE()\n");
1360 out($f,"#undef CHECK_EXCEPTION\n");
1361 out($f,"#undef HANDLE_EXCEPTION\n");
1362 out($f,"#undef HANDLE_EXCEPTION_LEAVE\n");
1363 out($f,"#define CHECK_EXCEPTION() LOAD_OPLINE()\n");
1364 out($f,"#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
1365 out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
1366 out($f,"#undef ZEND_VM_CONTINUE\n");
1367 out($f,"#undef ZEND_VM_RETURN\n");
1368 out($f,"#undef ZEND_VM_ENTER\n");
1369 out($f,"#undef ZEND_VM_LEAVE\n");
1370 out($f,"#undef ZEND_VM_DISPATCH\n");
1371 out($f,"#undef ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL\n\n");
1372 out($f,"#define ZEND_VM_CONTINUE() return 0\n");
1373 out($f,"#define ZEND_VM_RETURN() return 1\n");
1374 out($f,"#define ZEND_VM_ENTER() return 2\n");
1375 out($f,"#define ZEND_VM_LEAVE() return 3\n");
1376 …out($f,"#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)…
1377 out($f,"#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n\n");
1381 out($f, "ZEND_API int $func(");
1383 out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
1388 out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
1390 out($f, $h['param']. ", ZEND_OPCODE_HANDLER_ARGS)\n");
1397 out($f, "{\n\treturn ".$name."_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
1400 out($f, "{\n\treturn ".$name."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
1407 …out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU…
1413 …out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\…
1419 gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY', $name);
1423 fclose($f);