Skip to content
Commits on Oct 18, 2009
  1. @laverdet

    Make startup a lot faster

    laverdet committed
    This greatly decreases startup time for the codebase by making the non-XHP fastpath a lot more sophisticated.
    One of the biggest fastpath false positive was markup in strings. The new fastpath correctly scans past strings which means we don't have to double parse nearly as many files.
    I implemented the fastpath in re2c which is the lightest weight scanner I could find. Basically the only thing it does is convert lists of regular expressions to huge state machines. Everything else you might expect from a scanner has to be implemented from scratch, which is just what I want.
    I implemented just enough of PHP's grammar to know when we're looking at actual code. Then I use the same XHP clues as I had in the old scanner.
    Reviewed By: dcorson
    Test Plan:
    Browsed around the lite site, etc.
    Revert: OK
    DiffCamp Revision: 69583
Commits on Oct 13, 2009
  1. @laverdet

    Bump version to 1.3.1

    laverdet committed
Commits on Oct 7, 2009
  1. @laverdet

    Bump to 1.3.1

    laverdet committed
    Last commit added a function so I need to bump the version number
Commits on Oct 2, 2009
  1. @laverdet

    Allow index chaining

    laverdet committed
    This fixes the "bug" in PHP's grammar where you aren't allowed to use the [...] operator on the return value of a function. It rewrites all instances which would be syntax errors into ##__xhp_idx($arr, $index)##. __xhp_idx is implemented in ext.cpp in C and is probably faster than the idx we made in PHP.
    It behaves exactly as the [...] operator would.
    If you want to ignore undefined index warnings you can do ##@foo()['etc']## and the @ will only apply to the __xhp_idx call.
    One thing to watch out for is that each chained [...] on the end of a function is a function call. So if you're doing something like ##foo()['bar']['etc']['muk']## you get 3 calls to __xhp_idx.
    TODO: Add ini entry to disable this feature (only need to set a flag).
    Reviewed By: dweatherford
    Test Plan:
    marcel@dev050 ~/xhp $ cat honk.php
      function foo() {
        return array(
          'bar' => 'etc',
      echo foo()['bar'] . "\n";
      echo foo()['etc'];
      echo @foo()['etc'];
      marcel@dev050 ~/xhp $ php honk.php
      PHP Notice:  Undefined index: etc in /home/marcel/xhp/honk.php on line 10
    I also ran the whole codebase through xhpize to make sure no lines were getting rewritten that didn't need it.
    Revert: OK
    DiffCamp Revision: 66576
Commits on Sep 29, 2009
  1. @laverdet

    Fix HEREDOC bug

    laverdet committed
    Heredocs weren't scanning properly in XHP 1.2.1. This fixes that
    Test Plan:
    $foo = <<<HERE
    Reviewed By: epriestley
    Revert: OK
  2. @laverdet

    Bug fixes

    laverdet committed
    - Line numbers got messed if you closed PHP via "?>"
    - Various parse errors while using "element" as an identifier (Mediawiki)
    Test Plan:
    find ~/tfb/ | grep -E 'phpt?$' | xargs ./xhpize -d -i
    Reviewed By: epriestley
    Revert: OK
Commits on Sep 26, 2009
  1. @laverdet

    Making trunk 1.2.0 in ext.hpp

    laverdet committed
Commits on Sep 20, 2009
  1. @laverdet

    Docblock comments and better line numbers

    laverdet committed
    Summary: Use of yymore() was messing up line numbers in XHP. This also
             introduces preservation of docblock comments by sticking them on as
             a code_rope to the next token encountered.
    Reviewed By: epriestley
    Test Plan: Cursory testing of lite. Test cases in xhpize.
    Revert: OK
    DiffCamp Revision: 65029
Commits on Sep 19, 2009
  1. @laverdet

    Complete rewrite; version 1.1.0

    laverdet committed
    Summary: I deleted most of XHP and started over. Points of interest:
             - Compatibility with at least PHP 5.3, likely up to PHP 6.0.
             - Uses PHP's parser instead the one I wrote
             - Rewritten scanner. The scanner now returns code_rope's with the
             actual code that was scanned, along with line numbers.
             - Separate the XHP parser and extension code
             - Further improved build process
             - No new features
    Reviewed By: epriestley
    Other Commenters: iproctor
    Test Plan: marcel@dev050 ~/alpaca $ php ./lib/init/script.php 
               marcel@dev050 ~/alpaca
               More testing will be done before committing this to APE.
    Revert: OK
    DiffCamp Revision: 64717
Commits on Aug 20, 2009
  1. @laverdet

    Support the reflection API getting docblocks

    laverdet committed
    Summary: XHP strips comments which means the Reflection API can no longer
             glean whatever information it needs from docblocks. This code
             memoizes docblocks and spits them back out in the rewritten code in
             random locations.
             This doesn't include reflection for class constants and stuff
             because those are hard and nobody probably cares anyway. Also if
             you make a habit of embedding docblocks in between every semantic
             token you will likely get back unexpected results while using XHP.
             Included is a half-hearted unit-test directory which includes my
             reflection test that half passes.
    Reviewed By: epriestley
    Test Plan: See unit-text/reflection.php
               Class properties fail.
               Also this:
                 /** comment7a */ class /** comment7b */ BarClass /** comment7c
               */ extends /** comment7d */ FooClass /** comment7e */ {
               Returns comment7e instead of comment7d. Deal with it.
    Revert: OK
    DiffCamp Revision: 60448
Commits on Jun 22, 2009
  1. @laverdet

    Quick checkin

    laverdet committed
    Summary: I just want a checkin of this somewhere that's not my dev server.
    Test Plan: None
Something went wrong with that request. Please try again.