How facebook/hhvm works
HHVM executes Hack programs in a JIT-enabled virtual machine and can also serve web requests through built-in Proxygen or a FastCGI-based webserver. The principal workflow is invoking HHVM, initializing its process, and executing a program; separate compiler and whole-program optimizer modes support repository compilation. The graph includes runtime memory, systemlib, server, and JIT-profile responsibilities. Some core paths come from the SOURCE INDEX rather than the displayed tree; unsampled internals and runtime wiring are not inferred.
Main entry points: hhvm/main.cpp HHVM entry · hhbbc/main.cpp HHBBC optimizer · process-init.h Process initialization · hhbbc.h Optimizer API
Components 17
Entry and setup
- HHVM entry
hphp/hhvm/main.cpp - Process initialization
hphp/hhvm/process-init.h
Execution runtime
- HHVM runtime
hphp/runtime/vm - Memory manager
hphp/runtime/base/memory-manager.cpp - Array values
hphp/runtime/base/array-init.h - Value serialization
hphp/runtime/base/variable-serializer.h - System library
hphp/system/systemlib.cpp - JIT profiling
hphp/runtime/vm/jit/cprof-controller.cpp
Compilation tools
- HHVM compiler
hphp/compiler/compiler.cpp - HHBBC optimizer
hphp/hhbbc/main.cpp - Optimizer API
hphp/hhbbc/hhbbc.h - Program indexing
hphp/hhbbc/index.h - Optimizer options
hphp/hhbbc/options.h
Web serving
- Web server
- HHVM server
hphp/runtime/server/server.cpp - FastCGI worker
hphp/runtime/server/fastcgi/fastcgi-worker.h
Other components
- Program operator
Connections 10
- Program operator → HHVM entry: runs program
- HHVM entry → Process initialization: registers init
hphp/hhvm/main.cpp - Process initialization → HHVM runtime: initializes runtime
hphp/hhvm/process-init.h - HHVM entry → HHVM compiler: dispatches compile
hphp/hhvm/main.cpp - HHVM entry → HHBBC optimizer: dispatches optimize
hphp/hhvm/main.cpp - HHBBC optimizer → Optimizer API: uses optimizer API
hphp/hhbbc/main.cpp - Optimizer API → Optimizer options: holds options
hphp/hhbbc/hhbbc.h - HHBBC optimizer → Program indexing: uses index
hphp/hhbbc/index.h - Web server → HHVM server: serves requests
- Web server → FastCGI worker: uses FastCGI