Facebook hiphop PHP VM cashing overview

Source: Internet
Author: User
Facebook Hiphop php VM Implementation overview
Facebook Hiphop php VM Implementation overview
First, the SRC directory Overview:
Compiler: Compiler
The data structure used by the AST node of the expression:php expression
Statement: PHP-compatible statements
Parser: Generate out AST
Analysis: Static semantic parsing (variable type, scope, Chang, variable table, function table ...) )
FFI: Multi-lingual interaction layer (presumably an interface for glue)
hphp: Entrance
IDL: Interface Definition
system:php this layer of system environment
Third_party: Borrowed third-party packages
Util: Tool class
Runtime: The entire converter run-time system
TMP: Generated file
Ext: The external function that is wrapped to PHP, that is, some basic functions used in PHP need to have a corresponding C + + implementation (because this runtime is implemented in C + +, so these functions can only be written in C + +), of course, when implemented can use a third-party package
Base: The underlying data structures and functions to be used in the runtime (functions of external functions in ext need support here)
Eval: The core runtime environment

It can be seen that the compiler and runtime modules are the most concerned in this code.
Second, the entrance
Hphp/main.cpp
Iii. Overview of Compiler
1, the analysis of the hierarchical relationship from large to small is the package----class---funtion---variable---constant.
2, scanner and parser implementation and the General compiler implementation is the same, scanner export int getnexttoken (Scannertoken &t, location &l); Parser's exit parser::P arsestring ()
3. Static analysis; Using the ergodic pattern, the analysis results are encapsulated in the data structure of Analusis_result, that is, the data structure stores the results of this phase. The specific code mainly analyzes the function in the class, the expression in the function, the control flow graph (controlflowgraph), the expression dictionary, the data flow (such as checking the value of the assignment statement is legal), the symbol table, etc.
Iv. Overview of Runtime
1. Entrance Eval.cpp
2, requestevalstate management symbol table information

Write this today, if anyone is interested, I will write it in fine!

1/F lj3362569 2011-12-19

Can you tell me more details? And what features are not supported by the existing hiphop?

2/F Eric_weitm 2011-12-21

lj3362569 wrote

Can you tell me more details? And what features are not supported by the existing hiphop?


Blogging is only a hobby, because time is limited, I try to use the fewest words to express the most information. I don't know if anyone is interested in the implementation of a virtual machine, and I will continue to write it if someone sees it. Hiphop still do not support what I do not know, it is recommended that you go to their official website to see, should have introduced it!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.