Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Commits on Sep 21, 2012
  1. @edwinsmith @joelpob

    smart_malloc hphp/vector/zend_array

    edwinsmith authored joelpob committed
    New smart_malloc/free api for variable-size smart-allocation.  Memory
    allocated with smart_malloc can be freed with smart_free, but otherwise
    is swept at request-end.  Allocations underl0 1K are bump-allocated from
    slabs with an 8-byte header.  Over 1K are routed to malloc with a
    16-byte header (doubly-linked list).
    ZendArray, VectorArray, HphpArray refactored to use smart_malloc instead
    of a bunch of storage-segregated size classes.
  2. @joelpob

    Use libcurl 7.28.0's curl_multi_wait() or fallback when curl_multi_se…

    joelpob authored
    …lect not available
    Removes the need to patch libcurl and build a copy
    explicitly for HipHop.
    If libcurl >= 7.28.0 we get the new curl_multi_wait() function.
    If not, we either get the patched in curl_multi_select(), or a
    fallback which works for FDs < 1024, but fails (with an error
    message) for sites which use more concurrent FDs.
  3. @sgolemon
  4. @sgolemon
Commits on Sep 20, 2012
  1. @jdelong @sgolemon

    Fix bug in DebuggerClient's use of Sweepable Socket objects

    jdelong authored sgolemon committed
    DebuggerClient attempted to avoid problems with destructing
    Socket objects by calling incPersistent so they would not be swept.
    However, the semantics of incPersistent apparently require that the
    object only is persistent in some sort of thread-local cache (it is
    re-added to the sweepable list for the same thread immediately).  When
    we disconnect the debugger, the DebuggerClient is deleted and the
    socket object is also destructed---the Sweepable destructor tries to
    remove it from the current thread's list, so if this is a different
    thread, the next sweep loop on the original creating thread will make
    function calls on a deleted object.
  2. @edwinsmith @sgolemon

    Move the siPastEnd flag into a spare bit in m_strongIterators

    edwinsmith authored sgolemon committed
    Each subclass of ArrayData needs a flag to track whether there's
    a strong iterator past the end of the array; use a spare bit in
    m_strongIterators to store the flag, and consolidate more strong
    iterator code in class ArrayData.
    This will also aid in packing fields in subclasses.
  3. @edwinsmith @sgolemon

    Fix leak in safe_free()

    edwinsmith authored sgolemon committed
    safe_free() was so safe, it was a no-op.
  4. @sgolemon

    Initial IR work

    mpal authored sgolemon committed
    Initial merge of IR (Intermediate Representation) tree.
  5. @sgolemon

    Enable C++11

    sgolemon authored
    Moving forward, these compiler features will be required for
    IR and other features in the pipeline.  Compilers which do not
    support C++11 features will be incompatable.
Commits on Sep 19, 2012
  1. @jdelong @sgolemon

    Don't pass empty strings to PlainFile::writeImpl

    jdelong authored sgolemon committed
    This function asserts length is not zero, so I was hitting
    this in a debug www load.
  2. @edwinsmith @sgolemon

    Fix injected bug: check m_strongIterators on the copy

    edwinsmith authored sgolemon committed
    This was injected when I converted the strong iterator
    list to a linked list.  Only affects HphpArray when
    COW occurs on the array being mutated in a mutable foreach
    loop.  Starting a strong iteration causes a private copy
    to be made anyway, but the bug should be fixed either way.
  3. @jdelong @sgolemon

    Correct some use of smart allocated data in DebuggerClient

    jdelong authored sgolemon committed
    The DebuggerClient destructor could try to invoke ~Array
    after the smart allocator shut down from a static dtor.  In the case
    of the hphpd_get_client API, it also could try to assign null_array to
    an Array at sweep time---I think this could be wrong if these Array's
    have references to other Object's with custom sweeps.
  4. @sgolemon

    Fixed get_class_vars.

    psnell authored sgolemon committed
  5. @edwinsmith @sgolemon

    Initialize m_allocMode in VectorArray non-smart-copy constructor

    edwinsmith authored sgolemon committed
    Non-smart-allocated VectorArray wasn't initializing this field,
    which surely can't be good.  This would most likely impact HPHPC
    but only when creating static arrays; and its not clear when/if
    we create static VectorArrays.  But it's still a bug.
Commits on Sep 18, 2012
  1. @markw65 @sgolemon

    Remove incorrect assertion

    markw65 authored sgolemon committed
    The assertion assumes we're dealing with a
    utf8_string - in which case it will have been
    checked for correctness. But preg also works with
    non-utf8 strings.
  2. @jasone @sgolemon

    Remove legacy UnsetM translation code.

    jasone authored sgolemon committed
    Remove legacy UnsetM translation code; generic *M translation obsoletes it.
  3. @alikhtarov @sgolemon

    fb_compact_serialize: add a VECTOR code

    alikhtarov authored sgolemon committed
    We need a concept of Vector since it will be supported in PHP in the future and C++ code should have a way to represent vectors.
  4. @jdelong @sgolemon

    Strengthen is_refcount_realistic assertions

    jdelong authored sgolemon committed
    All valid refcounts should be less than or equal to the
    static value.
  5. @jdelong @sgolemon

    In finish_thread_locals, use isNull instead of getNoCheck

    jdelong authored sgolemon committed
    The getNoCheck function will assert that it's not null, which
    this code is apparently trying to check.  (Somehow hit this loading a
    sandbox page, but not sure how to repro.)
  6. @swtaarrs @sgolemon

    Fix file_put_contents to work with php://{stdout,stderr}

    swtaarrs authored sgolemon committed
    file_put_contents' implementation was manually opening the
    passed in filename. If we use our File class instead, the magic php://
    paths just work.
  7. @markw65 @sgolemon

    Fix an issue with over-agressive type annotations

    markw65 authored sgolemon committed
    This could cause a local with a type assertion to be
    inferred non-null at places where thats not the case.
    In the new test, the $a in "return $a" was inferred to
    to be an object, resulting in a crash when $a was
    pushed onto the stack, and its refcount incremented.
  8. @markw65 @sgolemon

    Allow select threads to bypass the usual thread initialization

    markw65 authored sgolemon committed
    Parallel query jobs dont need to do any of the normal thread
    initialization, so skip it.
Commits on Sep 15, 2012
  1. @paroski @sgolemon

    Parser bug fixes and clean up

    paroski authored sgolemon committed
    I combed through HipHop's grammar and noticed a few bugs. HipHop's grammar
    does not allow for traits to be declared anywhere except toplevel scope
    (whereas Zend allows for this), and the grammar allows for bogus singleton
    XHP tags such as '<foo a="1" /foo>' (which are not allowed by the original
    XHP grammar given by xhpast).
    This diff fixes these bugs, and it also removes some superfluous rules,
    duplicated rules, and dead rules from the grammar.
    I also took a look at 14 shift/reduce conflicts in the grammar to see if I
    could eliminate most of them. 4 of the 14 conflicts went away when I fixed
    the issue with the xhp_tag_body rules and when I removed the dead type_decl
    rules. Of the 10 remaining conflicts, 2 were due to the if/else rules and
    the other 8 were due to the "expr -> expr [ dim_offset ]" rule. Conflicts
    due to "if/else" are well understood and conventional wisdom says we're
    better off just accepting these conflicts instead of contorting the grammar
    to try to get rid of them. Conflicts due to "expr -> expr [ dim_offset ]",
    however, are not really well understood and there are a lot of them, so it
    seemed worth fixing.
    "expr -> expr [ dim_offset ]" was originally added to the grammar to
    support using function calls as the base for array element expressions
    (ex. "$x = f()[0]"). The rules for variable, calls, array elements, and
    object properties were written in a very weird way that made them hard to
    update, so I took the opportunity to rewrite these rules in a more natural
    form and I updated the rules to support using function calls as the base
    for array element expressions. Finally, I ran into cases where developers
    were using array literals, class constants, and parenthesized expressions
    as the base of array element expressions, so I introduced 'dim_expr' rules
    so that HipHop's grammar will continue to support these cases.
Commits on Sep 14, 2012
  1. @swtaarrs @sgolemon

    Only validate that the subject of preg_split is valid utf8 once per call

    swtaarrs authored sgolemon committed
    pcre_exec checks that its subject is valid utf8 every time
    it's called (unless told not to). Our preg_split implementation can
    end up calling pcre_exec once for every character in the subject for
    certain inputs, so rechecking the utf8 validity of the subject is a
    waste of cycles.
  2. @paroski @sgolemon

    Add serialization support for collections

    paroski authored sgolemon committed
    This diff implements support for collections with serialize, unserialize,
    var_dump, print_r, json_encode, var_export, and debugger serialization
  3. @sgolemon

    Adding finally support to hphp (hphpc only for now)

    nikoloz authored sgolemon committed
    try/catch()/finally and try/finally constuctions added to hphp. Code is translated into C++.
    There still a lot to do:
    1. Throw an exception when there's an unhandled exception in finally scope;
    2. Write test units;
    3. Support finally in virtual machine;
    4. Return an error if there's a yield statement into try/finally scope.
  4. @markw65 @sgolemon

    Generate INTERCEPT_INJECTION_ALWAYS for dynamicInvoke functions

    markw65 authored sgolemon committed
    This means we can avoid compiling with ENABLE_INTERCEPTS, which
    significantly reduces the size of the binary.
Commits on Sep 13, 2012
  1. @edwinsmith @sgolemon

    Convert MemoryManager to ThreadLocalSingleton

    edwinsmith authored sgolemon committed
    Converting to ThreadLocalSingleton means each MemoryManager instance is
    stored directly in __thread memory instead of malloc, and allows clients
    to directly access it via the x64 FS register.  This avoids needing
    SmartAllocatorImpl::m_stats to update stats.
    Moved The GarbageList static_assert to memory_manager.cpp.
  2. @jdelong @sgolemon

    Make DummySandbox shutdown always call execute_command_line_end

    jdelong authored sgolemon committed
    Failing to call this when there are live RequestLocal objects
    will can cause them to access deleted objects during pthread's
    shutdown (calling OnThreadExit).  This fixes and adds assertions about
    ref counts that makes this easier to hit this in a debug build.
  3. @jdelong @sgolemon

    Make the translated SetOpM and IncDecM warnings match interp

    jdelong authored sgolemon committed
    Some flib tests were failing, and the lines I looked at were
    for SetOpM.  The bytecode.cpp version of these two uses MoreWarnings
    to decide whether warn is true for setHelper, so do something similar
    for the translator.
  4. @swtaarrs @sgolemon

    Add HPHP::safe_cast and use it in the assembler

    swtaarrs authored sgolemon committed
    This is a wrapper around boost::numeric_cast, to give a
    helpful error message if we attempt to use an out of range immediate
    or jump in the assembler. I'm sure there are other places in the
    codebase it can be useful but this was the first that came to mind. In
    RELEASE=1 builds it's just a static_cast so there should be no runtime
Commits on Sep 12, 2012
  1. @markw65 @sgolemon

    Dont call getMInstrCtx unless necessary

    markw65 authored sgolemon committed
    The translations for the M* instructions call getMInstrCtx to
    set MInstrState::ctx if the context is not fixed, or if there
    are property accesses in the vector. But MInstrState::ctx is
    only read when the context is not fixed AND there are property
    accesses in the vector.
    Also found an issue where the BaseN* helpers would access
    the current frame without a VMRegAnchor. Fixed by passing in
    the correct fp as a parameter.
  2. @bmaurer @sgolemon

    Free memory for preg and memcache

    bmaurer authored sgolemon committed
    This introduces a more expensive, second phase of clearing thread caches.
    should help reduce long term memory usage
  3. @paroski @sgolemon

    Disallow dynamic properties for collections

    paroski authored sgolemon committed
    Allowing for dynamic properties on collections is kind of silly, and it
    would complicate adding var_dump and serialization support for collections.
    This diff disallows property access for collections.
  4. @markw65 @sgolemon

    Implement fb_could_include

    markw65 authored sgolemon committed
    This checks to see whether a file could be included.
      For hhvm in sandbox mode, this just checks the existence
      of the file.
      For hhvm in RepoAuthoritative mode, it ignores the filesystem,
      and looks to see whether the file is in the repo.
      For hphpc it checks to see if the file was compiled into the
Something went wrong with that request. Please try again.