Incref-Decref pairs whose incref'ed SSATmp is not used by any
other instruction other than the decref can be eliminated when the
type of the refcounted value has no destructor (i.e., strings and
boxed strings). This commonly occurs for stores to memory (e.g., SetS,
SetG, and SetM) followed by PopC.
For example:
47: SetS
(32) t16:PtrToGen = LdClsPropAddrCached t9:Cls, "s1", "c", Cls(0)
(33) t17:PtrToCell = UnboxPtr t16:PtrToGen
(34) t18:Cell = LdMem<Cell> t17:PtrToCell, 0
(35) t19:Str = IncRef t15:Str
(36) StMem [t17:PtrToCell]:Str, t15:Str
(37) DecRef t18:Cell
48: PopC
(39) DecRef t19:Str
In this example, eliminating the DecRef instruction (39) along with
its IncRef (35) may cause the string referenced by t19 to be destroyed
earlier in the DecRef instruction (37), but this is safe because
destroying strings has no visible side effects.
This diff eliminates these pairs.
Note that its not safe to do this for types that have destructors with
side effects. Applying this optimization to decref'ed types that have
destructors could change the order of those side effects with respect
to the side effects in instruction (37). A follow-on diff will change
the DecRef (37) to bail the trace when it has to run a destructor to
enable this for the general case.
HipHop for PHP
HipHop is a high performance PHP toolchain. Currently supported platforms are Linux and FreeBSD. There is no OS X support.
Required Packages
The latest information is available on the wiki
- cmake 2.6 is the minimum version
- g++/gcc 4.3 is the minimum version
- Boost 1.37 is the minimum version
- flex
- bison
- re2c
- libmysql
- libxml2
- libmcrypt
- libicu 4.2 is the minimum version
- openssl
- binutils
- libcap
- gd
- zlib
- tbb Intel's Thread Building Blocks
- Oniguruma
- libpcre
- libexpat
- libmemcached
- google-glog (http://code.google.com/p/google-glog/)
- libc-client2007
- libdwarf
- libelf
- libunwind
The following packages have had slight modifications added to them. Patches are provided and should be made against the current source copies.
- libcurl
- hphp/third_party/libcurl.fb-changes.diff
- libevent 1.4
- hphp/third_party/libevent-1.4.14.fb-changes.diff
Installation
You may need to point CMake to the location of your custom libcurl and libevent, or to any other libraries which needed to be installed. The CMAKE_PREFIX_PATH variable is used to hint to the location.
export CMAKE_PREFIX_PATH=/home/user
To build HipHop, use the following:
Linux:
cd /home/user/dev
git clone git://github.com/facebook/hiphop-php.git
cd hiphop-php
git submodule init
git submodule update
export HPHP_HOME=`pwd`
export HPHP_LIB=`pwd`/bin
cmake .
If you are using FreeBSD instead use export - setenv
Once this is done you can generate the build file. This will return you to the shell. Finally, to build, run make. If any errors occur, it may be required to remove the CMakeCache.txt directory in the checkout.
make
Contributing to HipHop
HipHop is licensed under the PHP and Zend licenses except as otherwise noted.
Before changes can be accepted a Contributors Licensing Agreement must be signed and returned.
Running HipHop
Please see the wiki page