Permalink
Switch branches/tags
Commits on May 21, 2018
  1. Serialize forbidden-inlines in InliningDecider

    markw65 authored and hhvm-bot committed May 21, 2018
    Summary:
    After D8066398, most of our tests do exactly the same inlining when
    serializing or deserializing, but a few mismatched because they
    explicitly disabled inlining for specific functions. Just record those
    functions in the serialized data to make things match.
    
    Reviewed By: ottoni
    
    Differential Revision: D8066704
    
    fbshipit-source-id: a566cf0e734dbc4202728dc6cc60adaefeba19d2
  2. Serialize the call graph

    markw65 authored and hhvm-bot committed May 21, 2018
    Summary:
    I didn't serialize ProfTransRec::mainCallers, or guardCallers, because
    they're tc addresses, and I thought they were just used to smash the
    callers of the profiled funcs after we optimized (plus, it doesn't
    really make sense to record tc-addresses that won't exist when we
    unserialize). But we need these to build the call graph.
    
    This adds a set of TransID's representing the callers to each
    Proflogue, for use when building the call graph.
    
    Reviewed By: ottoni
    
    Differential Revision: D8066398
    
    fbshipit-source-id: a1cf48a9a7fb303f8e9280f81a8c5bf353c3856a
Commits on May 20, 2018
  1. Resolve public interface methods and support FCallAwait on an abstrac…

    paulbiss authored and hhvm-bot committed May 20, 2018
    …t base
    
    Summary:
    In www async functions on interfaces and abstract functions on base classes are defined as returning Awaitable but not marked as async as this is considered an implementation detail and these functions lack implementations. In hhbbc when determining if a FuncFamily is eligible for FCallAwait we were previously considering abstract functions although these functions either cannot be called (instance methods) or always fatal (static methods) and therefore need not be considered.
    
    With this fixed we are still unable to issue FCallD or FCallAwait reductions on calls where the base is known to be an object which implements a particular interface. In large part this is because given an interface and an instance it is difficult to tell whether the call was made with the correct context, or if there may be a private method on a parent class whether the call was made to the private version. This is because our usual strategy of comparing the context class with the called class won't work when the called class is only known to implement an interface.
    
    We could add some additional heuristics to allow certain private and protected methods to be considered part of an interface but as interfaces almost always define only public methods (I believe we now allow protected methods on interfaces) this would serve little purpose. To sidestep these issues methods for which a private ancestor may appear on any implementing class, and methods with non-public visibility are excluded.
    
    As a final optimization we observe that while hhbbc will not track intersection types of object classes and interfaces many interfaces and methods are always found together although not declared on the interface itself. To handle this we collect the interface methods by observing which common methods implementers define, rather than by restricting the list of methods to those declared on the interface.
    
    With these changes we see that both calls in the below test program become FCallAwait when compiled in repo mode.
    
    ```
    <?hh
    
    abstract class Base {
      abstract function foo(): Awaitable<int>;
    }
    
    class Alpha extends Base {
      async function foo(): Awaitable<int> {
        return 12;
      }
    }
    
    class Beta extends Base {
      async function foo(): Awaitable<int> {
        return 42;
      }
    }
    
    interface IBase {
      function bar(): Awaitable<bool>;
    }
    
    class One implements IBase {
      async function bar(): Awaitable<bool> {
        return true;
      }
    }
    
    class Two implements IBase {
      async function bar(): Awaitable<bool> {
        return false;
      }
    }
    
    async function test(Base $b, IBase $i): Awaitable<int> {
      await $b->foo();
      await $i->bar();
    }
    ```
    
    Reviewed By: jano, markw65
    
    Differential Revision: D8056108
    
    fbshipit-source-id: 1712ddbe0859657960b71404b75e5a6e378c6a0c
  2. Profile instance bits in method profiler

    ottoni authored and hhvm-bot committed May 20, 2018
    Summary:
    MethProfile may decide to emit dynamic checks to verify that the runtime class
    is an instance of a certain class or implements a certain interface.  Those
    checks can be optimized to use InstanceOfBitmask if the class/interface is
    assigned an instance bit.  This diff bumps the instance-bits profile counters in
    those cases in MethProfile.
    
    Reviewed By: markw65
    
    Differential Revision: D8067191
    
    fbshipit-source-id: 37c400b564fd9a1b90b216009caf8948145476b1
  3. Add an option to read HardwareCounters using rdpmc when available

    markw65 authored and hhvm-bot committed May 20, 2018
    Summary:
    Basically follows the code on the man page for perf_event_open.
    
    Running experiments locally, this gives pretty similar results
    to the old mechanism, but is roughly 10x faster.
    
      % perf stat -e L1-dcache-loads,mem-stores,instructions -- hphp/tools/hwctr-perf/hwctr-perf --count=30000000 --reps=0 --threads=1 --fast
      HW: 1 instructions = 0
      HW: 1 loads = 0
      HW: 1 stores = 0
      HW: 1 instructions = 9918749668
      HW: 1 loads = 2504696299
      HW: 1 stores = 1184991038
    
      Performance counter stats for 'hphp/tools/hwctr-perf/hwctr-perf --count=30000000 --reps=0 --threads=1 --fast':
    
            3173425047      L1-dcache-loads                                               (33.49%)
            1338231637      mem-stores                                                    (33.47%)
           10964094494      instructions                                                  (33.44%)
    
           3.221697293 seconds time elapsed
    
      % perf stat -e L1-dcache-loads,mem-stores,instructions -- hphp/tools/hwctr-perf/hwctr-perf --count=30000000 --reps=0 --threads=1
      HW: 1 instructions = 0
      HW: 1 loads = 0
      HW: 1 stores = 0
      HW: 1 instructions = 125447315063
      HW: 1 loads = 40718233336
      HW: 1 stores = 26217862057
    
      Performance counter stats for 'hphp/tools/hwctr-perf/hwctr-perf --count=30000000 --reps=0 --threads=1':
    
           40568288935      L1-dcache-loads                                               (33.36%)
           26027304099      mem-stores                                                    (33.35%)
          125320282222      instructions                                                  (33.36%)
    
          28.621233863 seconds time elapsed
    
    Reviewed By: ottoni
    
    Differential Revision: D7859937
    
    fbshipit-source-id: 07fe524234a72cab5e3a5cf65d418cee159e5044
  4. Don't assert and misbehave when QueueCount < ThreadCount

    edwinsmith authored and hhvm-bot committed May 20, 2018
    Summary:
    Misconfiguring QueueCount relative to ThreadCount causes
    array bound violations and makes the winning thread become
    a reaper, triggering 500s
    
    Reviewed By: mxw, mofarrell
    
    Differential Revision: D8057143
    
    fbshipit-source-id: ef5147141564134cda4e43afbc6512f2cc6b253b
  5. Instantiate generic condition type with Tany when checking if contain…

    vladima authored and hhvm-bot committed May 20, 2018
    …ing type is a subtype of condition type
    
    Summary: as in title: if condition type is generic we cannot specify type arguments in attribute so we'll instantiate generic condition type with Tanys
    
    Reviewed By: jamesjwu
    
    Differential Revision: D8069761
    
    fbshipit-source-id: 40c02b068e8e869b0301310972b94e09452fbae7
Commits on May 19, 2018
  1. Introduce __ReturnsVoidToRx

    vladima authored and hhvm-bot committed May 19, 2018
    Summary: This diff adds support for `__ReturnsVoidToRx` attribute which forces return type of the function to be `void` in reactive context. As a consequence methods annotated with this attribute are allowed to return mutably borrowed values (specifically `$this`) since rx caller will see return type as void and won't be able to use it.
    
    Reviewed By: KendallHopkins
    
    Differential Revision: D8038195
    
    fbshipit-source-id: b1903d08c9f2d8b8e4e73239646d2e6b0851890f
  2. Partition blocks by area_idx in layoutBlocks

    ottoni authored and hhvm-bot committed May 19, 2018
    Summary: Vtext was being passed to layoutBlocks so that pgoLayout could partition the blocks based on the code area pointed to by the block's area_idx. But pgoLayout is only used for optimized translations, for which the 3 code areas are always different. This diff changes the partition to be based on area_idx directly and drops the Vtext parameter.
    
    Reviewed By: paulbiss
    
    Differential Revision: D8023107
    
    fbshipit-source-id: 6dc1a29271421a89225df730e667e022d511bae8
  3. Make traits, interfaces, and enums unsealable

    kmeht authored and hhvm-bot committed May 19, 2018
    Reviewed By: DavidSnider
    
    Differential Revision: D8066088
    
    fbshipit-source-id: 58d744839efda2d3692da385d6934600e68c33c8
  4. Print CST search progress

    arxanas authored and hhvm-bot committed May 19, 2018
    Summary: This is easy to add as long as we're already logging CST search progress, and it helps to assure the user that we're actually making progress.
    
    Reviewed By: pittsw
    
    Differential Revision: D7914247
    
    fbshipit-source-id: 725c5dfa0e6b910ec1accc91c235d382e8387264
  5. Use the indexer to get the list of files to search

    arxanas authored and hhvm-bot committed May 19, 2018
    Summary: `file_infos` may contain files we don't care about or lack some files that we care about, so try to get a canonical list of files using the indexer instead.
    
    Reviewed By: pittsw
    
    Differential Revision: D7903886
    
    fbshipit-source-id: e41ba9a578a2963350100d62f4fac6e01d13219a
  6. Return kind and position of nodes rather than node content

    arxanas authored and hhvm-bot committed May 19, 2018
    Summary:
    The current output is the JSON-serialized version of the entire node. However, this isn't actually enough information to identify the node in its source file; it could be confused with any identical-content node. (This is especially common for `Missing` nodes.) Additionally, producing the entire node as output is too much output and takes too long on our codebase.
    
    Instead, just return the kind and offset range of the node. The kind is necessary in the event that one node contains another and it happens to have the same range. The offset range is inclusive on both sides.
    
    Reviewed By: pittsw
    
    Differential Revision: D7903885
    
    fbshipit-source-id: 6e32263f5eedd9324e49d3deab3a970b9e7f28f1
  7. Log when done building search indexes

    arxanas authored and hhvm-bot committed May 19, 2018
    Summary: I'd like to have an entry in the logs that indicates when we're done building search indexes, so that I can write an automated benchmark that isn't artificially slowed down because it's started its test before the Hack server is done building search indexes.
    
    Reviewed By: pittsw
    
    Differential Revision: D7884806
    
    fbshipit-source-id: 166fe87059672ebbc04e6322c1cf17c14f99e373
  8. Report exceptions

    arxanas authored and hhvm-bot committed May 19, 2018
    Summary: Theoretically, all errors should be threaded through in the form of a `result`, but just in case, we'll catch and log exceptions also.
    
    Reviewed By: pittsw
    
    Differential Revision: D7880329
    
    fbshipit-source-id: 3b99cbdd4976bb84efedc42d4c2b725099fbcbf9
  9. Support searching for raw text patterns

    arxanas authored and hhvm-bot committed May 19, 2018
    Summary: We can use this to match functions of a specific name, or to match specific operators (such as by matching binary expressions that have their operator's raw text be `+`).
    
    Reviewed By: pittsw
    
    Differential Revision: D7760889
    
    fbshipit-source-id: d7248c1f0a0f16def365a87ab9ff6bca58bd04fb
  10. Split Futures exceptions by Promise vs Future

    yfeldblum authored and hhvm-bot committed May 19, 2018
    Summary:
    [Folly] Split Futures exceptions by `Promise` vs `Future`.
    
    * Move `Promise` exceptions into the `Promise` header.
    * Move `Future` exceptions into the `Future` header.
    * Split `NoState` into `PromiseInvalid` and `FutureInvalid`.
    * Remove the newly-empty exceptions header.
    
    Reviewed By: andriigrynenko
    
    Differential Revision: D7966499
    
    fbshipit-source-id: 2dc6d2a941493979ebf47b3e70e5cf6a6fbd33cf
  11. Resolve type structure statically when possible for is/as irgen even …

    oulgen authored and hhvm-bot committed May 18, 2018
    …if it is partial resolution
    
    Summary:
    This diff adds static type structure resolution to is/as expressions at the irgen phase. Even if we only partially resolve the type structure, we still get a win from it.
    
    Difference from D7902884 (the one that got reverted):
    
    The default value for `persistent` is now set to `true` as if the value of `persistent` provided by the caller of `TypeStructure::resolve`, we can never set `persistent` to be true as we only manipulate is by `&=`. Hence, in this diff, we ignore the user provided value and always assume it is persistent and while we are resolving we can only unset persistent.
    Browsed through all the user sites of `resolve` and they all provide `true` anyway, so there should be no difference in behavior.
    
    This diff also takes a different approach from D7986890 where we inline invalid type detection to resolution phase.
    
    Reviewed By: markw65
    
    Differential Revision: D8038394
    
    fbshipit-source-id: cded851d7fdedaea4ebcd623d5a68ca709fc979f
Commits on May 18, 2018
  1. Explicitly trigger full checks in integration tests

    dabek authored and hhvm-bot committed May 18, 2018
    Summary:
    There is a pattern in integration tests -  whenever I want the server to perform a full recheck, I ask it for full error list (which immediately forces this recheck).
    
    I want to change the scheduling algorithm so that this will not be guaranteed (the request can be stored in environment to be handled later). I change the tests not to depend on this behavior.
    
    Reviewed By: jamesjwu
    
    Differential Revision: D8052008
    
    fbshipit-source-id: 1fb5ed9b65b6498c1e29b7d1054bbf55f8ffa19f
  2. Wrap continuations represeting client commands in try...with

    dabek authored and hhvm-bot committed May 18, 2018
    Summary:
    This is broken in a major way as of D7923599 and needs to be fixed before next release. Current trunk version has server die in some completely unnecessary situations (like doing Ctrl+C on a client before it received result). Sorry!
    
    I changed `ServerMain.handle_connection` to (possibly) return a continuation instead of handling the command. But there is a very important try-with inside `handle_connection`, that now can be avoided.
    
    I fix it here by wrapping the continuations in same try-withs.
    
    Reviewed By: jamesjwu
    
    Differential Revision: D8052005
    
    fbshipit-source-id: fcb8e90f5c6211afaeb60315bf4f319742246ddc
  3. Mock exceptional situations in ml integration tests

    dabek authored and hhvm-bot committed May 18, 2018
    Summary: As evidenced by me breaking it (see D8052005), it would be nice to add some testability to those scenarios.
    
    Reviewed By: jamesjwu
    
    Differential Revision: D8051990
    
    fbshipit-source-id: 8349e58da222a938fc2e6c0d6158726fa57a48bd
  4. Limit the scope of Nonfatal_rpc_exception try...with

    dabek authored and hhvm-bot committed May 18, 2018
    Summary:
    The intention of `Nonfatal_rpc_exception` is to silently ignore failures during handling of commands (because there is no need to drop everything on the floor if current “go-to-def” request ran into some edge case in parser and thrown an exception).
    
    I don't think we want to do the same thing for failures to `ping` client, or for `sending_responses` to client. There are other try-withs dealing with those.
    
    Reviewed By: jamesjwu
    
    Differential Revision: D8051984
    
    fbshipit-source-id: 6dc940cf6bd0334793339230b1c723c5861a1997
  5. Simplify InstanceOfIfaceVtable to InstanceOfBitmask when interface ha…

    ottoni authored and hhvm-bot committed May 18, 2018
    …s an instance bit
    
    Summary: I noticed opportunities for this when MethProfile decides to insert InstanceOfIfaceVtable checks.
    
    Reviewed By: swtaarrs
    
    Differential Revision: D8054947
    
    fbshipit-source-id: 4e66bb269ea99ac53a5596851f6e31aa18db8e61
  6. Use run_profile for everything, delete runner.py

    jamesjwu authored and hhvm-bot committed May 18, 2018
    Summary:
    This consolidates and makes some improvements:
    - Turns off env.codegen for benchmarking, as we are interested in hh_server
      perf and env.codegen is subtlely different
    - Measures time for run_profile for each file, so theres no reason for
      runner.py to exist anymore
    - Replaces runner.py with a call to run_profile in run
    
    Reviewed By: pittsw
    
    Differential Revision: D8044492
    
    fbshipit-source-id: 7806c3ea0f28d5215cda3c69b88439013ecb1ad9
  7. Refine types in as-expressions

    kmeht authored and hhvm-bot committed May 18, 2018
    Summary:
    This uses the same logic to refine types in as-expressions as we do for is-expressions. We extract `safely_refine_type` into a module-level function and reuse it when typing as-expressions.
    
    We also add some tests that display the nuance of this behavior, such as with wildcards and refinement of individual elements in tuples.
    
    Reviewed By: oulgen
    
    Differential Revision: D8045669
    
    fbshipit-source-id: 1505e3eccae2958b9dcc6c4dd6682dd88f70becc
  8. more detailed github issue template

    fredemmott authored and hhvm-bot committed May 18, 2018
    Reviewed By: kmeht, BobertForever
    
    Differential Revision: D8057707
    
    fbshipit-source-id: 59e32f00faa4228a19b24e125168dd66db3c8337
  9. Remove extraneous field in static type structure

    kmeht authored and hhvm-bot committed May 18, 2018
    Summary:
    In the static type structure generated for is/as expressions, we were adding an extra "typevars" field unconditionally. This is because
    - we added "HH\_" to the list of `tparams` for it to generate the generic kind properly
    - the `is_typedef` flag would add the "typevars" field if the `tparams` list was populated.
    
    In this diff, we forego any magic and hardcode the underscore as a type parameter. We also remove the `is_typedef` flag, because these anonymous type structures aren't typedefs.
    
    Reviewed By: oulgen
    
    Differential Revision: D8046819
    
    fbshipit-source-id: 547fb67425928c50ced53d81c460964f30b25d33
  10. Don't use instance bits for AttrNoOverride classes

    ottoni authored and hhvm-bot committed May 18, 2018
    Summary:
    We can check them efficiently via pointer comparison than via instance bits.
    This also frees instance bits for other classes.
    
    Reviewed By: paulbiss
    
    Differential Revision: D8050091
    
    fbshipit-source-id: 9a6fec751466307e3a6aae47b6f78209ccf5bdc5
  11. Use PGO for object-method calls in more cases

    ottoni authored and hhvm-bot committed May 18, 2018
    Summary:
    If the JIT knew an interface implemented by the object,
    it didn't profile the method dispatch (via MethProfile) to try to determine if a
    dynamic check could be used to emit a faster call.  This diff enables
    MethProfile and associated method-dispatch optimizations to be used in such
    cases for object-method calls.
    
    Reviewed By: markw65
    
    Differential Revision: D8022663
    
    fbshipit-source-id: adcb8b448f60644750436a590611a970dc63ad38
  12. Emit Hack Array Compat notices in is-expressions

    kmeht authored and hhvm-bot committed May 18, 2018
    Summary: To migrate away from `is_vec` and `is_dict`, we must preserve the notices emitted when they're passed varray/darray, respectively.  The heavy lifting was done in D7237938; we call in to the same functions and add an extra nullability check afterward if necessary. In HHBBC, we can only optimize away the bytecode if we know the types match; otherwise we might miss a notice.
    
    Reviewed By: viratyosin
    
    Differential Revision: D7994022
    
    fbshipit-source-id: 9367232161b70521bc7af08de3a36faeb295b6a2
  13. add support for logging fork calls in the hhvm main process

    dneiter authored and hhvm-bot committed May 18, 2018
    Summary:
    This diff logs following metadata for every forking call inside hhvm (fork, system, popen, posix_spawn, posix_spawnp):
    - which function is called
    - native stack trace
    - php stack trace (if available)
    - request host header (if available)
    - request url (if available)
    
    Reviewed By: binliu19
    
    Differential Revision: D8020936
    
    fbshipit-source-id: 516d51c63b1f46f74fe95a988898d4841f8493b8
  14. Remove extra data from unitcache

    oulgen authored and hhvm-bot committed May 18, 2018
    Summary: It appears that we dont actually need EvalIsExprEnableUnresolvedWarning in the unit cache as it is only altering JIT behavior.
    
    Reviewed By: alexeyt
    
    Differential Revision: D8047520
    
    fbshipit-source-id: cf79aae1393e8f22c7e134d16b0846745368f5fc
  15. Add proper hashing to ResolveTypeStructData and ExtendsClassData

    oulgen authored and hhvm-bot committed May 18, 2018
    Summary: as per title
    
    Reviewed By: markw65
    
    Differential Revision: D8043173
    
    fbshipit-source-id: 0ddccc66f4c50fec8ca0a30b3b0e3e1fdcc73155
  16. Simplify InstanceOf/ExtendsClass/InstanceOfIface to InstanceOfBitmask

    ottoni authored and hhvm-bot committed May 18, 2018
    Summary:
    InstanceOfBitmask is cheaper, so simplify these other instructions into
    InstanceOfBitmask if the rhs class has an instance bit.
    
    Reviewed By: markw65
    
    Differential Revision: D8031355
    
    fbshipit-source-id: e78af2657ac01f5a6f4514836a41424342dcf6fb
Commits on May 17, 2018
  1. Ban traits from implementing sealed interfaces

    kmeht authored and hhvm-bot committed May 17, 2018
    Summary: After speaking with dlreeves, we're gonna punt on allowing traits to implement sealed interfaces for now. HHVM should support it, because it models traits differently.
    
    Reviewed By: jamesjwu
    
    Differential Revision: D7863243
    
    fbshipit-source-id: 671dc88120b10d2a75cdff3a632250caa045361f