Permalink
Commits on Jan 21, 2017
  1. Include the portability headers in the compiler, parser, and HHBBC wh…

    …ere needed
    
    Summary: Allowing compilation on Windows.
    
    Reviewed By: aorenste
    
    Differential Revision: D4444762
    
    fbshipit-source-id: 6bb62995e8e66f0868766f854590e2ba42852559
    Orvid committed with hhvm-bot Jan 21, 2017
  2. Disallow $$ in locations where variable is expected

    Summary:
    While investigating how Hack parses parameter lists I discovered an oddity. The Hack parser allows this program:
    
         class C {
           public int $$;
           function foo($$) {
             try {
               $x = $y |> function blah() use($$) { };
             }
             catch (Bar $$) { }
           }
         }
    
    All of those uses of $$ are, with the possible exception of the "use" clause, nonsense. All are accepted by the Hack parser. All are rejected by the HHVM parser.
    
    For reasons unknown to me there is a helper method "variable" in the Hack parser which is *only* called in the four situations above: class variables, formal parameters, use clauses and catch clauses, and which *specifically* accepts $$.
    
    I've fixed the helper method so that it only accepts local variables, as it should.
    
    Reviewed By: andrewjkennedy
    
    Differential Revision: D4445087
    
    fbshipit-source-id: 81fe4bfccfa560858f26d49f8dde43dfcbdd5e33
    ericlippert committed with hhvm-bot Jan 21, 2017
  3. Fix crash in original Hack parser involving extra ellipsis

    Summary:
    The program fragment
    
        function x(... int ... $x) {}
    
    crashes the parser; the code is *asserting* that it is impossible for there to be ellipses in both places, but in fact this is a rule of the language that should be detected to produce an error, not a logical invariant.
    
    I've modified the parser so that the invariant is maintained and an error is produced for this program fragment. (The error is "expected variable").
    
    Differential Revision: D4443342
    
    fbshipit-source-id: 6bb6384928b81a91837d5c55d61372a0cb11868b
    ericlippert committed with hhvm-bot Jan 21, 2017
  4. Remove incorrect eval stack frame logic

    Summary: I added this logic in a long time ago to distinguish "eval" frames from "file" frames, but I've since come to realize that it's not right, because pseudomain frames don't always indicate that we've started an eval, for instance any `include` will cause a pseudomain frame to be on the stack.  This diff removes the logic.
    
    Reviewed By: paulbiss
    
    Differential Revision: D4446088
    
    fbshipit-source-id: c2243fbac3d8826191662da0ef554f3700ec8b88
    johnislarry committed with hhvm-bot Jan 21, 2017
  5. Remove Hack's knowledge of deprecated instance methods

    Summary:
    These WaitHandle reflection methods are deprecated, some of them in favor of
    functions in the HH\Asio namespace, others without replacement, as they are no
    longer used or considered useful.
    
    Reviewed By: periodic1236
    
    Differential Revision: D4433484
    
    fbshipit-source-id: 31150eb8b63d148c966ec55015f3a3158d5aab8a
    jano committed with hhvm-bot Jan 21, 2017
Commits on Jan 20, 2017
  1. Process unit tests

    Summary: Add unit tests for Process module. Factor out Asserter into its own module.
    
    Reviewed By: hubyrod
    
    Differential Revision: D4386577
    
    fbshipit-source-id: 46be3be54cf3e2a37a681e18131cb93cb468c876
    alexchow committed with hhvm-bot Jan 20, 2017
  2. Move server driver case 1 test to ocaml

    Summary: Move more integration tests to ocaml
    
    Differential Revision: D4386035
    
    fbshipit-source-id: cf17d24458ad5dc7572b0d20b50d33c63aba9da4
    alexchow committed with hhvm-bot Jan 20, 2017
  3. Move server driver case 0 to ocaml integration test

    Summary: Moving Server driver case 0 from Python to Ocaml
    
    Differential Revision: D4382015
    
    fbshipit-source-id: 31fe467ea880de4b7db278d2fc80d35a305a307e
    alexchow committed with hhvm-bot Jan 20, 2017
  4. Move a couple of contbuilds over to gcc-5

    Summary: Until we move over wholesale, lets make sure the builds don't get broken.
    
    Reviewed By: kodafb
    
    Differential Revision: D4436139
    
    fbshipit-source-id: 41890145945d1f5fe7c40bdb74cf160e5fc215ad
    markw65 committed with hhvm-bot Jan 20, 2017
  5. Improve parse tree representation of encapsulated strings.

    Summary:
    We represent the interior of an encapsulated string as a list of text sections.  Previously if we had something like
    
        "abc{$x}def"
    
    that would be represented as a list:
    
        text head   "abc{
        expression  $x
        text tail   }def"
    
    But the { and } are not part of the text of the string, so this is somewhat confusing.  We now represent this as
    
        text head          "abc
        braced expression  {,  $x,  }
        text tail          def"
    
    We make similar changes to the deprecated form:
    
        "abc${x}def"
    
    is now
    
         text head         "abc
         dollar            $
         braced expression {,  x,  }
         text tail         def"
    
    I've also added comments clarifying how trivia is assigned to fragments.  For example, in
    
        "abc ${ x } def"
    
    there are four spaces. The first is part of the text fragment; it is not trivia at all. The second is trailing trivia of the {. The third is trailing trivia of x, and the fourth is part of the tail text fragment.
    
    Not in this change: we might consider similarly calling out the leading and trailing double quotes as special string regions. Similarly for detected escape sequences.
    
    Also not in this change:  The expression inside "{$x}" is parsed as a variable, but in "${x}" it is parsed as a name; the original parser parses it as a variable.  I'll need to fix that up at some point.
    
    Differential Revision: D4430418
    
    fbshipit-source-id: caf5a5eb68a1f58c6a18e3d3914beac534bfd0da
    ericlippert committed with hhvm-bot Jan 20, 2017
  6. Fixing pathing bug with hphpd_auth_token() script

    Summary:
    This diff only affects the behavior of the debugger when invoking the function `hphpd_auth_token()`. All other functionality remains the same.
    
    A bug in D3725724 caused the token script to be triggered by this command to only be found if the debugger was running in `~/www`. This fix allows for the debugger to be run anywhere.
    
    When the debugger connects to a sandbox, the default sandbox path is sent from the server to the client, which the client then uses the construct the full token script path.
    
    There could potentially be a discrepancy when the debugger connects to a sandbox which does not set the path correctly for when the client triggers `hphpd_auth_token()`, but this will simply cause the command to return the empty string.
    
    When attempting to land, it looks like there are test failures that are not my fault. See:
    - https://fb.facebook.com/groups/734933446555273/permalink/1293064390742173/
    - https://www.facebook.com/groups/1887034218249824/permalink/1918538345099411/
    
    So I'm going to override the unit test failures to get the land through with:
    
    Reviewed By: paulbiss
    
    Differential Revision: D4431538
    
    fbshipit-source-id: b8b1d625f1829f4f9cf356b7af4124e1fc0a8aca
    Kevin Lewi committed with hhvm-bot Jan 20, 2017
  7. Add openssl_get_curve_names to HHVM

    Summary: As part of bringing HHVM's support for elliptic-curve crypto via OpenSSL up to par with upstream PHP, I've added support for openssl_get_curve_names. Future diffs will add support for other operations that are lacking.
    
    Reviewed By: paulbiss
    
    Differential Revision: D4422741
    
    fbshipit-source-id: 8e03b734371e7fefcb8f18c8335d6adba6f771b1
    FBNeal committed with hhvm-bot Jan 20, 2017
  8. test: Cleanup after running 1775.php.

    Summary:
    After creating the file /tmp/lock.txt it should be deleted.
    
    Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
    Closes #7607
    
    Differential Revision: D4437882
    
    Pulled By: mofarrell
    
    fbshipit-source-id: e81a0d684bb85f4a5336fe339fb010b737aa07e7
    cmuellnerTheobromaSystems committed with hhvm-bot Jan 20, 2017
  9. Fix Imagick to initialize properly. This will make it load the system…

    … wide configs.
    
    Summary:
    Imagick was not being initialized.  This means that system configs were not being picked up.
    
    fixes #7605
    
    Reviewed By: paulbiss
    
    Differential Revision: D4437979
    
    fbshipit-source-id: 27997cc0f803f4353552b605c263c72f4f38f1e2
    mofarrell committed with hhvm-bot Jan 20, 2017
  10. Be slightly more concise with TransKinds

    Reviewed By: markw65
    
    Differential Revision: D4435139
    
    fbshipit-source-id: d5ce193d5d42af6051e24a15adc7285cfce49eb2
    mxw committed with hhvm-bot Jan 20, 2017
  11. Don't do branch profiling for profiling translations

    Reviewed By: markw65
    
    Differential Revision: D4435131
    
    fbshipit-source-id: 0eff93f31119627615ecdbe7955fa5c2bfaeba4b
    mxw committed with hhvm-bot Jan 20, 2017
  12. Fix policy for shouldTranslate()

    Summary: If cold or frozen fills up, hot won't save us.
    
    Reviewed By: markw65
    
    Differential Revision: D4435127
    
    fbshipit-source-id: b812dd081def69c6d05a88117675262a7786bc60
    mxw committed with hhvm-bot Jan 20, 2017
Commits on Jan 19, 2017
  1. Deduplicate errors sent to client

    Summary:
    See task. Under some circumstances, Hack will produce multiple exact-duplicate errors. Deduplicate these so that only one instance of each error is reported.
    
    Two errors are considered exact duplicates if their messages and position for each message are all the same.
    
    Reviewed By: dabek
    
    Differential Revision: D4413347
    
    fbshipit-source-id: 5e3b4309145a099a209fe0e1107f08a94c8c3bdd
    Waleed Khan committed with hhvm-bot Jan 19, 2017
  2. hhvm-oss: update third-party

    Summary:
    hhvm-oss: update third-party
    
    Closes #7611
    
    Reviewed By: mofarrell
    
    Differential Revision: D4436540
    
    fbshipit-source-id: daaf35635bbce71536b96914b5701975b429be23
    aorenste committed with hhvm-bot Jan 19, 2017
  3. test: FMA instructions create alternative result in imageaffine.php

    Summary:
    imageaffine() calls C++ code, for which g++ generates FMA instructions
    when available (e.g. on Haswell+ or arm64). FMA instruction calculate
    a more precise result as they don't round between the multiply and the
    add operation. However, that also means that the result is different.
    
    This patch addresses the different result of imageaffine() caused by HHVM
    versions, which are compiled for machines, which support FMA.
    The result has been confirmed on arm64 g++-4.8, g++-5.4, and g++-6.2.1.
    
    Fixes #7594
    
    Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
    Closes #7606
    
    Differential Revision: D4432072
    
    Pulled By: mofarrell
    
    fbshipit-source-id: 6df1eb922f4b0fd9863ffbd01e3527fd62966b59
    cmuellnerTheobromaSystems committed with hhvm-bot Jan 19, 2017
  4. test: Cleanup after running touch_date.php.

    Summary:
    After creating the file touch_date it should be deleted.
    
    Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
    Closes #7610
    
    Differential Revision: D4432417
    
    Pulled By: mofarrell
    
    fbshipit-source-id: 0b45c3079a550560eeb2e489c2306809aa4cd16c
    cmuellnerTheobromaSystems committed with hhvm-bot Jan 19, 2017
  5. Put FixedStringMap/FPIEntVec/PropInitVec on huge pages

    Summary:
    Accesses to these data structures seem visible in profiles.
    
    Also try to rewrite PropInitVec a bit to add a 'm_capacity' field and avoid unnecessary calls to malloc_huge/free_huge.
    This is because the huge version might be more expensive since it bypasses thread cache.
    
    Differential Revision: D4256637
    
    fbshipit-source-id: 2f25a766ea57c0977dac4d8e5be828206a78fcf1
    binliu19 committed with hhvm-bot Jan 19, 2017
  6. Improve representation of simple xhp class attributes

    Summary:
    An xhp attribute class declaration can be either complex -- a type, name, initializer and requires clause -- or just an XHP type name.
    
    Many of these attribute declarations can be in a list.  For example:
    
        attribute Foo bar = whatever, :button;
    
    We were previously parsing the "simple" form by simply sticking the token in the list. But that is weird in two ways. First, it seems "unparallel" that list items can be either a complex structure or a token. Second, it is weird that a type name appears in the parse tree without being inside a simple type node.
    
    We fix both problems at once, by wrapping up the token first in a simple type, and then in a new "simple attribute" parse node.
    
    Thanks to Kendall for pointing out the issue.
    
    Reviewed By: KendallHopkins
    
    Differential Revision: D4433214
    
    fbshipit-source-id: 91f59c7be2180ed6b7717a520774b225837884d2
    ericlippert committed with hhvm-bot Jan 19, 2017
  7. Fix a crash in RegionDesc::chainRetransBlocks

    Summary:
    erasing from a boost flat_set while iterating it could corrupt the
    lists, resulting in asserts later.
    
    Reviewed By: mxw
    
    Differential Revision: D4430904
    
    fbshipit-source-id: 11648fc96a8132f08850abbfd01cc5de10b2a0e2
    markw65 committed with hhvm-bot Jan 19, 2017
  8. Fix parsing of empty vec, dict, keyset intrinsics

    Summary: When I wrote the parsers for vec, dict and keyset intrinsics I forgot that they can be empty.  Easy fix.
    
    Reviewed By: KendallHopkins
    
    Differential Revision: D4432578
    
    fbshipit-source-id: c032eb8f90947821220056337db3ff9b2209aa3b
    ericlippert committed with hhvm-bot Jan 19, 2017
  9. Wrap variadic parameter declarations in descriptive type

    Summary:
    The FF parser would take a parameter list like
    
        (int $x, ...)
    
    and create a parse tree where the first list item is a parameter declaration (obviously) and the second list item is an ellipsis token.
    
    Kendall reasonably pointed out that having a list where the two things that can be in it are a highly structured node type -- parameter declaration -- and a single ellipsis token -- is a poor user experience in the API.  I agree.
    
    We now wrap ellipses in function, lambda and function type parameter lists in a "VariadicParameter" structure that has one child, an ellipsis token.
    
    Reviewed By: KendallHopkins
    
    Differential Revision: D4432344
    
    fbshipit-source-id: 35270b3392caf06d6b2b6b64cbdfa9c7a782b486
    ericlippert committed with hhvm-bot Jan 19, 2017
  10. Aarch64 - Use architecture zero reg when lowering store*i

    Summary:
    There were numerous places where a zero immediate was being
    written to memory.  Aarch64 has a dedicated zero valued register.
    This is one place where it can be used to reduce the dynamic instruction
    count.  The example below was taken from the regression test
    hhvm/hphp/test/zend/good/ext/intl/tests/grapheme.php
    
     Before
    =====
        326  B3: [profCount=1] (preds B0)
        327     (08) SpillFrame<-3,0> t1:StkPtr, t3:Func, Nullptr
        328         Main:
        329               0x1e2008e8  f81e03a0              stur x0, [x29, #-32]
        330               0x1e2008ec  52800000              movz w0, #0x0   <<-------------
        331               0x1e2008f0  b81ec3a0              stur w0, [x29, #-20]
    
    After
    =====
         17480  B3: [profCount=1] (preds B0)
         17481     (08) SpillFrame<-3,0> t1:StkPtr, t3:Func, Nullptr
         17482         Main:
         17483               0x1b400864  f81e03a0              stur x0, [x29, #-32]
         17484               0x1b400868  b81ec3bf              stur wzr, [x29, #-20]
    Closes #7592
    
    Differential Revision: D4398180
    
    Pulled By: pengstanford
    
    fbshipit-source-id: 432379b888a6060304db9ac51a9967d5b2186ae3
    swalk-cavium committed with hhvm-bot Jan 19, 2017
  11. Update hhvm OSS third-party to fix cmake build

    Summary: Update hhvm OSS third-party to fix cmake build
    
    Reviewed By: mofarrell
    
    Differential Revision: D4431330
    
    fbshipit-source-id: 3372c49a7ad2e8cdf31a5c6970669ba05470d371
    aorenste committed with hhvm-bot Jan 19, 2017
  12. JSON RPC version of identifySymbol / outline requests

    Summary: Adding parsing of input format and wiring everything together.
    
    Differential Revision: D4408100
    
    fbshipit-source-id: 270c4dbc1898e03fd620b4f602495ac4f7394b3b
    dabek committed with hhvm-bot Jan 19, 2017
  13. IDENTIFY_SYMBOL / OUTLINE RPC commands operating on synchronized file…

    … contents
    
    Summary:
    Those two methods (and many more, that I will be changing soon) operate only on
    provided text buffer. Changing it to accept a variant of "text buffer or file
    path" (similar to what INFER_TYPE or COVERAGE_LEVELS already do).
    
    Differential Revision: D4408116
    
    fbshipit-source-id: 6923cdb713a3ffe86c42bb5af982ccbbbc0a3678
    dabek committed with hhvm-bot Jan 19, 2017
  14. JSON RPC version of identifySymbol / outline responses

    Summary:
    As promised in previous diff, making some changes to those commands.
    
    The main one is reusing the same structure to represent SymbolDefinition in both call types. Besides that:
    
    - adding a filename field to SymbolDefinition instead of repeating the filename multiple times in single response
    - renaming "result_type" to "kind" (for consistency - we want to use the word "type" to mean actual things from type system)
    - removing the symbolID field (didn't get used for now, and I think it needs some more thinking through)
    - renaming to "class" to "type_id" and "class_const" to "member_const"
    
    Differential Revision: D4408123
    
    fbshipit-source-id: 0e4b7db8155049b2d5300f2026a39f6e0aa179a7
    dabek committed with hhvm-bot Jan 18, 2017
  15. Move JSON printing of SymbolOccurrence/SymbolDefinition to Nuclide_rp…

    …c_message_printer
    
    Summary: ... so that we can version it and eventually change.
    
    Differential Revision: D4408131
    
    fbshipit-source-id: 19a7dc0c710aa18641a60348f09f57bd10977f3d
    dabek committed with hhvm-bot Jan 18, 2017
  16. Merge code for readable printing of symbols in tests and in client

    Summary:
    We print them in hh_single_type_check and clientGetDefinition in different
    ways for no particular reason.
    
    Making:
       - ClientGetDefinition.print_readable the canonical method to print SymbolOccurence
       - FileOutline.print_def a canonical method to print SymbolDefinition
       - FileOutline.print a canonical method to print a collection of SymbolDefinitions
    
    The tests are updated, and the things printed by the client are not intended to
    be machine readable (as opposed to the --json version), so the change should be
    safe.
    
    Differential Revision: D4408138
    
    fbshipit-source-id: e11089624559fb141199467430d5fea9a93a0f8b
    dabek committed with hhvm-bot Jan 18, 2017
  17. Make struct field names in Ide_message unique

    Summary:
    Ocaml is not very good about resolving non-unique field names, and having them
    results in having to fully qualify things all the time. SAD!
    
    Differential Revision: D4408143
    
    fbshipit-source-id: 748989531c9cbcd000e30634e6eb2b9e30206563
    dabek committed with hhvm-bot Jan 18, 2017
Commits on Jan 18, 2017
  1. Move SymbolOccurrence/SymbolDefinition into separate utils TARGET

    Summary:
    Those things don't depend on anything, and are used in many places, making it
    easy to introduce circular dependencies.
    
    Differential Revision: D4408149
    
    fbshipit-source-id: 4277dae905bdca987ce984d0a9eeae2ca0b04295
    dabek committed with hhvm-bot Jan 18, 2017