当前位置: 首页>>代码示例>>PHP>>正文


PHP gen_executor_code函数代码示例

本文整理汇总了PHP中gen_executor_code函数的典型用法代码示例。如果您正苦于以下问题:PHP gen_executor_code函数的具体用法?PHP gen_executor_code怎么用?PHP gen_executor_code使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了gen_executor_code函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gen_executor


//.........这里部分代码省略.........
                        out($f, "#endif\n");
                        out($f, "#ifdef ZEND_VM_FP_GLOBAL_REG\n");
                        out($f, $m[1] . "zend_execute_data *orig_execute_data = execute_data;\n");
                        out($f, $m[1] . "execute_data = ex;\n");
                        out($f, "#else\n");
                        out($f, $m[1] . "zend_execute_data *execute_data = ex;\n");
                        out($f, "#endif\n");
                    }
                    break;
                case "INTERNAL_LABELS":
                    if ($kind == ZEND_VM_KIND_GOTO) {
                        // Emit array of labels of opcode handlers and code for
                        // zend_opcode_handlers initialization
                        $prolog = $m[1];
                        out($f, $prolog . "if (UNEXPECTED(execute_data == NULL)) {\n");
                        out($f, $prolog . "\tstatic const void* labels[] = {\n");
                        gen_labels($f, $spec, $kind, $prolog . "\t\t");
                        out($f, $prolog . "\t};\n");
                        out($f, $prolog . "\tzend_opcode_handlers = (const void **)labels;\n");
                        out($f, $prolog . "\treturn;\n");
                        out($f, $prolog . "}\n");
                    } else {
                        skip_blanks($f, $m[1], $m[3]);
                    }
                    break;
                case "ZEND_VM_CONTINUE_LABEL":
                    if ($kind == ZEND_VM_KIND_CALL) {
                        // Only SWITCH dispatch method use it
                        out($f, "#if !defined(ZEND_VM_FP_GLOBAL_REG) || !defined(ZEND_VM_IP_GLOBAL_REG)\n");
                        out($f, $m[1] . "\tint ret;" . $m[3] . "\n");
                        out($f, "#endif\n");
                    } else {
                        if ($kind == ZEND_VM_KIND_SWITCH) {
                            // Only SWITCH dispatch method use it
                            out($f, "zend_vm_continue:" . $m[3] . "\n");
                        } else {
                            skip_blanks($f, $m[1], $m[3]);
                        }
                    }
                    break;
                case "ZEND_VM_DISPATCH":
                    // Emit code that dispatches to opcode handler
                    switch ($kind) {
                        case ZEND_VM_KIND_CALL:
                            out($f, "#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
                            out($f, $m[1] . "((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
                            out($f, $m[1] . "if (UNEXPECTED(!OPLINE))" . $m[3] . "\n");
                            out($f, "#else\n");
                            out($f, $m[1] . "if (UNEXPECTED((ret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)) != 0))" . $m[3] . "\n");
                            out($f, "#endif\n");
                            break;
                        case ZEND_VM_KIND_SWITCH:
                            out($f, $m[1] . "dispatch_handler = OPLINE->handler;\nzend_vm_dispatch:\n" . $m[1] . "switch ((int)(uintptr_t)dispatch_handler)" . $m[3] . "\n");
                            break;
                        case ZEND_VM_KIND_GOTO:
                            out($f, $m[1] . "goto *(void**)(OPLINE->handler);" . $m[3] . "\n");
                            break;
                    }
                    break;
                case "INTERNAL_EXECUTOR":
                    if ($kind == ZEND_VM_KIND_CALL) {
                        // Executor is defined as a set of functions
                        out($f, "#ifdef ZEND_VM_FP_GLOBAL_REG\n" . $m[1] . "execute_data = orig_execute_data;\n" . "# ifdef ZEND_VM_IP_GLOBAL_REG\n" . $m[1] . "opline = orig_opline;\n" . "# endif\n" . $m[1] . "return;\n" . "#else\n" . $m[1] . "if (EXPECTED(ret > 0)) {\n" . $m[1] . "\texecute_data = EG(current_execute_data);\n" . $m[1] . "} else {\n" . "# ifdef ZEND_VM_IP_GLOBAL_REG\n" . $m[1] . "\topline = orig_opline;\n" . "# endif\n" . $m[1] . "\treturn;\n" . $m[1] . "}\n" . "#endif\n");
                    } else {
                        // Emit executor code
                        gen_executor_code($f, $spec, $kind, $m[1]);
                    }
                    break;
                case "EXTERNAL_EXECUTOR":
                    if ($kind == ZEND_VM_KIND_CALL) {
                        gen_executor_code($f, $spec, $kind, $m[1]);
                    }
                    break;
                case "INITIALIZER_NAME":
                    out($f, $m[1] . $initializer_name . $m[3] . "\n");
                    break;
                case "EXTERNAL_LABELS":
                    // Emit code that initializes zend_opcode_handlers array
                    $prolog = $m[1];
                    if ($kind == ZEND_VM_KIND_GOTO) {
                        // Labels are defined in the executor itself, so we call it
                        // with execute_data NULL and it sets zend_opcode_handlers array
                        out($f, $prolog . "");
                        out($f, $prolog . $executor_name . "_ex(NULL);\n");
                    } else {
                        out($f, $prolog . "static const void *labels[] = {\n");
                        gen_labels($f, $spec, $kind, $prolog . "\t");
                        out($f, $prolog . "};\n");
                        out($f, $prolog . "zend_opcode_handlers = labels;\n");
                    }
                    break;
                default:
                    die("ERROR: Unknown keyword " . $m[2] . " in skeleton file.\n");
            }
        } else {
            // Copy the line as is
            out($f, $line);
        }
    }
}
开发者ID:sutandang,项目名称:php-src,代码行数:101,代码来源:zend_vm_gen.php

示例2: gen_executor


//.........这里部分代码省略.........
                    break;
                case "INTERNAL_LABELS":
                    if ($kind == ZEND_VM_KIND_GOTO) {
                        // Emit array of labels of opcode handlers and code for
                        // zend_opcode_handlers initialization
                        $prolog = $m[1];
                        out($f, $prolog . "if (execute_data == NULL) {\n");
                        out($f, $prolog . "\tstatic const opcode_handler_t labels[] = {\n");
                        gen_labels($f, $spec, $kind, $prolog . "\t\t");
                        out($f, $prolog . "\t};\n");
                        out($f, $prolog . "\tzend_opcode_handlers = (opcode_handler_t*)labels;\n");
                        out($f, $prolog . "\treturn;\n");
                        out($f, $prolog . "}\n");
                    } else {
                        skip_blanks($f, $m[1], $m[3]);
                    }
                    break;
                case "ZEND_VM_CONTINUE_LABEL":
                    if ($kind == ZEND_VM_KIND_CALL) {
                        // Only SWITCH dispatch method use it
                        out($f, $m[1] . "\tint ret;" . $m[3] . "\n");
                    } else {
                        if ($kind == ZEND_VM_KIND_SWITCH) {
                            // Only SWITCH dispatch method use it
                            out($f, "zend_vm_continue:" . $m[3] . "\n");
                        } else {
                            skip_blanks($f, $m[1], $m[3]);
                        }
                    }
                    break;
                case "ZEND_VM_DISPATCH":
                    // Emit code that dispatches to opcode handler
                    switch ($kind) {
                        case ZEND_VM_KIND_CALL:
                            out($f, $m[1] . "if ((ret = OPLINE->handler(execute_data TSRMLS_CC)) > 0)" . $m[3] . "\n");
                            break;
                        case ZEND_VM_KIND_SWITCH:
                            out($f, $m[1] . "dispatch_handler = OPLINE->handler;\nzend_vm_dispatch:\n" . $m[1] . "switch ((int)dispatch_handler)" . $m[3] . "\n");
                            break;
                        case ZEND_VM_KIND_GOTO:
                            out($f, $m[1] . "goto *(void**)(OPLINE->handler);" . $m[3] . "\n");
                            break;
                    }
                    break;
                case "INTERNAL_EXECUTOR":
                    if ($kind == ZEND_VM_KIND_CALL) {
                        // Executor is defined as a set of functions
                        out($f, $m[1] . "switch (ret) {\n" . $m[1] . "\tcase 1:\n" . $m[1] . "\t\tEG(in_execution) = original_in_execution;\n" . $m[1] . "\t\treturn;\n" . $m[1] . "\tcase 2:\n" . $m[1] . "\t\tgoto zend_vm_enter;\n" . $m[1] . "\t\tbreak;\n" . $m[1] . "\tcase 3:\n" . $m[1] . "\t\texecute_data = EG(current_execute_data);\n" . $m[1] . "\t\tbreak;\n" . $m[1] . "\tdefault:\n" . $m[1] . "\t\tbreak;\n" . $m[1] . "}" . $m[3] . "\n");
                    } else {
                        // Emit executor code
                        gen_executor_code($f, $spec, $kind, $m[1]);
                    }
                    break;
                case "EXTERNAL_EXECUTOR":
                    if ($kind == ZEND_VM_KIND_CALL) {
                        // Unspecialized executor with CALL threading is the same as the
                        // old one, so we don't need to produce code twitch
                        if (!$old || ZEND_VM_SPEC || ZEND_VM_KIND != ZEND_VM_KIND_CALL) {
                            // Emit executor code
                            gen_executor_code($f, $spec, $kind, $m[1]);
                        }
                    }
                    break;
                case "INITIALIZER_NAME":
                    out($f, $m[1] . $initializer_name . $m[3] . "\n");
                    break;
                case "EXTERNAL_LABELS":
                    // Emit code that initializes zend_opcode_handlers array
                    $prolog = $m[1];
                    if ($kind == ZEND_VM_KIND_GOTO) {
                        // Labels are defined in the executor itself, so we call it
                        // with execute_data NULL and it sets zend_opcode_handlers array
                        out($f, $prolog . "TSRMLS_FETCH();\n");
                        out($f, $prolog . $executor_name . "_ex(NULL TSRMLS_CC);\n");
                    } else {
                        if ($old) {
                            // Reserving space for user-defined opcodes
                            out($f, $prolog . "static opcode_handler_t labels[512] = {\n");
                        } else {
                            out($f, $prolog . "static const opcode_handler_t labels[] = {\n");
                        }
                        gen_labels($f, $spec, $kind, $prolog . "\t");
                        out($f, $prolog . "};\n");
                        out($f, $prolog . "zend_opcode_handlers = (opcode_handler_t*)labels;\n");
                        if ($old) {
                            // Setup old executor
                            out($f, $prolog . "zend_vm_old_executor = 1;\n");
                            out($f, $prolog . "zend_execute = old_execute;\n");
                        }
                    }
                    break;
                default:
                    die("ERROR: Unknown keyword " . $m[2] . " in skeleton file.\n");
            }
        } else {
            // Copy the line as is
            out($f, $line);
        }
    }
}
开发者ID:rrehbeindoi,项目名称:php-src,代码行数:101,代码来源:zend_vm_gen.php

示例3: gen_executor


//.........这里部分代码省略.........
                        $prolog = $m[1];
                        out($f, $prolog . "if (op_array == NULL) {\n");
                        out($f, $prolog . "\tstatic const opcode_handler_t labels[] = {\n");
                        gen_labels($f, $spec, $kind, $prolog . "\t\t");
                        out($f, $prolog . "\t};\n");
                        out($f, $prolog . "\tzend_opcode_handlers = (opcode_handler_t*)labels;\n");
                        out($f, $prolog . "\treturn;\n");
                        out($f, $prolog . "}\n");
                    } else {
                        skip_blanks($f, $m[1], $m[3]);
                    }
                    break;
                case "ZEND_VM_CONTINUE_LABEL":
                    if ($kind == ZEND_VM_KIND_SWITCH) {
                        // Only SWITCH dispatch method use it
                        out($f, "zend_vm_continue:" . $m[3] . "\n");
                    } else {
                        skip_blanks($f, $m[1], $m[3]);
                    }
                    break;
                case "ZEND_VM_DISPATCH":
                    // Emit code that dispatches to opcode handler
                    switch ($kind) {
                        case ZEND_VM_KIND_CALL:
                            out($f, $m[1] . "if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0)" . $m[3] . "\n");
                            break;
                        case ZEND_VM_KIND_SWITCH:
                            out($f, $m[1] . "dispatch_handler = EX(opline)->handler;\nzend_vm_dispatch:\n" . $m[1] . "switch ((int)dispatch_handler)" . $m[3] . "\n");
                            break;
                        case ZEND_VM_KIND_GOTO:
                        case ZEND_VM_KIND_GOTO2:
                            out($f, $m[1] . "goto *(void**)(EX(opline)->handler);" . $m[3] . "\n");
                            break;
                    }
                    break;
                case "INTERNAL_EXECUTOR":
                    if ($kind == ZEND_VM_KIND_CALL) {
                        // Executor is defined as a set of functions
                        out($f, $m[1] . "return;" . $m[3] . "\n");
                    } else {
                        // Emit executor code
                        gen_executor_code($f, $spec, $kind, $m[1]);
                    }
                    break;
                case "EXTERNAL_EXECUTOR":
                    if ($kind == ZEND_VM_KIND_CALL) {
                        // Unspecialized executor with CALL threading is the same as the
                        // old one, so we don't need to produce code twitch
                        if (!$old || ZEND_VM_SPEC || ZEND_VM_KIND != ZEND_VM_KIND_CALL) {
                            out($f, "#undef EX\n");
                            out($f, "#define EX(element) execute_data->element\n\n");
                            // Emit executor code
                            gen_executor_code($f, $spec, $kind, $m[1]);
                        }
                    }
                    break;
                case "EXECUTE_DATA_ASSIGN":
                    if ($kind == ZEND_VM_KIND_GOTO2) {
                        out($f, $m[1] . "EG(current_execute_data) = execute_data;" . $m[3] . "\n");
                    } else {
                        out($f, $m[1] . "EG(current_execute_data) = &execute_data;" . $m[3] . "\n");
                    }
                    break;
                case "INITIALIZER_NAME":
                    out($f, $m[1] . $initializer_name . $m[3] . "\n");
                    break;
                case "EXTERNAL_LABELS":
                    // Emit code that initializes zend_opcode_handlers array
                    $prolog = $m[1];
                    if ($kind == ZEND_VM_KIND_GOTO || $kind == ZEND_VM_KIND_GOTO2) {
                        // Labels are defined in the executor itself, so we call it
                        // with op_array NULL and it sets zend_opcode_handlers array
                        out($f, $prolog . "TSRMLS_FETCH();\n");
                        out($f, $prolog . "zend_execute(NULL TSRMLS_CC);\n");
                    } else {
                        if ($old) {
                            // Reserving space for user-defined opcodes
                            out($f, $prolog . "static opcode_handler_t labels[512] = {\n");
                        } else {
                            out($f, $prolog . "static const opcode_handler_t labels[] = {\n");
                        }
                        gen_labels($f, $spec, $kind, $prolog . "\t");
                        out($f, $prolog . "};\n");
                        out($f, $prolog . "zend_opcode_handlers = (opcode_handler_t*)labels;\n");
                        if ($old) {
                            // Setup old executor
                            out($f, $prolog . "zend_vm_old_executor = 1;\n");
                            out($f, $prolog . "zend_execute = old_execute;\n");
                        }
                    }
                    break;
                default:
                    die("ERROR: Unknown keyword " . $m[2] . " in skeleton file.\n");
            }
        } else {
            // Copy the line as is
            out($f, $line);
        }
    }
}
开发者ID:kennyb,项目名称:php-broken,代码行数:101,代码来源:zend_vm_gen.php


注:本文中的gen_executor_code函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。