Permalink
Switch branches/tags
Nothing to show
Commits on Sep 21, 2012
  1. smart_malloc hphp/vector/zend_array

    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.
    edwinsmith committed with joelpob Sep 12, 2012
  2. Use libcurl 7.28.0's curl_multi_wait() or fallback when curl_multi_se…

    …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.
    joelpob committed Sep 21, 2012
Commits on Sep 20, 2012
  1. Fix bug in DebuggerClient's use of Sweepable Socket objects

    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.
    jdelong committed with sgolemon Sep 18, 2012
  2. Move the siPastEnd flag into a spare bit in m_strongIterators

    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.
    edwinsmith committed with sgolemon Sep 19, 2012
  3. Fix leak in safe_free()

    safe_free() was so safe, it was a no-op.
    edwinsmith committed with sgolemon Sep 20, 2012
  4. Initial IR work

    Initial merge of IR (Intermediate Representation) tree.
    mpal committed with sgolemon Sep 19, 2012
  5. Enable C++11

    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.
    sgolemon committed Sep 20, 2012
Commits on Sep 19, 2012
  1. Don't pass empty strings to PlainFile::writeImpl

    This function asserts length is not zero, so I was hitting
    this in a debug www load.
    jdelong committed with sgolemon Sep 19, 2012
  2. Fix injected bug: check m_strongIterators on the copy

    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.
    edwinsmith committed with sgolemon Sep 19, 2012
  3. Correct some use of smart allocated data in DebuggerClient

    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.
    jdelong committed with sgolemon Sep 12, 2012
  4. Fixed get_class_vars.

    psnell committed with sgolemon Sep 17, 2012
  5. Initialize m_allocMode in VectorArray non-smart-copy constructor

    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.
    edwinsmith committed with sgolemon Sep 18, 2012
Commits on Sep 18, 2012
  1. Remove incorrect assertion

    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.
    markw65 committed with sgolemon Sep 17, 2012
  2. Remove legacy UnsetM translation code.

    Remove legacy UnsetM translation code; generic *M translation obsoletes it.
    jasone committed with sgolemon Sep 14, 2012
  3. fb_compact_serialize: add a VECTOR code

    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.
    alikhtarov committed with sgolemon Sep 14, 2012
  4. Strengthen is_refcount_realistic assertions

    All valid refcounts should be less than or equal to the
    static value.
    jdelong committed with sgolemon Sep 17, 2012
  5. In finish_thread_locals, use isNull instead of getNoCheck

    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.)
    jdelong committed with sgolemon Sep 17, 2012
  6. Fix file_put_contents to work with php://{stdout,stderr}

    file_put_contents' implementation was manually opening the
    passed in filename. If we use our File class instead, the magic php://
    paths just work.
    swtaarrs committed with sgolemon Sep 13, 2012
  7. Fix an issue with over-agressive type annotations

    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.
    markw65 committed with sgolemon Sep 14, 2012
  8. Allow select threads to bypass the usual thread initialization

    Parallel query jobs dont need to do any of the normal thread
    initialization, so skip it.
    markw65 committed with sgolemon Sep 11, 2012
Commits on Sep 15, 2012
  1. Parser bug fixes and clean up

    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.
    andrewparoski committed with sgolemon Sep 1, 2012
Commits on Sep 14, 2012
  1. Only validate that the subject of preg_split is valid utf8 once per call

    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.
    swtaarrs committed with sgolemon Sep 13, 2012
  2. Add serialization support for collections

    This diff implements support for collections with serialize, unserialize,
    var_dump, print_r, json_encode, var_export, and debugger serialization
    formats.
    andrewparoski committed with sgolemon Sep 12, 2012
  3. Adding finally support to hphp (hphpc only for now)

    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.
    nikoloz committed with sgolemon Aug 13, 2012
  4. Generate INTERCEPT_INJECTION_ALWAYS for dynamicInvoke functions

    This means we can avoid compiling with ENABLE_INTERCEPTS, which
    significantly reduces the size of the binary.
    markw65 committed with sgolemon Sep 13, 2012
Commits on Sep 13, 2012
  1. Convert MemoryManager to ThreadLocalSingleton

    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.
    edwinsmith committed with sgolemon Sep 11, 2012
  2. Make DummySandbox shutdown always call execute_command_line_end

    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.
    jdelong committed with sgolemon Sep 11, 2012
  3. Make the translated SetOpM and IncDecM warnings match interp

    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.
    jdelong committed with sgolemon Sep 12, 2012
  4. Add HPHP::safe_cast and use it in the assembler

    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
    overhead.
    swtaarrs committed with sgolemon Sep 12, 2012
Commits on Sep 12, 2012
  1. Dont call getMInstrCtx unless necessary

    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.
    markw65 committed with sgolemon Sep 11, 2012
  2. Free memory for preg and memcache

    This introduces a more expensive, second phase of clearing thread caches.
    should help reduce long term memory usage
    bmaurer committed with sgolemon Jul 26, 2012
  3. Disallow dynamic properties for collections

    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.
    andrewparoski committed with sgolemon Sep 7, 2012
  4. Implement fb_could_include

    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
      binary.
    markw65 committed with sgolemon Aug 30, 2012