• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP gen_code函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: gen_vm


//.........这里部分代码省略.........
        out($f, "#endif\n");
        out($f, "\n");
        out($f, "\tLOAD_OPLINE();\n");
        out($f, "#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
        out($f, "\t((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
        out($f, "\tif (EXPECTED(opline)) {\n");
        out($f, "\t\tret = execute_data != ex ? (int)(execute_data->prev_execute_data != ex) + 1 : 0;\n");
        out($f, "\t\tSAVE_OPLINE();\n");
        out($f, "\t} else {\n");
        out($f, "\t\tret = -1;\n");
        out($f, "\t}\n");
        out($f, "#else\n");
        out($f, "\tret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
        out($f, "\tSAVE_OPLINE();\n");
        out($f, "#endif\n");
        out($f, "#ifdef ZEND_VM_FP_GLOBAL_REG\n");
        out($f, "\texecute_data = orig_execute_data;\n");
        out($f, "#endif\n");
        out($f, "#ifdef ZEND_VM_IP_GLOBAL_REG\n");
        out($f, "\topline = orig_opline;\n");
        out($f, "#endif\n");
        out($f, "\treturn ret;\n");
        out($f, "}\n\n");
    } else {
        out($f, "ZEND_API int zend_vm_call_opcode_handler(zend_execute_data* ex)\n");
        out($f, "{\n");
        out($f, "\tzend_error_noreturn(E_CORE_ERROR, \"zend_vm_call_opcode_handler() is not supported\");\n");
        out($f, "\treturn 0;\n");
        out($f, "}\n\n");
    }
    // Export handlers and helpers
    if (count($export) > 0 && ZEND_VM_KIND != ZEND_VM_KIND_CALL) {
        out($f, "#undef OPLINE\n");
        out($f, "#undef DCL_OPLINE\n");
        out($f, "#undef USE_OPLINE\n");
        out($f, "#undef LOAD_OPLINE\n");
        out($f, "#undef LOAD_NEXT_OPLINE\n");
        out($f, "#undef SAVE_OPLINE\n");
        out($f, "#define OPLINE EX(opline)\n");
        out($f, "#define DCL_OPLINE\n");
        out($f, "#define USE_OPLINE const zend_op *opline = EX(opline);\n");
        out($f, "#define LOAD_OPLINE()\n");
        out($f, "#define LOAD_NEXT_OPLINE() ZEND_VM_INC_OPCODE()\n");
        out($f, "#define SAVE_OPLINE()\n");
        out($f, "#undef HANDLE_EXCEPTION\n");
        out($f, "#undef HANDLE_EXCEPTION_LEAVE\n");
        out($f, "#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
        out($f, "#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
        out($f, "#undef ZEND_VM_CONTINUE\n");
        out($f, "#undef ZEND_VM_RETURN\n");
        out($f, "#undef ZEND_VM_ENTER\n");
        out($f, "#undef ZEND_VM_LEAVE\n");
        out($f, "#undef ZEND_VM_DISPATCH\n");
        out($f, "#define ZEND_VM_CONTINUE()   return  0\n");
        out($f, "#define ZEND_VM_RETURN()     return -1\n");
        out($f, "#define ZEND_VM_ENTER()      return  1\n");
        out($f, "#define ZEND_VM_LEAVE()      return  2\n");
        out($f, "#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n\n");
        out($f, "\n");
    }
    foreach ($export as $dsk) {
        list($kind, $func, $name) = $dsk;
        out($f, "ZEND_API int {$func}(");
        if ($kind == "handler") {
            out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
            $code = $opcodes[$opnames[$name]]['code'];
        } else {
            $h = $helpers[$name];
            if ($h['param'] == null) {
                out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
            } else {
                out($f, $h['param'] . " ZEND_OPCODE_HANDLER_ARGS_DC)\n");
            }
            $code = $h['code'];
        }
        $done = 0;
        if (ZEND_VM_KIND == ZEND_VM_KIND_CALL) {
            if ($kind == "handler") {
                $op = $opcodes[$opnames[$name]];
                if (isset($op['op1']["ANY"]) && isset($op['op2']["ANY"])) {
                    out($f, "{\n\treturn " . $name . (ZEND_VM_SPEC ? "_SPEC" : "") . "_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
                    $done = 1;
                }
            } else {
                if ($helpers[$name]["param"] == null) {
                    $h = $helpers[$name];
                    if (isset($h['op1']["ANY"]) && isset($h['op2']["ANY"])) {
                        out($f, "{\n\treturn " . $name . (ZEND_VM_SPEC ? "_SPEC" : "") . "(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
                        $done = 1;
                    }
                }
            }
        }
        if (!$done) {
            gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY', $name);
        }
    }
    fclose($f);
    echo "zend_vm_execute.h generated successfully.\n";
}
开发者ID:sutandang,项目名称:php-src,代码行数:101,代码来源:zend_vm_gen.php


示例2: gen_vm


//.........这里部分代码省略.........
        out($f, "\t\t\t_UNUSED_CODE, /* 12             */\n");
        out($f, "\t\t\t_UNUSED_CODE, /* 13             */\n");
        out($f, "\t\t\t_UNUSED_CODE, /* 14             */\n");
        out($f, "\t\t\t_UNUSED_CODE, /* 15             */\n");
        out($f, "\t\t\t_CV_CODE      /* 16 = IS_CV     */\n");
        out($f, "\t\t};\n");
        out($f, "\t\treturn zend_opcode_handlers[opcode * 25 + zend_vm_decode[op->op1_type] * 5 + zend_vm_decode[op->op2_type]];\n");
        if (ZEND_VM_OLD_EXECUTOR) {
            out($f, "\t}\n");
        }
    }
    out($f, "}\n\n");
    // Generate zend_vm_get_opcode_handler() function
    out($f, "ZEND_API void zend_vm_set_opcode_handler(zend_op* op)\n");
    out($f, "{\n");
    out($f, "\top->handler = zend_vm_get_opcode_handler(zend_user_opcodes[op->opcode], op);\n");
    out($f, "}\n\n");
    // Export handlers and helpers
    if (count($export) > 0 && !ZEND_VM_OLD_EXECUTOR && ZEND_VM_KIND != ZEND_VM_KIND_CALL) {
        out($f, "#undef OPLINE\n");
        out($f, "#undef DCL_OPLINE\n");
        out($f, "#undef USE_OPLINE\n");
        out($f, "#undef LOAD_OPLINE\n");
        out($f, "#undef SAVE_OPLINE\n");
        out($f, "#define OPLINE EX(opline)\n");
        out($f, "#define DCL_OPLINE\n");
        out($f, "#define USE_OPLINE zend_op *opline = EX(opline);\n");
        out($f, "#define LOAD_OPLINE()\n");
        out($f, "#define SAVE_OPLINE()\n");
        out($f, "#undef CHECK_EXCEPTION\n");
        out($f, "#undef HANDLE_EXCEPTION\n");
        out($f, "#undef HANDLE_EXCEPTION_LEAVE\n");
        out($f, "#define CHECK_EXCEPTION() LOAD_OPLINE()\n");
        out($f, "#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
        out($f, "#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
        out($f, "#undef ZEND_VM_CONTINUE\n");
        out($f, "#undef ZEND_VM_RETURN\n");
        out($f, "#undef ZEND_VM_ENTER\n");
        out($f, "#undef ZEND_VM_LEAVE\n");
        out($f, "#undef ZEND_VM_DISPATCH\n");
        out($f, "#undef ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL\n\n");
        out($f, "#define ZEND_VM_CONTINUE()   return 0\n");
        out($f, "#define ZEND_VM_RETURN()     return 1\n");
        out($f, "#define ZEND_VM_ENTER()      return 2\n");
        out($f, "#define ZEND_VM_LEAVE()      return 3\n");
        out($f, "#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n\n");
        out($f, "#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC\n\n");
    }
    foreach ($export as $dsk) {
        list($kind, $func, $name) = $dsk;
        out($f, "ZEND_API int {$func}(");
        if ($kind == "handler") {
            out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
            $code = $opcodes[$opnames[$name]]['code'];
        } else {
            $h = $helpers[$name];
            if ($h['param'] == null) {
                out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
            } else {
                out($f, $h['param'] . ", ZEND_OPCODE_HANDLER_ARGS)\n");
            }
            $code = $h['code'];
        }
        $done = 0;
        if (ZEND_VM_OLD_EXECUTOR) {
            if ($kind == "handler") {
                out($f, "{\n\treturn " . $name . "_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
                $done = 1;
            } else {
                if ($helpers[$name]["param"] == null) {
                    out($f, "{\n\treturn " . $name . "(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
                    $done = 1;
                }
            }
        } else {
            if (ZEND_VM_KIND == ZEND_VM_KIND_CALL) {
                if ($kind == "handler") {
                    $op = $opcodes[$opnames[$name]];
                    if (isset($op['op1']["ANY"]) && isset($op['op2']["ANY"])) {
                        out($f, "{\n\treturn " . $name . (ZEND_VM_SPEC ? "_SPEC" : "") . "_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
                        $done = 1;
                    }
                } else {
                    if ($helpers[$name]["param"] == null) {
                        $h = $helpers[$name];
                        if (isset($h['op1']["ANY"]) && isset($h['op2']["ANY"])) {
                            out($f, "{\n\treturn " . $name . (ZEND_VM_SPEC ? "_SPEC" : "") . "(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
                            $done = 1;
                        }
                    }
                }
            }
        }
        if (!$done) {
            gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY', $name);
        }
    }
    fclose($f);
    echo "zend_vm_execute.h generated successfully.\n";
}
开发者ID:rrehbeindoi,项目名称:php-src,代码行数:101,代码来源:zend_vm_gen.php


示例3: gen_vm


//.........这里部分代码省略.........
        out($f, "\n");
        out($f, "\tLOAD_OPLINE();\n");
        out($f, "#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)\n");
        out($f, "\t((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
        out($f, "\tif (EXPECTED(opline)) {\n");
        out($f, "\t\tret = execute_data != ex ? (int)(execute_data->prev_execute_data != ex) + 1 : 0;\n");
        out($f, "\t\tSAVE_OPLINE();\n");
        out($f, "\t} else {\n");
        out($f, "\t\tret = -1;\n");
        out($f, "\t}\n");
        out($f, "#else\n");
        out($f, "\tret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
        out($f, "\tSAVE_OPLINE();\n");
        out($f, "#endif\n");
        out($f, "#ifdef ZEND_VM_FP_GLOBAL_REG\n");
        out($f, "\texecute_data = orig_execute_data;\n");
        out($f, "#endif\n");
        out($f, "#ifdef ZEND_VM_IP_GLOBAL_REG\n");
        out($f, "\topline = orig_opline;\n");
        out($f, "#endif\n");
        out($f, "\treturn ret;\n");
        out($f, "}\n\n");
    } else {
        out($f, "ZEND_API int zend_vm_call_opcode_handler(zend_execute_data* ex)\n");
        out($f, "{\n");
        out($f, "\tzend_error_noreturn(E_CORE_ERROR, \"zend_vm_call_opcode_handler() is not supported\");\n");
        out($f, "\treturn 0;\n");
        out($f, "}\n\n");
    }
    // Export handlers and helpers
    if (count($export) > 0 && ZEND_VM_KIND != ZEND_VM_KIND_CALL) {
        out($f, "#undef OPLINE\n");
        out($f, "#undef DCL_OPLINE\n");
        out($f, "#undef USE_OPLINE\n");
        out($f, "#undef LOAD_OPLINE\n");
        out($f, "#undef LOAD_NEXT_OPLINE\n");
        out($f, "#undef SAVE_OPLINE\n");
        out($f, "#define OPLINE EX(opline)\n");
        out($f, "#define DCL_OPLINE\n");
        out($f, "#define USE_OPLINE const zend_op *opline = EX(opline);\n");
        out($f, "#define LOAD_OPLINE()\n");
        out($f, "#define LOAD_NEXT_OPLINE() ZEND_VM_INC_OPCODE()\n");
        out($f, "#define SAVE_OPLINE()\n");
        out($f, "#undef HANDLE_EXCEPTION\n");
        out($f, "#undef HANDLE_EXCEPTION_LEAVE\n");
        out($f, "#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
        out($f, "#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
        out($f, "#undef ZEND_VM_CONTINUE\n");
        out($f, "#undef ZEND_VM_RETURN\n");
        out($f, "#undef ZEND_VM_ENTER\n");
        out($f, "#undef ZEND_VM_LEAVE\n");
        out($f, "#undef ZEND_VM_DISPATCH\n");
        out($f, "#define ZEND_VM_CONTINUE()   return  0\n");
        out($f, "#define ZEND_VM_RETURN()     return -1\n");
        out($f, "#define ZEND_VM_ENTER()      return  1\n");
        out($f, "#define ZEND_VM_LEAVE()      return  2\n");
        out($f, "#define ZEND_VM_INTERRUPT()  return zend_interrupt_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n");
        out($f, "#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n\n");
        out($f, "\n");
    }
    foreach ($export as $dsk) {
        list($kind, $func, $name) = $dsk;
        out($f, "ZEND_API int {$func}(");
        if ($kind == "handler") {
            out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
            $code = $opcodes[$opnames[$name]]['code'];
        } else {
            $h = $helpers[$name];
            if ($h['param'] == null) {
                out($f, "ZEND_OPCODE_HANDLER_ARGS)\n");
            } else {
                out($f, $h['param'] . " ZEND_OPCODE_HANDLER_ARGS_DC)\n");
            }
            $code = $h['code'];
        }
        $done = 0;
        if (ZEND_VM_KIND == ZEND_VM_KIND_CALL) {
            if ($kind == "handler") {
                $op = $opcodes[$opnames[$name]];
                if (isset($op['op1']["ANY"]) && isset($op['op2']["ANY"])) {
                    out($f, "{\n\treturn " . $name . (ZEND_VM_SPEC ? "_SPEC" : "") . "_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
                    $done = 1;
                }
            } else {
                if ($helpers[$name]["param"] == null) {
                    $h = $helpers[$name];
                    if (isset($h['op1']["ANY"]) && isset($h['op2']["ANY"])) {
                        out($f, "{\n\treturn " . $name . (ZEND_VM_SPEC ? "_SPEC" : "") . "(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
                        $done = 1;
                    }
                }
            }
        }
        if (!$done) {
            gen_code($f, 0, ZEND_VM_KIND_CALL, 1, $code, 'ANY', 'ANY', $name);
        }
    }
    fclose($f);
    echo "zend_vm_execute.h generated successfully.\n";
}
开发者ID:jimjag,项目名称:php-src,代码行数:101,代码来源:zend_vm_gen.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP gen_db_date函数代码示例发布时间:2022-05-15
下一篇:
PHP gen_coa_pull_down函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap