19.opcode处理函数查找
来源:互联网 发布:linux 更改机器名称 编辑:程序博客网 时间:2024/06/05 18:08
ZEND_API void execute(zend_op_array *op_array TSRMLS_DC){...zend_vm_enter:....if ((ret = EX(opline)->handler(execute_data TSRMLS_CC)) > 0) { switch (ret) { case 1: EG(in_execution) = original_in_execution; return; case 2: op_array = EG(active_op_array); goto zend_vm_enter; case 3: execute_data = EG(current_execute_data); default: break; }}...}
static opcode_handler_tzend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op){ static const int zend_vm_decode[] = { _UNUSED_CODE, /* 0 */ _CONST_CODE, /* 1 = IS_CONST */ _TMP_CODE, /* 2 = IS_TMP_VAR */ _UNUSED_CODE, /* 3 */ _VAR_CODE, /* 4 = IS_VAR */ _UNUSED_CODE, /* 5 */ _UNUSED_CODE, /* 6 */ _UNUSED_CODE, /* 7 */ _UNUSED_CODE, /* 8 = IS_UNUSED */ _UNUSED_CODE, /* 9 */ _UNUSED_CODE, /* 10 */ _UNUSED_CODE, /* 11 */ _UNUSED_CODE, /* 12 */ _UNUSED_CODE, /* 13 */ _UNUSED_CODE, /* 14 */ _UNUSED_CODE, /* 15 */ _CV_CODE /* 16 = IS_CV */ }; return zend_opcode_handlers[ opcode * 25 + zend_vm_decode[op->op1.op_type] * 5 + zend_vm_decode[op->op2.op_type]];}
//函数调用:DO_FCALL ==> ZEND_DO_FCALL_SPEC_CONST_HANDLER//变量赋值:ASSIGN => ZEND_ASSIGN_SPEC_VAR_CONST_HANDLER ZEND_ASSIGN_SPEC_VAR_TMP_HANDLER ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER ZEND_ASSIGN_SPEC_VAR_CV_HANDLER //变量加法:ASSIGN_SUB => ZEND_ASSIGN_SUB_SPEC_VAR_CONST_HANDLER, ZEND_ASSIGN_SUB_SPEC_VAR_TMP_HANDLER, ZEND_ASSIGN_SUB_SPEC_VAR_VAR_HANDLER, ZEND_ASSIGN_SUB_SPEC_VAR_UNUSED_HANDLER, ZEND_ASSIGN_SUB_SPEC_VAR_CV_HANDLER, ZEND_ASSIGN_SUB_SPEC_UNUSED_CONST_HANDLER, ZEND_ASSIGN_SUB_SPEC_UNUSED_TMP_HANDLER, ZEND_ASSIGN_SUB_SPEC_UNUSED_VAR_HANDLER, ZEND_ASSIGN_SUB_SPEC_UNUSED_UNUSED_HANDLER, ZEND_ASSIGN_SUB_SPEC_UNUSED_CV_HANDLER, ZEND_ASSIGN_SUB_SPEC_CV_CONST_HANDLER, ZEND_ASSIGN_SUB_SPEC_CV_TMP_HANDLER, ZEND_ASSIGN_SUB_SPEC_CV_VAR_HANDLER, ZEND_ASSIGN_SUB_SPEC_CV_UNUSED_HANDLER, ZEND_ASSIGN_SUB_SPEC_CV_CV_HANDLER,
static opcode_handler_tzend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op){ static const int zend_vm_decode[] = { _UNUSED_CODE, /* 0 */ _CONST_CODE, /* 1 = IS_CONST */ _TMP_CODE, /* 2 = IS_TMP_VAR */ _UNUSED_CODE, /* 3 */ _VAR_CODE, /* 4 = IS_VAR */ _UNUSED_CODE, /* 5 */ _UNUSED_CODE, /* 6 */ _UNUSED_CODE, /* 7 */ _UNUSED_CODE, /* 8 = IS_UNUSED */ _UNUSED_CODE, /* 9 */ _UNUSED_CODE, /* 10 */ _UNUSED_CODE, /* 11 */ _UNUSED_CODE, /* 12 */ _UNUSED_CODE, /* 13 */ _UNUSED_CODE, /* 14 */ _UNUSED_CODE, /* 15 */ _CV_CODE /* 16 = IS_CV */ }; //很显然,我们把opcode和相对应的写到了/tmp/php.log文件中 int op_index; op_index = opcode * 25 + zend_vm_decode[op->op1.op_type] * 5 + zend_vm_decode[op->op2.op_type]; FILE *stream; if((stream = fopen("/tmp/php.log", "a+")) != NULL){ fprintf(stream, "opcode: %d , zend_opcode_handlers_index:%d\n", opcode, op_index); } fclose(stream); return zend_opcode_handlers[ opcode * 25 + zend_vm_decode[op->op1.op_type] * 5 + zend_vm_decode[op->op2.op_type]];}
http://www.php-internals.com/book/?p=chapt02/02-03-03-from-opcode-to-handler
0 0
- 19.opcode处理函数查找
- PHP内核之opcode的处理函数查找
- [李景山php] 深入理解PHP内核[读书笔记]--第二章:用户代码执行--opcode处理函数查找
- OpCode
- 获得一条指令(opcode and opdata)长度的函数(转)
- 获得一条指令(opcode and opdata)长度的函数(转)
- Opcode Mnemonics by Opcode
- opcode 查询,opcode 汇总
- CONVERT函数全部用法 可以用于处理时间的查找
- php字符串处理函数 字符串查找、替换、截取
- 字符串的查找删除(字符串处理函数的应用)
- Opcode 笔记
- OPcode简介
- php opcode
- 什么是OpCode?
- OpCode教程
- Opcode OPC_MeshInterface
- Opcode特征
- ionicCSS01_头部、底部和按钮
- 初学者如何使用git上传代码到github
- 整合mybatis时报错:Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespac
- vue入门实战教程 - 用vue高仿饿了吗APP
- mysql 7天一跟踪实现
- 19.opcode处理函数查找
- 20170108
- thinkphp nginx下面完美配置解决404 file not found
- Webpack + vue-loader构建单文件vue组件
- Orchard .NET CMS 安装
- javascript 基础 insertAfter与insertBefore
- 数据库配置,参考django框架,采用嵌套的字典实现
- 使用SonarQube Scanner分析项目代码
- java 多线程学习笔记一