Switch branches/tags
Commits on Oct 6, 2012
  1. Remove a bunch of VMRegAnchors from targetcache.cpp

    swtaarrs authored and sgolemon committed Oct 5, 2012
    None of these were needed, either because the function they
    were calling had its own VMRegAnchor or they just needed an fp which
    was being passed in anyway.
  2. Prefetch next entry in GarbageList.maybePop()

    edwinsmith authored and sgolemon committed Oct 3, 2012
    This might reduce the chance of an LLC-load-miss when allocating
    from a freelist in smart_malloc and SmartAllocatorImpl::alloc.
Commits on Oct 5, 2012
  1. Avoid malloc when creating strings in ext_fb

    edwinsmith authored and sgolemon committed Sep 27, 2012
    Using StringData's ability to reserve space, we can steer more
    string allocation traffic to small strings and smart_malloc'd strings,
    at clean up code at the same time.
    This also fixes a missing request-memory-limit check in smart_realloc.
  2. Put the translation cache in low memory

    markw65 authored and sgolemon committed Oct 4, 2012
    If the translation cache is in low memory, calls to c++ helpers
    dont need trampolines. Also, burnt in TCA addresses fit into 32 bits.
  3. Initial support for generators in HackIR, fix a few existing bugs

    swtaarrs authored and sgolemon committed Sep 25, 2012
    This diff adds and uses IR instructions to support all
    continuation bytecode instructions (except ContHandle, which is still
    interpOned like in Tx64). Because the ir doesn't support Switch yet
    and supporting it might end up being a lot of work, I've added a
    runtime option to allow emitting Switch that defaults to true,
    unless Eval.JitUseIR=true.
    I've also fixed a couple existing continuation bugs:
    - The exception handler region inside Continuation::next and
      Continuation::send (under hhvm) was wrong: it's intended to cover
      the body of the generator so it should only cover the FCall, not the
      ContNext/ContSend. ContNext/ContSend were changed to not push the
      continuation on the stack so they can be pulled out of the eh
    - Continuation::next and Continuation::send were setting the received
      field before performing their sanity checks. This could lead to
      wonky behavior if the current value in the received field messed
      with the Continuation object in its destructor. hhvm (jit, interp,
      ir) and hphpc now all perform the sanity checks before setting the
  4. Add room for header before rounding up in smart_malloc

    edwinsmith authored and sgolemon committed Oct 2, 2012
    If we add space for the header before rounding up, then the usable
    pointer will be 8-aligned.  However, if we throw away 8 bytes at the
    start of every slab, all usable pointers will then be 16-aligned.
    To reduce waste, add more size-classes (one every 16 bytes up to 2KiB).
  5. Dont create/destroy std::strings for literals

    markw65 authored and sgolemon committed Oct 2, 2012
    ConcurrentTableSharedStore logs a lot of its actions. It
    passes a literal string to log_apc, which expects a std::string,
    causing it to create/destroy a std::string every time (resulting
    in a malloc/free).
    Create a global std::string for each literal string thats used.
  6. Generator cleanup

    andrewparoski authored and sgolemon committed Sep 21, 2012
    Fold Continuation and GenericContinuation into a single class and remove
    unused fields, reducing the size of Continuation by 8 bytes for hphpc and
    24 bytes for hhvm.
    Also get rid of the gross MethodCallPackage/CallInfo hack for generators
    as it is no longer needed.
  7. Let _count float in emitCopyTo.

    kma authored and sgolemon committed Oct 3, 2012
    We're explicitly zeroing out the _count field
    in emitCopyTo. The destination is always an hhval,
    not a Ref, so it can't matter.
  8. Streamline copyImpl() code in HphpArray

    edwinsmith authored and sgolemon committed Jul 25, 2012
    This is a code cleanup patch to make it easier to spot
    bugs and refactor code.
    Numerous functions in HphpArray check to see if they must
    copy the array first, then contain two whole copies of
    the function body, one if we copied and one if we didn't.
    There's already a coding style in some functions that avoids
    the duplicated code;  this patch uses that style in the rest
    of the code.
    Early results show this is about 0.1% increase in CPU
    Instructions but about 1% decrease in CPU Time, although
    some endpoints have 1% noise
  9. Remove AttachDeprecated mode for StringData

    aravind authored and sgolemon committed Oct 3, 2012
    In many places we were doing malloc(size) followed
    by String(ptr, len, AttachDeprecated). Update this
    to use the StringData(int reserve) API.
  10. Fix side-exits for incorrect type predictions

    markw65 authored and sgolemon committed Oct 3, 2012
    The side exit for an incorrect type prediction should
    got to the next instruction; not re-execute the instruction
    that just produced an unexpected result.
  11. Minor test/ext_curl fixes

    swtaarrs authored and sgolemon committed Oct 3, 2012
    - Fail early if anything other than TestCodeRun* is run with
      an hhvm build
    - Set the m_url field of CurlResource in the copy constructor
    - Don't fail TestExtCurl if test_curl_copy_handle fails. I've spent a
      day trying to figure out why this is failing on Jenkins without much
      luck so far and I want to cut down on the test noise.
  12. emitFCallD needs to take a Func*

    markw65 authored and sgolemon committed Oct 3, 2012
    The function could be a method, so trying to look it
    up using a passed in name could fail (and is pointlessly
    expensive, since we've already determined the correct
    func anyway).
  13. Improve side exits from HHIR to tx64-generated translations

    ottoni authored and sgolemon committed Oct 2, 2012
    When a side exit from an HHIR-generated translation was taken, a
    BIND_JMP service request was being used, which would make it create a
    new HHIR translation at the exiting bytecode. This translation would
    then generate a REQ_RETRANSLATE_NO_IR to produce a tx64 translation.
    This diff avoids the useless HHIR translation generated for the
    exiting bytecode in case no translation for this bytecode exists when
    the service request is made.  This is done through a new
    BIND_JMP_NO_IR request that directly generates a translation for the
    exiting bytecode without HHIR if no translation for the SrcKey exists.
Commits on Oct 3, 2012
  1. Exploit type info in array helpers.

    kma authored and sgolemon committed Oct 3, 2012
    This is a somewhat weak optimization that pushes some type
    dispatch on keys into translation-time. It's easy to do, and looks like
    it might be good for 1% or so; it's in the noise, though, so take it with
    a grain of salt.
  2. smart_malloc treatment for StringBuffer

    edwinsmith authored and sgolemon committed Sep 25, 2012
    StringBuffer only has a few use cases which require it to
    either attach to malloc'd memory or produce malloc'd memory
    that the client later free's.  This diff refactors those clients
    so all StringBuffer-created strings can be smart-malloc'd.
    string_cplus_escape() used StringBuffer internally but all callers
    work fine (ne better) with std::string.  Changed MemFile and
    UrlFile to use a plain String (instead of char* ptr) to avoid having
    StringBuffer return a plain char* buffer.
    Created CstrBuffer to handle the use case of creating a plain
    malloc'd char* buffer, for dynamic_content_cache and
    static_content_cache; this seemed like the least-tricky solution
    and those were the only use cases for the StringBuffer(char*,int)
    and StringBuffer(char* filename) constructors.
    With those changes, we only need the StringBuffer(int size)
    constructor and it only produces ordinary Strings.  so we have
    a privat StringData instance which holds the string memory,
    then we finalize it in detach().
    I also renamed StringBuffer's fields to match terminology we
    already use in StringData.  (size or len = valid bytes of string,
    cap or capacity = usable bytes of underlying memory buffer).
  3. Increase StringData size limit to 2GB (2^31-2).

    edwinsmith authored and sgolemon committed Oct 1, 2012
    This diff simply increases the string size limit, and cleans
    up a handful of places we used int when we should have used
    uint32_t anyway. This clears the way for a followup, which makes
    limits StringBuffer to the same length limit as StringData.
    We use 2^31-2 because the real limit is 2^31-1 (biggest unsigned
    value for a signed-int length), but we want to safeguard against
    the likelihood of client code computing size()+1 into a signed-int32
    and wrapping.
  4. Add translator support for objects in Iter{Init,Next,Key,ValueC}.

    jasone authored and sgolemon committed Oct 2, 2012
    Enhance the translator to support object iteration in
  5. Remove dead class LfuTableSharedStore

    edwinsmith authored and sgolemon committed Oct 2, 2012
    This is one of the available APC SharedStore implementations,
    but its not enabled at all and the docs (circa 2010) refer to
    it as buggy/experimental.
  6. Don't create a GenericContinuation subclass for each continuation

    swtaarrs authored and sgolemon committed Sep 28, 2012
    A subclass of GenericContinuation is created for each
    generator function in code we emit. This was originally intended to be
    an optimization to allow burning in Func*s in the translation of
    FPushContFunc, but that was not a noticeable win in perflab and tricky
    to get right in sandbox mode (see the attached task). This diff
    changes the emitter and runtime to not generate all these subclasses,
    instead just using MethodContinuation and FunctionContinuation to
    allow some specialization at translation time.
  7. Get HHIR working with type prediction and pass more static info to HHIR

    ottoni authored and sgolemon committed Sep 26, 2012
    Type prediction was disabed with HHIR.  Enable it by passing the
    predicted (or inferred) types to HHIR.
    This diff also passes extra static analysis knowledge to HHIR:
    - whether this pointer is available
    - whether UnboxR is a no-op
  8. Support turning off IR's use of InterpOne when JIT will translate it

    mpal authored and sgolemon committed Oct 2, 2012
    Remove unused IR function HhbcTranslator::emitUnaryArith
    Add option to have the IR punt this trace back to the jit rather than
    doing an InterpOne for a bytecode to get more sensible perf numbers.
  9. Support (but raise warnings) for array casts for collections

    andrewparoski authored and sgolemon committed Sep 24, 2012
    I noticed that doing an array cast ("(array)$x") on a collection will
    produce an empty array (because collections currently use the default
    object->array conversion and collections don't have properties).
    This diff makes array casts for collections produce the same result as the
    toArray() method. Array casts for collections will also raise a warning
    (depending on runtime options).
  10. Fix BaseS class pointer burnin.

    jasone authored and sgolemon committed Oct 2, 2012
    Fix TranslatorX64::emitBaseS() to only burn in a class pointer for
    unique classes, and only when in repo-authoritative mode.
  11. Remove a few friend declarations in Unit

    jdelong authored and sgolemon committed Oct 1, 2012
    For MetaHandle: a member class's member function counts as a
    member of the containing class, so it has access to privates already.
    The friend for the other direction appears unused.
  12. Skip VMRegAnchor for arGetContextClass

    jdelong authored and sgolemon committed Oct 1, 2012
Commits on Oct 2, 2012
  1. Choose helper reffiness with types.

    kma authored and sgolemon committed Oct 1, 2012
    Some elem/prop helpers know that their keys must be cells, but
    those that use locals could get passed Refs. We know the reffiness of
    the input keys at translation-time; use this type, rather than the input
    flavor, to choose which helper to call. This should strictly reduce the
    number of KindOfRef checks in vector instructions.
    To gain confidence this was working as intended, I also factored out the
    ref checks into a helper that asserts that it has stripped any refs.
  2. Remove SmartAllocator for Array; its dead code.

    edwinsmith authored and sgolemon committed Sep 30, 2012
    Instances of Array (the smart-pointer wrapper) are never smart
    allocated, so we don't need the SmartAllocator declarations.