Switch branches/tags
Commits on May 8, 2015
  1. Remove Server.WarmupDocument option

    oyamauchi authored and hhvm-bot committed May 8, 2015
    Summary: It's not used.
    Reviewed By: @JoelMarcey
    Differential Revision: D2057648
Commits on May 5, 2015
  1. Fix the hphpd "run" command with arguments

    oyamauchi authored and hhvm-bot committed May 5, 2015
    Summary: The `run` command is supposed to accept arguments to switch to running a
    different file (when not connected to a machine). It wasn't actually switching
    to the new file, so fix it.
    Reviewed By: @alexmalyshev
    Differential Revision: D2044175
Commits on Apr 30, 2015
  1. Remove the 'zend' command from hphpd

    oyamauchi authored and hhvm-bot committed Apr 30, 2015
    Summary: I think this is kinda silly. It's a holdover from the very early days when
    people were still finding behavior differences between hphp and php in the core
    language. Nobody is using it internally. Let's get rid of it.
    Reviewed By: @JoelMarcey
    Differential Revision: D2035653
Commits on Apr 15, 2015
  1. Fix bug with closures in static methods

    oyamauchi authored and hhvm-bot committed Apr 15, 2015
    Summary: This is a longstanding bug where a closure inside a static method gets treated
    as static itself. It gets exposed when the closure is called through
    I'm not happy about all these weird brittle dependencies in communicating
    closure contexts, but it would take some time to unravel.
    Reported externally; the new test comes from that report.
    Closes #5158
    Reviewed By: @markw65
    Differential Revision: D1991655
Commits on Mar 5, 2015
  1. Fix remove_soft_types for return types

    oyamauchi authored and hhvm-bot committed Mar 5, 2015
    Summary: The regex we were using for parsing return type failures out of error logs was
    wrong. It wasn't filtering out the word "function" or "method", or the word
    "async", so it would end up looking for a function named "function f" instead
    of just "f".
    Reviewed By: @jwatzman
    Differential Revision: D1885574
Commits on Dec 22, 2014
  1. Fix the hard-return-type-enforcement crash

    oyamauchi authored and hhvm-bot committed Dec 22, 2014
    Summary: The root cause was a double IterFree. When emitting bytecode for return
    statements, we did an IterFree followed by VerifyRetType and Ret.
    Trouble is, if the VerifyRetType throws (the usual catchable fatal
    doesn't count; you have to throw from the user error handler), we go to
    a fault funclet where we do the IterFree again.
    The potential for this bug has existed for a long time, I think, but
    there's no way it would have bitten us until we turned on hard return
    types because there's no other way to throw through this narrow window
    where it's incorrect.
    Reviewed By: @markw65, @jdelong
    Differential Revision: D1752318
Commits on Dec 19, 2014
  1. Fix header injection

    oyamauchi authored and hhvm-bot committed Dec 10, 2014
    Summary: This is a minimal fix (suitable for hotfixing) for
    the attached task.
    Reviewed By: @jasone
    Differential Revision: D1730314
  2. Fix the build flag gating for crc32 hashing

    oyamauchi authored and JoelMarcey committed Dec 18, 2014
    Summary: There was no way to actually turn it off.
    Reviewed By: @markw65
    Differential Revision: D1748799
Commits on Dec 12, 2014
  1. Revert "Fix #4380, making get code and get message final"

    oyamauchi authored and hhvm-bot committed Dec 12, 2014
    Reviewed By: @paroski, @JoelMarcey
    Differential Revision: D1736352
    Signature: t1:1736352:1418398167:2b6d408c99a41f5224331b0837b4fb50cb283b5a
Commits on Nov 6, 2014
  1. Convert GuardLoc and friends to DELEGATE, add ARM lowering pass

    oyamauchi authored and hhvm-bot committed Nov 6, 2014
    Summary: This is the first time we need a lowering pass for ARM, as we start generating
    cmp{b,l}im vasm opcodes. The implementation is very simple. vasm is super well
    Here's a possible issue. I tried converting DbgAssertRefCount, but I found it
    generates suboptimal code when run through the x64 backend + the lowering pass.
    It does two cmplim's, so it loads the refcount, does the -127 comparison, and
    then loads the refcount again to do the other check. The native ARM
    implementation does the smart thing and only loads the refcount once. I worry
    this kind of suboptimality is going to appear in a lot of places as we continue
    doing this conversion. It may not end up being a real problem but I'll keep an
    eye out for it.
    Reviewed By: @edwinsmith
    Differential Revision: D1662260
Commits on Nov 5, 2014
  1. Convert easy arithmetic ops to DELEGATE

    oyamauchi authored and hhvm-bot committed Nov 5, 2014
    Summary: My plan for now is to convert everything I can that's explicitly
    implemented in code-gen-arm.cpp before tackling the long list of punting
    Another few issues here, most notably `imul`. I think emitting `imul` as
    `Mul` on ARM is wrong, because I realized we're actually counting on it
    to set condition flags, and there's no multiply instruction on ARM that
    will do that. I split it into another vasm opcode to make this clear.
    It'd be nice to use non-flags-setting ARM opcodes when they're not
    needed; I guess this can be done in a later pass (after DCE determines
    that the flags aren't used).
    Reviewed By: @edwinsmith
    Differential Revision: D1658861
Commits on Nov 4, 2014
  1. Convert a few ARM opcodes to DELEGATE

    oyamauchi authored and hhvm-bot committed Nov 4, 2014
    Summary: This is just a few of the easiest ones, to get started with. It helped
    to flush out a few issues:
    - x64's implementation of DefSP was referring to rbp explicitly, instead
      of the tmp representing the frame pointer.
    - ARM was defining a status flag register twice; this looks like a rough
      edge of the conversion to explicit status flags.
    Reviewed By: @edwinsmith
    Differential Revision: D1658070
Commits on Oct 25, 2014
  1. Add remaining CALL_OPCODEs for ARM

    oyamauchi authored and hhvm-bot committed Oct 25, 2014
    Summary: In theory, anything that's a CALL_OPCODE on x64 should be the same on
    ARM and it should work without problems. I just copied the whole
    CALL_OPCODE section from code-gen-x64.cpp and it seems to have worked.
    (That resulted in a lot of reordering, so the best way to see what's
    changed is to concentrate on the removed PUNT_OPCODEs.)
    Reviewed By: @edwinsmith
    Differential Revision: D1637822
Commits on Oct 24, 2014
  1. Initial foundation for merging CodeGenerator classes

    oyamauchi authored and hhvm-bot committed Oct 23, 2014
    Summary: This is a real idea, but if people hate it I can pursue something else.
    The plan is to gradually convert as many opcodes as possible in the ARM
    class to DELEGATE_OPCODE first, before eventually merging the classes.
    This will make the eventual merge go as smoothly as possible. Here's how
    I envision it:
    - Turn as many opcodes as possible into DELEGATE_OPCODE on the ARM side,
      both ones that are currently punting and ones that have real
      implementations. This will probably entail adding an x64->arm lowering
      pass to allow to use more of the x64 implementations unmodified.
    - When that's done, merge the classes. Everything will go through
      x64::CodeGenerator. For the opcodes that still have divergent ARM
      implementations, we'll create things like cgBlahX64 and cgBlahARM,
    - For those divergent opcodes, we can gradually replace them with mostly
      merged versions, with a little bit of branching in the middle.
    Reviewed By: @edwinsmith, @swtaarrs
    Differential Revision: D1635576
Commits on Oct 22, 2014
  1. Emit uses of ZR intelligently on ARM

    oyamauchi authored and hhvm-bot committed Oct 22, 2014
    Summary: I added this to the immediate-folding pass. It seemed like most of the
    unfortunate zero constants came from stores (e.g. in SpillFrame) so I've
    added those for now.
    In the process of doing this, I found a couple places where we were
    emitting "add x0, x0, #0x0" which is totally useless, so I eliminated
    I eliminated all mention of zr from code-gen-arm.cpp, since we should
    just make this pass handle all of it.
    Reviewed By: @edwinsmith
    Differential Revision: D1629590
  2. Get tests passing with Simplifier turned off

    oyamauchi authored and hhvm-bot committed Oct 21, 2014
    Summary: Since we've lately discovered that Simplifier has some pretty
    significant unsoundness, we wanted to see how much it costs us to turn
    it off. First step is to pass tests with it turned off.
    - The change to make bool-casting an array be accurate for
      NameValueTableWrapper wasn't applied to one callsite, which gets
      called by the translation of ConvCellToBool, which appears much more
      commonly when simplifier is off.
    - The spec's description of CheckNullptr was wrong. This sent me on a
      wild goose chase for a bit.
    - `AssertNonNull(nullptr)` appears in the IR with simplification off.
      This is OK because it's unreachable, but we need to give it a type
      that isn't Bottom and corresponds to a DataType, to avoid upsetting
      machinery downstream. (This definitely feels silly, but I tried a
      variety of other solutions and this is the simplest I found.)
    - We start seeing `IsType<InitCell>`, which requires two comparisons to
      check. Just punt on it.
    Reviewed By: @jdelong
    Differential Revision: D1628088
Commits on Oct 17, 2014
  1. Revert "Unroll AKExists into a series of comparisons on small static …

    oyamauchi authored and hhvm-bot committed Oct 17, 2014
    Summary: This reverts commit a8d16eb4b23374b10a8921e4b50312923c9bd450. It exposes
    a serious bug in simplifier which we need more time to fix. It was
    Reviewed By: @edwinsmith
    Differential Revision: D1623014
  2. Add debugtrap opcode to vasm

    oyamauchi authored and hhvm-bot committed Oct 17, 2014
    Summary: This is useful for debugging. It's int3 on x64 and brk(0) on ARM.
    Reviewed By: @edwinsmith
    Differential Revision: D1621091
Commits on Oct 16, 2014
  1. ARM immediate-folding

    oyamauchi authored and hhvm-bot committed Oct 16, 2014
    Summary: Templatize the original foldImms and provide an alternate implementation
    of Folder. Add support for a few more immediate-form instructions to
    Reviewed By: @swtaarrs
    Differential Revision: D1618762
Commits on Oct 14, 2014
  1. De-hhvmify hhmeasure

    oyamauchi authored and hhvm-bot committed Oct 14, 2014
    Summary: It'd be nice to be able to use hhmeasure as a tool to comparatively
    microbenchmark hhvm and other php implementations, so let's get rid of
    the hhvm-specific language extensions.
    I considered inlining the implementation of idx() at the callsites,
    instead of defining my own. I went with this because I have a hunch that
    a lot of real codebases probably define their own idx-like thing, so
    this is somewhat realistic. Any thoughts?
    Reviewed By: @edwinsmith
    Differential Revision: D1614251
Commits on Oct 13, 2014
  1. Unroll AKExists into a series of comparisons on small static arrays

    oyamauchi authored and hhvm-bot committed Oct 13, 2014
    Summary: This is meant to go hand-in-hand with my other change to transform calls
    to `in_array` into AKExists, though of course this will benefit organic
    uses of AKExists too.
    The CFG this generates is suboptimal. It generates a series of diamonds
    (one per element of the haystack array) whereas it would ideally result
    in something like this:
    B1 --F--> B2 --F--> B3 --F--+
    |         |         |       |
    T         T         T       |
    |         |         |       |
    v         v         v       v
    I'd have to expose additional API in IRBuilder to do this (since the
    HhbcTranslator code would have to create and append its own Blocks) and
    I wasn't sure it would be worthwhile. The worst that will happen is a
    few redundant unconditional jumps, which we should actually be able to
    optimize away downstream.
    Reviewed By: @edwinsmith
    Differential Revision: D1599893
Commits on Oct 9, 2014
  1. Stop punting on '' === $s

    oyamauchi authored and hhvm-bot committed Oct 9, 2014
    Summary: Codegen was expecting simplifier to have canonicalized constants to the
    right, but simplifier didn't do so in the specific case of Same on
    strings. Thanks to vasm, it makes no difference to codegen whether
    constants are canonicalized right, so just remove the check from
    Found this by looking for InterpOne while running Wordpress. This takes
    it from 0.3-0.5% of bytecodes interp-oned on most endpoints down to a
    consistent 0.1%.
    Reviewed By: @ottoni
    Differential Revision: D1603546
Commits on Oct 7, 2014
  1. Optimize in_array at IR gen time

    oyamauchi authored and hhvm-bot committed Oct 6, 2014
    Summary: Wordpress often uses in_array in this pattern:
      if (in_array($field, array('ID', 'post_parent'))) {
    Transform this into:
      if (array_key_exists($field, array('ID' => null, 'post_parent' => null))) {
    I'm restricting this to haystack arrays with only non-numeric string
    keys. Allowing numeric keys gets complicated because the semantics of
    array-indexing key comparisons are different from those of in_array's
    Reviewed By: @markw65
    Differential Revision: D1597251
Commits on Oct 3, 2014
  1. Restore Instr_TC stat counter

    oyamauchi authored and hhvm-bot committed Oct 3, 2014
    Summary: I'm a little concerned that this is going to result in a bunch of extra
    work for the sake of accuracy. The old counter (plus an alternate
    implementation that I tried) would overcount in the presence of side
    exits, because it incremented the counter in bulk at the beginning of
    each block. I guess this is OK though since it's only going to result in
    extra code if stats are enabled.
    Reviewed By: @swtaarrs
    Differential Revision: D1594333
Commits on Sep 22, 2014
  1. Replace calls to is_a with instanceof at IR gen time

    oyamauchi authored and hhvm-bot committed Sep 22, 2014
    Summary: These are equivalent in behavior; the PHP docs for is_a actually say you
    should use instanceof instead.
    Reviewed By: @edwinsmith
    Differential Revision: D1556806
Commits on Sep 18, 2014
  1. Fix potential security leak in HashContext

    oyamauchi authored and hhvm-bot committed Sep 3, 2014
    Summary: CVE-2014-6229
    This is not a NUL-terminated string, it's a fixed-size block of data.
    The risks were key truncation (if there happens to be a NUL byte in the
    key) or over-reading (which would be information leakage).
    Reviewed By: @ptarjan
    Differential Revision: D1533546
Commits on Sep 17, 2014
  1. Add surprise checks to range()

    oyamauchi authored and hhvm-bot committed Sep 16, 2014
    Summary: range() can be made to allocate an unbounded amount of memory in a C++
    loop, so we need surprise checks. Do it every 1000 steps (no scientific
    justification for this number). The `unsigned char` overload of
    ArrayUtil::Range doesn't need this because it can result in an array of
    at most 256 elements.
    Reviewed By: @edwinsmith
    Differential Revision: D1552594
  2. Fix emitter crash from a goto inside a try-finally

    oyamauchi authored and hhvm-bot committed Sep 16, 2014
    Summary: If there was a goto inside the try block of a try-finally, with no other
    region (such as a loop) around it, the emitter would crash. We didn't
    need to check for m_parent's goto labels, because the loop header
    already starts the search at the current region's parent.
    Note that this still behaves incorrectly for a goto out of two nested
    try-finally regions, e.g.:
    try {
      try {
        goto bluh;
      } finally {
        // one
    } finally {
      // two
    In this case, `one` will get executed and then jump straight to `bluh`.
    None of our active test cases test this yet (some of the zend/bad ones
    do, though). I think this may require a deeper fix.
    Reviewed By: @jdelong
    Differential Revision: D1555786
Commits on Sep 13, 2014
  1. Get rid of -Wno-uninitialized

    oyamauchi authored and hhvm-bot committed Sep 10, 2014
    Summary: This is a pretty useful warning. Turn it back on and fix the fallout.
    It's amazingly limited damage, considering what usually happens when
    warnings aren't turned on.
    Reviewed By: @markw65
    Differential Revision: D1547861
Commits on Sep 11, 2014
  1. Get hhvm compiling with clang-3.5

    oyamauchi authored and sgolemon committed Sep 9, 2014
    Summary: This really wasn't that bad. A few mistaken uses of abs(), a few
    functions unused except in debug mode, and some apparently-redundant
    bool conversions.
    Reviewed By: @meyering
    Differential Revision: D1546566
Commits on Sep 4, 2014
  1. Fix read of uninitialized stack in AGetL interp

    oyamauchi authored and hhvm-bot committed Sep 4, 2014
    Summary: If an interpreted AGetL ended up fataling or otherwise encountering an
    exception, it would read an uninitialized stack slot during unwinding.
    Make sure it's initialized to uninit-null instead. This will never be
    seen by user code; either it will be overwritten by the right classref
    or we'll unwind past it.
    Reviewed By: @jdelong
    Differential Revision: D1536360
  2. Remove m_extra from SimpleFunctionCall

    oyamauchi authored and hhvm-bot committed Sep 4, 2014
    Summary: Honestly, I have no idea what this is doing, but the assert is firing
    and@markw65 said it's OK to remove, so here we are.
    Reviewed By: @jdelong
    Differential Revision: D1536384
Commits on Sep 2, 2014
  1. CMake: use bundled PCRE if system PCRE doesn't jit

    oyamauchi authored and hhvm-bot committed Sep 2, 2014
    Summary: PCRE comes with its own CMakeLists.txt, fortunately, so all we have to
    do is run it.
    Caution: I have very little idea what I'm doing when it comes to CMake
    -- there's a lot of hidden magic going on -- but I think this is some
    approximation of correct.
    Reviewed By: @ptarjan
    Differential Revision: D1523103
Commits on Aug 25, 2014
  1. Delete unused stat counters

    oyamauchi authored and hhvm-bot committed Aug 25, 2014
    Summary: All of these are unused. I suspect some of them were originally meant to
    count something that we still care about (e.g. tracelet guard
    executions?) but the callsites have bitrotted away.
    I think we'll need automated testing if we care about a particular stat
    enough to keep it. I'd like to check this diff in as-is, but it's also
    partially a forcing function to get people to reinstate stat counters
    that they actually care about.
    Reviewed By: @edwinsmith
    Differential Revision: D1515024
Commits on Aug 22, 2014

    oyamauchi authored and hhvm-bot committed Aug 20, 2014
    Summary: We were totally ignoring this flag. Add the right checks for it.
    I also realized that with EnableRenameFunction off, builtins will never
    be profiled because we call builtins via FCallBuiltin, which doesn't do
    surprise checks. I documented this behavior in
    Reviewed By: @ptarjan
    Differential Revision: D1509142