Commits on Oct 19, 2012
  1. Actually enable JIT by default in server/daemon/replay modes

    Previous diff missed that RuntimeOption::ExecutionMode
    was being set *after* the config file was loaded, so checking
    ExecutionMode always yielded an empty string (and thus not srv).
    Also removed from unnecessary duplicate code.
    sgolemon committed Oct 18, 2012
  2. Added Conv string->int

    Implemented cgConv for src:string, res:int
    Gownta committed with sgolemon Oct 18, 2012
  3. Debugger fixes/cleanup

    The various debugger classes with worker threads need to wait
    for the worker thread to finish before destroying the AsyncFunc
    object. I also added a bunch of logging to make figuring out exactly
    what went wrong easier.
    swtaarrs committed with sgolemon Oct 18, 2012
  4. Fix for hphp_gettid() implementation

    Redid the system files update, and now it builds.
    Vardhan Mudunuru committed with sgolemon Oct 16, 2012
  5. Support stream_resolve_include_path()

    Code copy of fb_could_include(), but returning
    the string rather than casting to bool.
    sgolemon committed Oct 18, 2012
  6. NewTuple should not be trying to allocate registers.

    Mark NewTuple as manually allocating registers, since we don't need any.
    edwinsmith committed with sgolemon Oct 18, 2012
  7. When storing to locals, always store the type for strings

    For string-typed locals, we can't skip storing the type even when the
    old and new types are the same at compile time. That's because the
    guards don't distinguish between static and non-static strings, so
    translations should be general to handle both cases.
    Also added checks for non-generic cells in SpillStack.
    ottoni committed with sgolemon Oct 18, 2012
  8. Disable direct trace jump when jcc is eliminated during codegen

    When a conditional jump is eliminated during codegen, turn off
    the direct jump optimization for the associated exits by setting
    the jump's data field to kIRDirectJumpInactive
    mpal committed with sgolemon Oct 17, 2012
  9. String equality can be improved.

    Ben Maurer pointed out an opportunity this morning while looking at perf top
    output: eq_str_str was a little too quick to resort to memcmp. It was relying
    on the trinary StringData::compare(), which falls back to
    memcmp(a, b, min(len1, len2)) once the easy cases have been exhausted.
    If we don't care about which direction the inequality goes (as for ==, !=,
    etc.), we can first test length. We apparently test unequal strings frequently
    enough for this to be profitable. I'll also try comparing hashes.
    This is a little rough as-is; for instance, the short-circuit test for
    identical pointers in eq_str_str might not really be helping.
    kma committed with sgolemon Oct 16, 2012
  10. Add low_{malloc,free}().

    Add low_{malloc,free}(), which use jemalloc functionality to allocate
    objects in low memory (via sbrk(2)).  Use these functions to allocate
    Unit, Class, Func, and static StringData objects, so that the TC can use
    more compact addressing modes when burning in references to them.
    jasone committed with sgolemon Oct 15, 2012
  11. Fixed bugs in property accesses, conversion and simplification, and a…

    …dded additional runtime asserts to generated code.
    Fixed a bug in static property accesses where we passed the
    wrong parameter to SPropCache::lookup. Fixed some code gen problems in
    type conversions. Added a check stack that checks top of stack contents
    for bad ref counted values. This is called on a function return.
    Fixed a refcounting bug in int-to-string casting and CSE'ing of instructions
    that produce or consume reference count.
    alia committed with sgolemon Oct 15, 2012
  12. Create new bytecode NewTuple for creating simple arrays

    A very common pattern for array-creation is array(<expr>,...) where
    no keys are given.  Capitalize on it with an opcode dedicated to that
    pattern.  Limit the arity to avoid excessively big operand stacks.
    edwinsmith committed with sgolemon Oct 17, 2012
  13. Fix incorrect assumption in TranslatorX64::useTvResult

    "foo()->bar += <expr>;" can produce an instruction where the
    bottommost stack input is not the first stack input in
    ni.inputs. useTvResult needs to be tolerant of this. I also fixed a
    typo in emitPropGeneric that I found while working on literal support.
    swtaarrs committed with sgolemon Oct 17, 2012
Commits on Oct 17, 2012
  1. Kill the FuncToTCA namespace and its dependents.

    I noticed this while messing with targetcache. FuncToTCA is
    not used anymore.
    kma committed with sgolemon Oct 16, 2012
  2. Eliminate Jcc to Jmp for conditional branches at the end of a trace.

    In eliminateDeadCode(), identify conditional branches at trace ends
    that have a side-effect free trace exit.  Connect the trace exits to the
    Jcc instruction by appending its result SSATmp* to the exit's list
    of inputs and set the value to IR_DIRECT_JCC_JMP_ACTIVE.
    Option -- While the SSATmp linkage works and makes it easy to visualize
    with Eval.DumpIR=1, I'm considering removing it. Connecting the instrs
    using the m_tca in each instruction is simpler.
    In addition, linking via the result SSATmp interferes with converting
    guard checks to direct branches since these operations are currently
    combined with the loads.  May be better to split these into a guard
    check with a label followed by a separate load.
    Combine cgJmpZero and cgJmpNZero into cgJmpZeroHelper(.., cc);
    Use LabelInstruction::m_patchAddr rather than m_asmAddr to anchor
    the list of addresses that need to be patched to point to the label.
    mpal committed with sgolemon Oct 4, 2012
  3. Fixed TestReflection for real this time.

    var_dumping the parameters includes a field
    indicating what function they come from.
    This is different between hphpc and hhvm for
    closures. Now the test only shows the name
    of each parameter.
    psnell committed with sgolemon Oct 16, 2012
  4. Fixed ReflectionClass::getProperties and getStaticProperties to retur…

    …n trait properties.
    psnell committed with sgolemon Oct 12, 2012
  5. Don't adjust rsp every time we do a generic M-vector translation

    There is already enough free space above rsp due to the HHIR
    spill locations.  Make this part of the ABI and take advantage of it
    for MInstrState.
    jdelong committed with sgolemon Oct 15, 2012
Commits on Oct 16, 2012
  1. Use the SPropCache for BaseS in generic vector translations

    Just hook this up in emitBaseS.  Also flags
    manuallyAllocInputs on the SetS and CGetS translations.
    jdelong committed with sgolemon Oct 12, 2012
  2. Avoid using MInstrState for statically known CGetMs

    Many vector instructions don't need an MInstrState struct on
    the stack to be executed. The most straightforward of these are CGetMs
    with all of their offsets known at compile time, which is what this
    diff adds support for. Now the generic vector translator is fast
    enough that we can permanently kill off CGetMProp (I've manually
    verified that the assembly output for the fast case is exactly the
    same). isSupportedCGetMProp is still around for the IR.
    swtaarrs committed with sgolemon Oct 13, 2012
  3. Clean up register allocation for Location::This

    A few of the places that used Location::This sidestepped the
    normal register allocation paths. I've cleaned those up, which should
    cut down on the number of times we load from m_fp->m_this. I've also
    changed the manually emitted closure code to use StackSym::H instead
    of emitting This.
    swtaarrs committed with sgolemon Oct 16, 2012
  4. Added user attributes to parameters

    psnell committed with sgolemon Oct 4, 2012
  5. Allow reflection to work on closures.

    This allows you to pass a closure to the constructor
    of ReflectionFunction in place of a function name.
    psnell committed with sgolemon Oct 10, 2012
  6. Fix InstrInfo for BindS

    aravind committed with sgolemon Oct 13, 2012
  7. Fixed bugs in continuations support and conditional jumps, and implem…

    …ented code gen for GuardType and some conversions.
    The Pack and Unpack Continuations helpers were incorrectly
    not recording synch points. The DecRef for conditional jumps was being
    pushed off-trace, which caused an assertion failure.
    alia committed with sgolemon Oct 10, 2012
Commits on Oct 15, 2012
  1. Give opcode NewArray a capacity hint

    Add an array-capcity hint to the NewArray instructions, so
    compiled expressions like array(1,2) or array(a=>1, b=>2)
    have a shot at right-sizing the array before initialization.
    edwinsmith committed with sgolemon Oct 14, 2012
  2. Fix throwing from FunctionEnter/Exit

    In a really hard to reproduce edge case, fcallHelper would call
    doFcall, which could then throw from FunctionEnter via
    In this case, the stack wasnt setup correctly to unwind
    through fcallHelper, and the c++ exception mechanism called
    To fix it, I added a try catch to fcallHelper, and smashed
    the return address to be the call's true return address.
    This allows our unwinder to be called, and everything's happy.
    While there, realized that we were swallowing exceptions from
    the user profiler (basically to avoid issues like this); but
    doing so was pointless, given that CheckSurprise could still
    markw65 committed with sgolemon Oct 12, 2012
  3. Presize VMEC.m_constants(10000)

    This array usually grows to about 8000 elements, reallocing
    about twelve times along the way.  This should save some
    allocation/memcpy/rehash traffic.
    edwinsmith committed with sgolemon Oct 12, 2012
  4. Enregister object bases for BaseLCR

    Can skip an extra check in the first propPre, but probably
    doesn't have much impact.
    jdelong committed with sgolemon Oct 12, 2012
  5. Zero targetcache with memset.

    Also, make size driven by a config flag,
    and madvise it away when the thread goes idle.
    kma committed with sgolemon Oct 12, 2012