Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Commits on Aug 27, 2010
  1. @haiping @scottmac

    fixed the DOM crash from cloned nodes

    haiping authored scottmac committed
    Summary:
    "clone $node" needs to copy over m_node.
    
    Test Plan:
    This doesn't crash and produces same result as PHP does,
    
      <?php
      $dom1 = new DomDocument('1.0', 'UTF-8');
    
      $xml = '<foo />';
      $dom1->loadXml($xml);
    
      $node = clone $dom1->documentElement;
    
      $dom2 = new DomDocument('1.0', 'UTF-8');
      $dom2->appendChild($dom2->importNode($node->cloneNode(true), TRUE));
      $dom2->save("/tmp/test.xml");
    
    DiffCamp Revision: 151256
    Reviewed By: macvicar
    CC: macvicar, hphp-diffs@lists
    Tasks:
    #342985: Segfault in DOM code
    
    Revert Plan:
    OK
  2. @scottmac

    [Fix] INF/NAN in serialization and in arrays

    qixin authored scottmac committed
    Summary:
    Two bugs: (1) both INF and -INF were serialized to INF; (2) INF, -INF, and NAN
    didn't get precomputed correctly for static arrays.
    
    Test Plan:
    Alexey's testcase, both compiled and interpreted
    
    DiffCamp Revision: 151109
    Reviewed By: myang
    CC: qixin, myang, lesha, hphp-diffs@lists
    Tasks:
    #344247: Fix INF in serialization
    
    Revert Plan:
    OK
  3. @haiping @scottmac

    fixed a bug in ylmm about line numbers

    haiping authored scottmac committed
    Summary:
    Also fixed T_FUNCTION rules, so their 1st lines are correctly set by yacc.
    Otherwise, for some reason, when modifiers are optional, the first lines are
    from those whitespace tokens, perhaps because there is no 1st non-whitespace
    token to hold first lines.
    
    Test Plan:
    "make -C system" not causing line number changes, also passing fast_tests and
    slow_tests
    
    DiffCamp Revision: 150882
    Reviewed By: iproctor
    CC: iproctor, hphp-diffs@lists
    Revert Plan:
    OK
  4. @scottmac

    Build probed bfd_cache heap on stack

    ervan authored scottmac committed
    Summary:
    StackTraceNoHeap was previously allocating heap via
    shared_ptr and use hash_map.  Those usages have been
    removed by allocating a (search) heap on the stack
    before calling Translate.
    
    A max filename length of 100 was arbitrarily chosen.
    For this to fail, there must be a hash_string collision
    (using all characters) after linear probing and then
    the filenames must be the same in the last 100 characters.
    This seems rare enough we can ignore it.
    
    The bfd library itself still allocates heap, so this
    isn't perfect, but maybe a little closer.
    
    Test Plan:
    manually hacked HPHP output and
    forced a seg fault and checked the result.
    
    DiffCamp Revision: 150557
    Reviewed By: hzhao
    CC: hzhao, ervan, hphp-diffs@lists
    Revert Plan:
    OK
  5. @scottmac

    Take more heap out of StackTrace

    Ervan Darnell authored scottmac committed
    Summary:
    
    Task ID: #
    
    Blame Rev:
    
    Reviewers:
    
    CC:
    
    Test Plan:
    
    Revert Plan:
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
Commits on Aug 26, 2010
  1. @haiping @scottmac

    fixed method's reflection to have file and line numbers

    haiping authored scottmac committed
    Summary:
    also fixed those array += with merge() calls
    
    Test Plan:
    debugger displays methods correctly
    
    DiffCamp Revision: 150642
    Reviewed By: iproctor
    CC: iproctor, hphp-diffs@lists
    Revert Plan:
    OK
  2. @scottmac

    Add a version number to file cache

    myang authored scottmac committed
    Summary:
    I added a tag (-1) followed the version number at the beginning of the file
    cache. The old format begins with a positive length so the leading tag -1
    serves to separate new format from version-less format.
    
    Test Plan:
    make fast_tests
    build www, load both file cache in both new/old formats.
    
    DiffCamp Revision: 150569
    Reviewed By: mwilliams
    CC: hphp-diffs@lists, mwilliams
    Revert Plan:
    OK
  3. @scottmac

    Remove some stale smart allocator class names

    myang authored scottmac committed
    Summary:
    Classes MapVariant, VectorVariant, etc. no longer exist so I remove their
    traces from smart_allocator.inc.
    
    Test Plan:
    make fast_test
    build www
    
    DiffCamp Revision: 150597
    Reviewed By: andrewparoski
    CC: hphp-diffs@lists, andrewparoski
    Revert Plan:
    OK
  4. @andrewparoski @scottmac

    Replace "type > KindOfStaticString" checks with a macro

    andrewparoski authored scottmac committed
    Summary:
    Recently I removed the LiteralString type and I had to change a lot of
    "type > LiteralString" checks with "type > KindOfStaticString". However,
    the better solution would have been to replace these checks with a macro.
    
    This revision replaces these checks with a macro. This improves code
    clarity and it will make future changes to Variant's list of types less
    error-prone.
    
    Test Plan:
    1) make fast_tests
    2) make slow_tests
    3) Build www and browse the site
    
    DiffCamp Revision: 150561
    Reviewed By: myang
    CC: hphp-diffs@lists, myang
    Revert Plan:
    OK
  5. @scottmac

    Delete some Fast Method Call comments

    ervan authored scottmac committed
    Summary:
    These were comments about possible bugs.  They have all been verified as
    correct.
    
    Test Plan:
    N/A, these are just comment changes.
    slow_test TestObjectMethod tests most of these cases already.
    
    DiffCamp Revision: 150489
    Reviewed By: mwilliams
    CC: mwilliams, hphp-diffs@lists
    Revert Plan:
    OK
  6. @scottmac

    Re-Enable Fast Method Call

    ervan authored scottmac committed
    Summary:
    Late errors from testing yesterday were due to a conflict with the change
    of the static file contents format.  No bug in fast method call was
    at issue (relative to yesterday's emergency disable).
    
    Task ID:
    
    Blame Rev:
    
    Reviewers: markw65
    
    CC:
    
    Test Plan: already tested
    in addition, a new www build is running on production.
    
    Revert Plan:
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    DiffCamp Revision: 150158
  7. @haiping @scottmac

    fixed parser's locations to have line0,char0,line1,char1 now

    haiping authored scottmac committed
    Summary:
    Turned on --locations for bison and fixed ylmm's location bug. It's fully
    working with char region highlight at breakpoint as well. This fixed the "line
    jumping" problem while debugging.
    
    Also removed ":" from word break char list, so Class::Method will
    auto-complete;
    
    Test Plan:
    debugged with PHP script with syntax highlighting of expressions on break.
    
    DiffCamp Revision: 150134
    Reviewed By: mwilliams
    CC: mwilliams, hphp-diffs@lists
    Revert Plan:
    OK
  8. @scottmac

    Make APC detailed profiling not forget keys

    qigao authored scottmac committed
    Summary:
    Modified APC detail profiling to make it not forget keys even they are
    deleted or overwritten. By only marking them invalid, we don't loose any
    previous profiling data.
    
    Added more profiling to detailed mode
    
    Task ID: #226217
    
    Blame Rev:
    
    Reviewers: qixin
    
    CC:
    
    Test Plan:
    make fast_tests
    production testing
    
    Revert Plan:
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    DiffCamp Revision: 149753
  9. @scottmac

    [Fix] prevent redefition of ntohll() and htonll()

    qixin authored scottmac committed
    Summary:
    For compiling fbcode with hphp library.
    
    Test Plan:
    make hphp
    
    DiffCamp Revision: 149602
    Reviewed By: hzhao
    CC: hphp-diffs@lists, hzhao, bagashe
    Revert Plan:
    OK
  10. @scottmac

    Disable fast method call

    ervan authored scottmac committed
    Summary:
    Temporaraily disable pending investigation.
    
    Test Plan:
    revert, irrelevant
    
    DiffCamp Revision: 149897
    Reviewed By: mwilliams
    CC: mwilliams, hphp-diffs@lists
    Revert Plan:
    OK
  11. @haiping @scottmac

    adding "blocked" to meta data

    haiping authored scottmac committed
    Test Plan:
    the new unit test
    
    DiffCamp Revision: 149869
    Reviewed By: qixin
    CC: qixin, hphp-diffs@lists
    Tasks:
    #336910: In HPHP, result from stream_get_meta_data() does NOT contain 'blocked'
    field
    
    Revert Plan:
    OK
  12. @andrewparoski @scottmac

    Clean semantics for foreach, array internal iterators, and array copies

    andrewparoski authored scottmac committed
    Summary:
    Under Zend PHP, there are peculiar interactions between foreach loops,
    array internal iterators, and array copies. Specifically, there are several
    interactions that expose information to user code about when array copies
    happen. This is a deep architectural flaw, because it allows user code to
    depend on implementation-specific details on the copy-on-write feature.
    
    Also, when the next element is unset inside a foreach by reference loop,
    the Zend runtime uses a strange heuristic involving pointer values to
    determine which element should be visited next. The nature of this strange
    heuristic makes it practically impossible to write an array implementation
    different from ZendArray that can pass all of our foreach by reference
    tests.
    
    This revision solves both of these issues by taking a strong, consistent
    position on several issues involving foreach loops, array internal
    pointers, and array copies. First, under HPHP a foreach by value loop will
    never modify an array's internal iterator. This works out well because the
    PHP manual already says that the state of an array's internal iterator
    should not be relied on during or after a foreach loop.
    
    Second, under HPHP an array copy will always preserve the state of an
    array's internal iterator. It turns out that HPHP was already doing this,
    but now we have tests to ensure that we continue to do this in the future.
    
    Third, under HPHP foreach by reference loops have been improved to have
    predictable semantics even when the next element is unset. Foreach by
    reference loops that exhaust an array uphold the following invariants:
    
    1) If an original element is not deleted, the loop will visit it exactly
    once.
    2) If an element is appended and is not deleted, the loop will visit it
    exactly once.
    3) If an original element or an appended element will not be visited if it
    is deleted during a previous iteration.
    4) The loop will visit all elements in order, original elements first
    followed by appended elements.
    
    I have added a runtime option that will throw a fatal error if the next
    element is unset during foreach by reference. This will let us find out if
    there is any code out there that might depend on the old foreach by
    reference semantics (I didn't find anything during my testing).
    
    Test Plan:
    1) make fast_tests
    2) make slow_tests
    3) Run www in production
    4) flib tests under hphpi
    4) unit tests under hphpi
    
    DiffCamp Revision: 144966
    Reviewed By: qixin
    CC: hphp-diffs@lists, qixin, andrewparoski
    Tasks:
    #312786: array_walk()'s inconsistency
    
    Revert Plan:
    OK
  13. @scottmac

    [Fix] Remove PEAR_Error builtin class

    iproctor authored scottmac committed
    Summary:
    It was added a long time ago for unit tests, but it's not technically a builtin
    class.
    
    Test Plan:
    flib tests, no complaints about missing PEAR_Error
    
    DiffCamp Revision: 149616
    Reviewed By: hzhao
    Commenters: qixin
    CC: hphp-diffs@lists, iproctor, davidrecordon, hzhao, achao, qixin
    Revert Plan:
    OK
  14. @scottmac

    Generate Named Scalar Arrays

    myang authored scottmac committed
    Summary:
    This is another change made to improve incremental build. Scalar Arrays
    were referenced using a global index. Now they are accessed through a
    name that is more stable across different releases.
    
    Test Plan:
    make fast_tests
    make slow_tests
    make www
    make www-dev
    
    DiffCamp Revision: 149713
    Reviewed By: qixin
    CC: hphp-diffs@lists, qixin
    Revert Plan:
    OK
  15. @scottmac

    Enable Fast Method Call, and fix mixed case method name bugs

    ervan authored scottmac committed
    Summary:
    0) This enables Fast Method Call to actually run.
    Diff D142421 contained most of this code, but was turned off.
    
    1) D149171, static MethodIndex hash table, is part of this review,
    but was separtely submitted.
    
    2) Fix MethodSlot generation to be case insensitive and preserving.
    
    3) Use "const char *s" (method name) for __call reporting.
    
    Test Plan:
    fast_tests, slow_tests, flib tests, (www) unit tests,
    run www build for 6 hours with significant error, and stop check on my own.
    
    DiffCamp Revision: 149666
    Reviewed By: mwilliams
    CC: hphp-diffs@lists, mwilliams
    Tasks:
    
    Revert Plan:
    OK
  16. @scottmac

    [Fix] Circular derivation and abstract method redec checks for hphpi

    iproctor authored scottmac committed
    Summary:
    Now it fatals when a class has a circular derivation or if
    a class inherits multiple abstract methods of the same name.
    
    Test Plan:
    TestCodeRunEval, sandbox
    <?php
    interface IA {
      public function a();
    }
    interface IB {
      public function a();
    }
    class Test implements IA, IB {
      public function a() {
        echo "hello world\n";
      }
    }
    $o = new Test();
    $o->a();
    
    <?php
    class a extends a {}
    
    DiffCamp Revision: 149612
    Reviewed By: hzhao
    CC: hphp-diffs@lists, hzhao
    Tasks:
    #319189: HPHP - implementing multiple interfaces with colliding method names
    
    Revert Plan:
    OK
  17. @scottmac

    Add an o_invoke test case

    ervan authored scottmac committed
    Summary:
    These tests proved useful while developing fast method call
    
    Test Plan:
    this is a test
    
    DiffCamp Revision: 149524
    Reviewed By: iproctor
    CC: hphp-diffs@lists, iproctor
    Revert Plan:
    OK
  18. @andrewparoski @scottmac

    Retire the LiteralString type from Variant's list of types

    andrewparoski authored scottmac committed
    Summary:
    Though the LiteralString type initially allows us to avoid having to
    allocate a StringData, it has several major downfalls. First, we often end
    up calling strlen multiple times because we don't have a place to cache the
    length of the string. Second, we sometimes construct a temporary StringData
    on the stack (see the cast functions inside builtin_functions.cpp and
    type_variant.cpp). Finally, in several places we end up having to allocate a
    StringData (see calls to toString() in type_variant.cpp).
    
    Now that allocation is relatively cheap (due to ThreadLocal and other
    improvements), we get equivalent performance and less code complexity if we
    simply take the initial hit of allocating a StringData. In the future, if
    there are performance-critical parts of the runtime where we want to avoid
    the cost of allocating a StringData, we can take advantage
    of our superior StaticString infrastructure.
    
    The shootout benchmark got a little faster (11.9s -> 11.8s), and there was
    no noticeable effect on performance or peak memory consumption when I ran
    www in production.
    
    Test Plan:
    1) fast_tests
    2) slow_tests
    3) Run www in production
    
    DiffCamp Revision: 145999
    Reviewed By: myang
    Commenters: qixin, mwilliams, hzhao
    CC: hphp-diffs@lists, hzhao, qixin, andrewparoski, myang, mwilliams
    Revert Plan:
    OK
  19. @scottmac

    [Perf] Remove prehash for object property accesses

    qixin authored scottmac committed
    Summary:
    Continue with getting rid of prehash generation in our code, as static strings
    have already got precomputed hashcode.
    
    Test Plan:
    fast_tests
    slow_tests
    www
    
    Microbenchmark showed about 30% improvement for object property accesses (25M
    o_gets went from 0.73s to 0.53s).
    
    DiffCamp Revision: 148743
    Reviewed By: mwilliams
    CC: hphp-diffs@lists, qixin, mwilliams
    Tasks:
    
    Revert Plan:
    OK
  20. @scottmac

    [FFI] Override DECLARE_BOOST_TYPES from outside

    qixin authored scottmac committed
    Summary:
    In fbcode, we have DECLARE_BOOST_TYPES that doesn't agree with HPHP's
    definition, (map/set vs hash_map/hash_set). We need to agree on the definition
    to make it compile and link.
    
    Test Plan:
    make hphp
    
    DiffCamp Revision: 149400
    Reviewed By: hzhao
    CC: hphp-diffs@lists, hzhao, qixin
    Revert Plan:
    OK
  21. @haiping @scottmac

    made compiled version debuggable

    haiping authored scottmac committed
    Summary: This is done by sharing interrupt code between LINE() macro and EvalFrameInjection::SetLine() and between throw_exception() and Eval::ThrowStatement.
    
    Also fixed eval() to use current frame's LVariableTable
    
    Reviewers: iproctor
    
    Test Plan: debugged a compiled program; step into a function and print a local variable
    
    DiffCamp Revision: 148806
  22. @scottmac

    Generate static MethodIndex table

    ervan authored scottmac committed
    Summary:
    1) Previously, a list of method names and and MethodIndex's was generated into
    the output.  At init time, this was copied into an
    hphp_const_char_imap<MethodIndex>.
    This was inefficient for 3 reasons: 1) It made init slow, 2) It wasted
    memory because two copies of the table existed, 3) Lookups were slow because
    the map is a RB tree.
    
    This is changed so that MethodIndexHMap is a directly generated hash table,
    statically initalized with no init step needed.  That fixes (1) and (2).
    For (3), lookups are now about twice as fast as before.  The hash table
    uses linear probing with 2X size.  It takes about 1.5 probes
    per method name (tested).
    
    e.g. the new name->MethodIndex looks like:
    const MethodIndexHMap methodIndexHMapSys [methodIndexHMapSizeSys] = {
    H(fflush,360,1), H(error,144,1), H(createentityreference,79,1),
    Z, H(getnameditem,120,1), H(add,212,1),  ...
    where this is the linear probed hash table.
    
    The reverse lookup looks like:
    extern const unsigned methodIndexReverseCallIndex[];
    const unsigned methodIndexReverseCallIndex[] = {0,  ....
    481,483,485,486,488,489,490};
    extern const char * methodIndexReverseIndex[];
    const char * methodIndexReverseIndex[] = {
    "next", "key", "valid", "getinneriterator", "append",
    and can be directly indexed with
    methodIndexReverseIndex[methodIndexReverseCallIndex[callIndex]+overloadIndex]
    
    2) Changes to testing (slowtests) now require builtin-class method
    lookup.  Since tests never compile any user PHP code, there is no
    per application MethodIndexHMap generated. To get around this, the
    system version is also generated when compiling the libraries,
    and used in the testing case.
    
    This is still the "do nothing" version.
    
    Test Plan:
    slow_tests, fast_tests, spot check www build
    
    DiffCamp Revision: 149171
    Reviewed By: iproctor
    CC: hphp-diffs@lists, iproctor, ervan
    Tasks:
    #170990: Improve o_invoke
    
    Revert Plan:
    OK
  23. @scottmac

    Use mmap for FileCache.

    myang authored scottmac committed
    Summary:
    I made the change as Paul suggested to mmap the file cache and then use
    posix_madvise to let the kernel free the memory that's occupied by the
    file cache on the grounds that the content of the file cache is rarely
    used. Each time we use a static content file, the corresponding memory
    will be loaded on-demand by the kernel from the disk file. After we
    send back the response, posix_madvise is called again.
    Task ID: #
    
    Blame Rev:
    
    Reviewers:
    ps, hzhao
    CC:
    hphp-diffs@lists.facebook.com
    Test Plan:
    make www
    Test on two production servers, turn on mmap for one and off for the other and
    compare used memory.
    Also load static resource files in the browser, with/without compression.
    Revert Plan:
    
    Tags:
    
    - begin *PUBLIC* platform impact section -
    Bugzilla: #
    - end platform impact -
    
    DiffCamp Revision: 148679
  24. @scottmac

    [Fix] $GLOBALS[__magic_constant__] was broken

    mwilliams authored scottmac committed
    Summary:
    Indexing $GLOBALS via one of the magic constants (__FUNCTION__, __CLASS__ etc)
    didnt work; it used the name of the magic constant, rather than its value.
    
    Test Plan:
    fast_tests, slow_tests + new test case.
    
    DiffCamp Revision: 148994
    Reviewed By: hzhao
    CC: hzhao, hphp-diffs@lists
    Revert Plan:
    OK
  25. @haiping @scottmac

    oops, accidentally took out o_id != 0 testing

    haiping authored scottmac committed
    Summary:
    But we have o_id = 0 for fake objects, so pmax became -1. Doh' my bad.
    
    Test Plan:
    no phpmcc fatal from constructor
    
    DiffCamp Revision: 148958
    Reviewed By: qixin
    CC: qixin, hphp-diffs@lists
    Revert Plan:
    OK
Commits on Aug 22, 2010
  1. @scottmac

    Memcache connect function should return a bool.

    scottmac authored
    Summary:
    Make the hphp implementation match the PHP one.
    
    At the moment the connect methods on classe don't
    return a value which can cause problems if one checks
    the return type.
    
    Test Plan:
    make
    
    DiffCamp Revision: 148819
    Reviewed By: hzhao
    CC: hphp-diffs@lists, hzhao, mpal
    Revert Plan:
    OK
  2. @scottmac

    pow() optimisation only works if exponent >= 0

    scottmac authored
    Summary:
    The conversion of pow() from PHP has a subtle bug.
    It uses multiplication even when exponent is negative.
    
    Test Plan:
    Should return INF, returns 0 in hphp
    <?php
    
    var_dump(pow(0, -2));
    var_dump(pow(0.0, -2.0));
    
    DiffCamp Revision: 148351
    Reviewed By: hzhao
    CC: hphp-diffs@lists, hzhao
    Revert Plan:
    Ok
  3. @haiping @scottmac

    better PHP code completion

    haiping authored scottmac committed
    Test Plan:
    manual testing with commands taking PHP code
    
    DiffCamp Revision: 148762
    Reviewed By: mwilliams
    CC: mwilliams, hphp-diffs@lists
    Revert Plan:
    OK
  4. @scottmac
  5. @haiping @scottmac

    fixed shuffle() to be consistent with PHP

    haiping authored scottmac committed
    Summary:
    Hmm, i just took std::random_shuffle() too conveniently :-)
    
    Test Plan:
    new unit test
    
    DiffCamp Revision: 148740
    Reviewed By: qixin
    CC: hzhao, qixin, hphp-diffs@lists
    Revert Plan:
    OK
Something went wrong with that request. Please try again.