这里阅读的php版本为PHP-7.1.0 RC3,阅读代码的平台为linux

CG

CG是从全局的compiler_global中获取属性值,里面存储的就是编译过程使用到的全局变量。

struct _zend_compiler_globals {
zend_stack loop_var_stack; zend_class_entry *active_class_entry; zend_string *compiled_filename; int zend_lineno; zend_op_array *active_op_array; HashTable *function_table; /* function symbol table */
HashTable *class_table; /* class table */ HashTable filenames_table; HashTable *auto_globals; zend_bool parse_error;
zend_bool in_compilation;
zend_bool short_tags; zend_bool unclean_shutdown; zend_bool ini_parser_unbuffered_errors; zend_llist open_files; struct _zend_ini_parser_param *ini_parser_param; uint32_t start_lineno; // 执行文件开始执行的行号
zend_bool increment_lineno; zend_string *doc_comment;
uint32_t extra_fn_flags; uint32_t compiler_options; /* set of ZEND_COMPILE_* constants */ HashTable const_filenames; zend_oparray_context context;
zend_file_context file_context; zend_arena *arena; zend_string *empty_string;
zend_string *one_char_string[256];
zend_string **known_strings;
uint32_t known_strings_count; HashTable interned_strings; const zend_encoding **script_encoding_list;
size_t script_encoding_list_size;
zend_bool multibyte;
zend_bool detect_unicode;
zend_bool encoding_declared; zend_ast *ast;
zend_arena *ast_arena; zend_stack delayed_oplines_stack; #ifdef ZTS
zval **static_members_table;
int last_static_member;
#endif
};

SG

SG是从全局的sapi_global中获取属性值

// TODO:更新
typedef struct _sapi_globals_struct {
void *server_context;
sapi_request_info request_info; // 请求信息
sapi_headers_struct sapi_headers;
int64_t read_post_bytes;
unsigned char post_read;
unsigned char headers_sent;
zend_stat_t global_stat;
char *default_mimetype;
char *default_charset;
HashTable *rfc1867_uploaded_files;
zend_long post_max_size;
int options;
zend_bool sapi_started;
double global_request_time;
HashTable known_post_content_types;
zval callback_func;
zend_fcall_info_cache fci_cache;
} sapi_globals_struct;

EG

EG是从executor_globals中获取变量

// TODO: 更新
struct _zend_executor_globals {
zval uninitialized_zval;
zval error_zval; /* symbol table cache */
zend_array *symtable_cache[SYMTABLE_CACHE_SIZE];
zend_array **symtable_cache_limit;
zend_array **symtable_cache_ptr; zend_array symbol_table; /* main symbol table */ HashTable included_files; /* files already included */ JMP_BUF *bailout; int error_reporting;
int exit_status; HashTable *function_table; /* function symbol table */
HashTable *class_table; /* class table */
HashTable *zend_constants; /* constants table */ zval *vm_stack_top;
zval *vm_stack_end;
zend_vm_stack vm_stack; struct _zend_execute_data *current_execute_data;
zend_class_entry *fake_scope; /* used to avoid checks accessing properties */ zend_long precision; int ticks_count; HashTable *in_autoload;
zend_function *autoload_func;
zend_bool full_tables_cleanup; /* for extended information support */
zend_bool no_extensions; zend_bool vm_interrupt;
zend_bool timed_out;
zend_long hard_timeout; #ifdef ZEND_WIN32
OSVERSIONINFOEX windows_version_info;
#endif HashTable regular_list;
HashTable persistent_list; int user_error_handler_error_reporting;
zval user_error_handler;
zval user_exception_handler;
zend_stack user_error_handlers_error_reporting;
zend_stack user_error_handlers;
zend_stack user_exception_handlers; zend_error_handling_t error_handling;
zend_class_entry *exception_class; /* timeout support */
zend_long timeout_seconds; int lambda_count; HashTable *ini_directives;
HashTable *modified_ini_directives;
zend_ini_entry *error_reporting_ini_entry; zend_objects_store objects_store;
zend_object *exception, *prev_exception;
const zend_op *opline_before_exception;
zend_op exception_op[3]; struct _zend_module_entry *current_module; zend_bool active;
zend_bool valid_symbol_table; zend_long assertions; uint32_t ht_iterators_count; /* number of allocatd slots */
uint32_t ht_iterators_used; /* number of used slots */
HashTableIterator *ht_iterators;
HashTableIterator ht_iterators_slots[16]; void *saved_fpu_cw_ptr;
#if XPFPA_HAVE_CW
XPFPA_CW_DATATYPE saved_fpu_cw;
#endif zend_function trampoline;
zend_op call_trampoline_op; void *reserved[ZEND_MAX_RESERVED_RESOURCES];
};

php内核分析(三)-全局变量的更多相关文章

  1. Linux内核分析第三周学习总结:构造一个简单的Linux系统MenuOS

    韩玉琪 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 一.Linux内 ...

  2. “Linux内核分析”实验三报告

    构造一个简单的Linux系统 张文俊+原创作品转载请注明出处+<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-10000290 ...

  3. 《Linux内核分析》第三周学习小结 构造一个简单的Linux系统OS

    郝智宇 无转载 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 第三周 构造一个简单的Linux系统Me ...

  4. 【MOOC EXP】Linux内核分析实验三报告

     程涵  原创博客 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 [跟踪分析Linux内核的启动过程] ...

  5. 《Linux内核分析》课程第三周学习总结

    姓名:何伟钦 学号:20135223 ( *原创作品转载请注明出处*) ( 学习课程:<Linux内核分析>MOOC课程http://mooc.study.163.com/course/U ...

  6. 《Linux内核分析》第三周学习笔记

    <Linux内核分析>第三周学习笔记 构造一个简单的Linux系统MenuOS 郭垚 原创作品转载请注明出处 <Linux内核分析>MOOC课程http://mooc.stud ...

  7. Linux内核分析——第三周学习笔记

    20135313吴子怡.北京电子科技学院 chapter1 知识点梳理 一.Linux内核源代码简介 (视频中对目录下的文件进行了简介,记录如下) arch目录 占有相当庞大的空间 arch/x86目 ...

  8. linux内核分析 第三周 构造一个简单的Linux系统MenuOS

    一.计算机的三个法宝 存储程序计算机,函数调用堆栈,中断二.操作系统的两把剑:1.中断上下文的切换,保存现场和恢复现场2.进程上下文的切换. 三.linux内核源代码的分析: ·arch/目录保存支持 ...

  9. Linux内核分析第三周——构造一个简单的Linux系统MenuOS

    构造一个简单的Linux系统MenuOS 李雪琦 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/UST ...

  10. Linux内核分析第三周学习博客——跟踪分析Linux内核的启动过程

    Linux内核分析第三周学习博客--跟踪分析Linux内核的启动过程 实验过程截图: 过程分析: 在Linux内核的启动过程中,一共经历了start_kernel,rest_init,kernel_t ...

随机推荐

  1. spark处理大规模语料库统计词汇

    最近迷上了spark,写一个专门处理语料库生成词库的项目拿来练练手, github地址:https://github.com/LiuRoy/spark_splitter.代码实现参考wordmaker ...

  2. 获取微软原版“Windows 10 推送器(GWX)” 卸载工具

    背景: 随着Windows 10 免费更新的结束,针对之前提供推送通知的工具(以下简称GWX)来说使命已经结束,假设您还未将Windows 8.1 和Windows 7 更新到Windows 10 的 ...

  3. Velocity初探小结--velocity使用语法详解

    做java开发的朋友一般对JSP是比较熟悉的,大部分人第一次学习开发View层都是使用JSP来进行页面渲染的,我们都知道JSP是可以嵌入java代码的,在远古时代,java程序员甚至在一个jsp页面上 ...

  4. 如何优化coding

    如何优化coding 前言 最近一直在做修改bug工作,修改bug花费时间最多的不是如何解决问题而是怎样快速读懂代码.如果代码写的好的,不用debug就可以一眼看出来哪里出了问题.实际上,我都要deb ...

  5. Could not evaluate expression

    VS15 调试变量不能显示值,提示:Could not evaluate expression 解决办法: 选择"在调试时显示运行以单击编辑器中的按钮"重启VS即可. 可参考:Vi ...

  6. 用MongoDB分析合肥餐饮业

    看了<从数据角度解析福州美食>后难免心痒,动了要分析合肥餐饮业的念头,因此特地写了Node.js爬虫爬取了合肥的大众点评数据.分析数据库我并没有采用MySQL而是用的MongoDB,是因为 ...

  7. EF上下文对象线程内唯一性与优化

    在一次请求中,即一个线程内,若是用到EF数据上下文对象,就创建一个,这也加是很多人的代码中习惯在使用上下文对象时,习惯将对象建立在using中,也是为了尽早释放上下文对象, 但是如果有一个业务逻辑调用 ...

  8. JVM类加载

    JVM的类加载机制就是:JVM把描述类的class文件加载到内存,并对数据进行校验.转换解析和初始化,最终形成可以被JVM直接使用的Java类型 ClassLoader JVM中的ClassLoade ...

  9. springmvc SSM 多数据源 shiro redis 后台框架 整合

    A集成代码生成器 [正反双向(单表.主表.明细表.树形表,开发利器)+快速构建表单 下载地址    ; freemaker模版技术 ,0个代码不用写,生成完整的一个模块,带页面.建表sql脚本,处理类 ...

  10. CSS中强悍的相对单位之em(em-and-elastic-layouts)学习小记

    使用相对单位em注意点 1.浏览器默认字体是16px,即1em = 16px,根元素设置如下 html{ font-size: 100%; /* WinIE text resize correctio ...