Commit graph

67301 commits

Author SHA1 Message Date
Samir Jindel 63d3012e68 [vm/ffi] Deprecate Pointer.allocate/free.
Fixes https://dart-review.googlesource.com/c/sdk/+/118442.

Also updates untested sample code in samples/ffi.

Change-Id: Id40a7b8fbb35c5d989269646ebb22864cebcfcac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118441
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-10 13:17:43 +00:00
Jens Johansen 18aed26e83 [frontend_server] Wire up incremental serializer into frontend server / package VM
Change-Id: I4d8dbc2d9b0915c654eccae9e35357d7ec9fa13d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120787
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-10 11:39:06 +00:00
Samir Jindel 5b4c930272 [vm/ffi] Document FFI static checks.
Change-Id: I6e8bcfe8b8ad19726f5ccf9b64b3b45eec2d33ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120793
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-10-10 11:05:06 +00:00
Martin Kustermann 109e7b0786 [vm] Ensure the new arm_x64 architecture will get $builder_tag == crossword set
This will cause status file entries such as

    [ $arch == arm || $arch == arm64 || $builder_tag == crossword || $compiler != dartkp ]
    dart/v8_snapshot_profile_writer_test: SkipByDesign

to correctly skip tests which shouldn't run in crossword configurations.

Issue https://github.com/dart-lang/sdk/issues/38783

Change-Id: I30082549e98107a7b3aac79837aeba5b5853df46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121062
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2019-10-10 11:00:58 +00:00
Martin Kustermann 628e0434bd [vm/ffi] Enable analyzer on ffi test suite
Issue https://github.com/dart-lang/sdk/issues/35777

Change-Id: Ia8edd9901d52e671a116c7747319fdadd7da4681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121060
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-10-10 10:38:36 +00:00
Martin Kustermann 1dbfd1f6bc [vm/ffi] Add high memory test running in 32-bit configurations
Issue https://github.com/dart-lang/sdk/issues/37251
Issue https://github.com/dart-lang/sdk/issues/38789

Change-Id: I80b117fa190673400bdf13264ea292444c369ee1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120960
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-10-10 09:43:27 +00:00
Johnni Winther 0ee78fac98 [cfe] Rename declaration.dart and procedure_builder.dart
to builder.dart and function_builder.dart to reflect their primary content.

Change-Id: Ib0f9c2970b6a88e4381b0cd7532e4410b72c2a2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120791
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-10-10 08:11:27 +00:00
Martin Kustermann f6477854cd [vm/aot] Do not generate monomorphic prologue for functions which need args descriptor
Functions which have optional parameters or which are generic need the
arguments descriptor to be passed. Since switchable call-sites do not
populate the arguments descriptor, such functions are always called via
a stub (i.e. the switchable calls transition never to monomorphic
state).

There is therefore no reason to generate the monomorphic prologues for
those functions.

Flutter Gallery size impact:

  armv8: -0.31% RX
  armv7: -0.226% RX

Change-Id: I7d6b554cbcdc90b85a278487c5541fed4e64b5bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120961
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-10-10 07:14:07 +00:00
Sam Rawlins 7b9a26ee6f NNBD i13n: ctor nav targets and details w/o targets
* NavigationTargets which are ConstructorDeclarations should point to the
  constructor's name or its return type for unnamed constructors.
* Details which don't included useful targets, like "this parameter is
  optional and has no default value", should just have detail descriptions,
  but not be links.

Change-Id: I3562bb708c40aa1fcf1de5df5519f1f4037517cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120761
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-10 05:30:07 +00:00
Ryan Macnak 48e93d3d3b [vm, linux] Try to attach names to all VirtualMemory allocations using memfd.
For example,

$ cat /proc/<pid>/smaps
...
7fe527158000-7fe527be0000 rw-s 00000000 00:05 35765318                   /memfd:dart-profiler (deleted)
7fe527be0000-7fe527ea5000 rw-s 00000000 00:05 35765317                   /memfd:dart-timeline (deleted)
7fe528a40000-7fe528a51000 rw-s 00000000 00:05 35762832                   /memfd:dart-heap (deleted)
...

Change-Id: I10452a1261cec26719ceadf569aadd864be5378e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120981
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-10-10 00:49:41 +00:00
Alexander Markov f72445a6fc [vm,aot,bytecode] Fix type arguments offset in simarm-x64
Bytecode flow graph builder incorrectly used kWordSize (instead of
compiler::target::kWordSize) when calculating offset of type arguments
field in a class.

Change-Id: I79c8e6bf66dfb2cf4dbe4bd36d060f52728d0a18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120980
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-09 23:41:50 +00:00
Ryan Macnak 71ecb73a2b [vm] Fix one MSAN failure; add UBSAN configuration.
Change-Id: I5b1d43836f3eb09983195fc3792f369aa3f8079f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120750
Reviewed-by: Chinmay Garde <chinmaygarde@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-09 23:38:30 +00:00
Nicholas Shahan 50d972bba0 Build DDC targets with forked SDK sources when building with --nnbd flag
Issue: #38665

Change-Id: I42eb4e97f3269f7d1a53abeac62f9293a003ae60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120400
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2019-10-09 23:24:21 +00:00
pq 795949de00 fix loopVariable null access
See: https://github.com/dart-lang/linter/issues/1759

Addresses Object.noSuchMethod:

00:53 +313 -3: rule dart (config: nnbd) omit_local_variable_types [E]
  NoSuchMethodError: The getter 'declaredElement' was called on null.
  Receiver: null
  Tried calling: declaredElement
  #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
  #1      ResolverVisitor.visitForStatementInScope (package:analyzer/src/generated/resolver.dart:3993:30)
  #2      ScopedVisitor.visitForStatement (package:analyzer/src/generated/resolver.dart:5477:7)
  #3      ForStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:4772:49)
  #4      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7682:20)
  #5      BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1115:17)
  #6      ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4286:10)
  #7      UnifyingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:3128:31)
  #8      ScopedVisitor.visitBlock (package:analyzer/src/generated/resolver.dart:5187:13)
  #9      BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1111:49)
  #10     BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1070:13)
  #11     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4286:10)
  #12     UnifyingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:3131:55)
  #13     ScopedVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:5198:13)
  #14     ResolverVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:3522:13)
  #15     BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1066:49)
  #16     FunctionExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:5088:12)
  #17     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4286:10)
  #18     UnifyingAstVisitor.visitFunctionExpression (package:analyzer/dart/ast/visitor.dart:3263:57)
  #19     ScopedVisitor.visitFunctionExpression (package:analyzer/src/generated/resolver.dart:5524:13)
  #20     ResolverVisitor.visitFunctionExpression (package:analyzer/src/generated/resolver.dart:4050:13)
  #21     FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:5082:49)
  #22     FunctionDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:4941:26)
  #23     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:4286:10)
  #24     UnifyingAstVisitor.visitFunctionDeclaration (package:analyzer/dart/ast/visitor.dart:3256:59)
  #25     ScopedVisitor.visitFunctionDeclarationInScope (package:analyzer/src/generated/resolver.dart:5517:11)
  #26     ResolverVisitor.visitFunctionDeclarationInScope (package:analyzer/src/generated/resolver.dart:4025:11)
  #27     ScopedVisitor.visitFunctionDeclaration (package:analyzer/src/generated/resolver.dart:5510:7)
  #28     ResolverVisitor.visitFunctionDeclaration (package:analyzer/src/generated/resolver.dart:4016:13)
  #29     FunctionDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:4934:49)
  #30     ResolverVisitor.visitCompilationUnit (package:analyzer/src/generated/resolver.dart:3608:23)
  #31     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2140:49)
  #32     LibraryAnalyzer._resolveFile (package:analyzer/src/dart/analysis/library_analyzer.dart:680:10)
  #33     LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:151:7)
  #34     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
  #35     LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:150:11)
  #36     LibraryAnalyzer.analyze.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:113:14)
  #37     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
  #38     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:112:43)
  #39     AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1261:63)
  #40     PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
  #41     AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1237:20)
  #42     AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:548:41)
  <asynchronous suspension>
  #43     LintDriver.analyze (package:analyzer/src/lint/analysis.dart:220:32)
  <asynchronous suspension>
  #44     DartLinter.lintFiles (package:analyzer/src/lint/linter.dart:87:36)
  <asynchronous suspension>
  #45     testRule.<anonymous closure> (file:///Users/pquitslund/src/repos/linter/test/rule_test.dart:262:54)
  <asynchronous suspension>
  #46     Declarer.test.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:168:27)
  <asynchronous suspension>
  #47     Invoker.waitForOutstandingCallbacks.<anonymous closure> (package:test_api/src/backend/invoker.dart:242:15)
  <asynchronous suspension>
  #48     _rootRun (dart:async/zone.dart:1124:13)
  #49     _CustomZone.run (dart:async/zone.dart:1021:19)
  #50     _runZoned (dart:async/zone.dart:1516:10)
  #51     runZoned (dart:async/zone.dart:1463:12)
  #52     Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:239:5)
  #53     Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:166:33)
  #54     _rootRun (dart:async/zone.dart:1124:13)
  #55     _CustomZone.run (dart:async/zone.dart:1021:19)
  #56     _runZoned (dart:async/zone.dart:1516:10)
  #57     runZoned (dart:async/zone.dart:1463:12)
  #58     Declarer.test.<anonymous closure> (package:test_api/src/backend/declarer.dart:165:13)
  <asynchronous suspension>
  #59     Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:392:25)
  <asynchronous suspension>
  #60     new Future.<anonymous closure> (dart:async/future.dart:176:37)
  #61     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
  #62     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
  #63     _rootRun (dart:async/zone.dart:1120:38)
  #64     _CustomZone.run (dart:async/zone.dart:1021:19)
  #65     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
  #66     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
  #67     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
  #68     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
  #69     _rootRun (dart:async/zone.dart:1124:13)
  #70     _CustomZone.run (dart:async/zone.dart:1021:19)
  #71     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
  #72     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
  #73     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
  #74     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
  #75     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)




Change-Id: I15b2298f88ee986475736807ef8fd15133e18472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120928
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-10-09 23:02:40 +00:00
Alexander Markov 62ee78eeec [vm,bytecode] Generate calls for causal-async-stacks more consistently
In order to support causal-async-stacks, the following synthetic calls
are inserted: _asyncStackTraceHelper, _setAsyncThreadStackTrace and
_clearAsyncThreadStackTrace.

_asyncStackTraceHelper is always generated in the async transformation.
_setAsyncThreadStackTrace and _clearAsyncThreadStackTrace are inserted
during bytecode generation (or in the flow graph builder in case of AST
pipeline). If bytecode generation options are set inconsistently with
--causal-async-stacks VM option, then it was possible that
_asyncStackTraceHelper was generated but other calls were not generated,
causing incorrect (full, non-truncated) async stack traces. This also
causes performance regression as collecting full stack traces takes
much more time.

This change makes generation of all these calls more consistent: if
causal async stacks are disabled during bytecode generation, then all
three calls are omitted. Also, in case these calls were generated and
present in bytecode, but VM option --causal-async-stacks is disabled,
then bytecode flow graph builder turns all these three calls into no-ops.

Change-Id: I93eb1d83c675ee093799bb8e37ca3d60a3c5c19d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120927
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-10-09 22:10:21 +00:00
Ryan Macnak f4f0831c69 [vm] Fix TSAN failures related to object headers and GC task phases.
Change-Id: I15078e845712e8e712e2cb0a044fc7550127ea36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120629
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-10-09 21:48:20 +00:00
Paul Berry 164e11b542 Prepare to publish analyzer_plugin version 0.2.1.
Change-Id: If363a80390fdde940cf4421f992c28ae0861a82a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120931
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-09 21:48:10 +00:00
jonahwilliams cc3e22f724 [flutter] expose dartdevc target to incremental compiler
Doesn't do anything with the new target, but establishes a public API for dev_compiler (at least within the SDK)

Change-Id: I4c86b890d3993f96cf32ed0f749608a72a173da6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119526
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-10-09 20:02:42 +00:00
Zichang Guo 8866cdb8be [vm] throw exception if directory buffer overflows on Windows
According to https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-readdirectorychangesw,
When using ReadDirectoryChangesW, buffer overflows will still return true. It ends up closing the stream without any notification.
Throw an exception to notify users.

Bug: https://github.com/dart-lang/sdk/issues/37233
Change-Id: I9aebed8b1f30b5e843ad37a51b87d234aa1d8ce6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119524
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-10-09 19:59:52 +00:00
Johnni Winther 72bae7be70 [cfe] Handle all bounds checks on extension methods.
Closes #38755

Change-Id: I3d5449950ecb3268436a3033ae16bac590a1e4b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120790
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-10-09 19:50:02 +00:00
Martin Kustermann 55d1c95e08 [vm] Fix instruction deduplication for bare-AOT mode
Though we disable deduplication for instance methods because switchable
calls rely on a unique PC -> Code mapping atm.

Change-Id: I80915e97f5e06c3f1251ea3176d5c4f8413a81ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120041
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-10-09 19:45:42 +00:00
Alexander Markov 3bb32f6778 [vm/bytecode] Generate complex conditions more efficiently in bytecode
Change-Id: I7cbf3a91dc96843f10af9560a58269badbe31bac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109729
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-09 19:32:54 +00:00
Devon Carew 50d6a3d022 [analyzer] move the ml model from sdk/model to sdk/bin/model
Change-Id: I64aad93770c5c0870c1a5052bb5a1192738f1cf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120901
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Ari Aye <ariaye@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2019-10-09 19:26:34 +00:00
Nate Bosch 2ffdc54d24 Handle exported extensions in dill library builder
- Add a modular test to demonstrate the bug.
- Handle `Extension` nodes in `finalizeExports`.

Change-Id: Ie16f0c97059d24a122150a607e26fba258d80cfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120926
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2019-10-09 18:48:54 +00:00
Paul Berry 89301c3732 Flow analysis: fix tests to pass the correct value to ifStatement_end.
The tests were passing by luck.

Change-Id: I1b44c6d675b59c84e6a6bd70741462d6f29c51e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120922
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-09 18:24:08 +00:00
Paul Berry 88b76997c4 Flow analysis: rework handling of closures.
Rather than suppress all promotions for variables written to in
closures, we track whether a closure might exist that captures a write
to a variable, and only suppress promotions once such a closure
exists.  This is consistent with what is proposed in
https://github.com/dart-lang/language/pull/473.

Contains a repro of #38791.

Change-Id: I4683581908703b510a3231b8fa8ed697121b09da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-09 18:24:08 +00:00
Ari Aye 4227933c3a Disallow model-only suggestions if static analysis suggests a named argument
Bug: https://github.com/dart-lang/sdk/issues/38404
Change-Id: I72b505cb5bee1f463c0ec6b0a1e9e60c5b7ea518
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117767
Commit-Queue: Ari Aye <ariaye@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-09 18:13:48 +00:00
Ryan Macnak 4f752e6598 Reapply "[vm, bytecode] Use CoreTypes and ClassHierarchy from non-incremental front end results when generating bytecode."
Account for null result from kernelForProgram.

Change-Id: Ia4349c68ce023a5714752bf3294ab1e293b1d409
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120749
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-09 18:09:58 +00:00
Paul Berry 144b8eda81 Flow analysis: track variables captured in closures more accurately.
Previously, we considered a variable to be captured by a closure if a
write to that variable occurred anywhere inside a local function.  But
that was overly broad; it meant that we incorrectly classified all
written-to local variables of a local function to be captured.

This CL makes the AssignedVariables logic aware of variable
declaration sites, so that it only considers a variable to be captured
if it is written to at a lower level of local function nesting than
its declaration.  As a side bonus, it means that it can now exclude
out-of-scope variables from all sets of closed-upon and written-to
variables, which should make flow analysis faster by preventing it
from spending a lot of time accounting for variables that aren't
visible.

It also adds tracking of the set of all variables written to and
captured within each top level function.

This partially reverts commit 55466fd3cc.

Change-Id: Ibcd6476445addebed13cfc5ecc470d644e519148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-10-09 17:34:51 +00:00
Paul Berry 63b93685e9 Migration: change EdgeBuilder to create flow analysis for each variable declaration.
There's no good reason to unify the flow analysis for several
variables declared together, and it would break some assertions I'm
going to add to flow analysis in future CLs.

Change-Id: I4dafb7b5e9b078cb741d506cd0bbfab1bcab5ebb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120840
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-09 17:34:51 +00:00
Paul Berry 2f1e430646 Flow analysis: track assigned variables separately for each top level declaration.
In a follow-up CL, I'm going to add logic to track the complete set of
assigned and captured variables seen so far.  We will need these sets
in order to properly cancel promotions on entry to a closure or nested
function.  But for performance reasons we don't want these sets to
include all variables seen in the entire file; just the local function
is sufficient.

Change-Id: I32a42075916be791f2fb7798814cec4c020e8b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120751
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-10-09 17:34:51 +00:00
Ben Konyi f5ce3a6e7f [ VM / Compiler ] Fixed issue where TMP was being used as source for store with large offset on ARM
While emitting code for a ParallelMove on ARM32, the TMP register was
being used as a dest/src. When the stack slot offset is large,
StoreToOffset creates a new base in TMP in order to use a smaller
offset. Since the ParallelMove implementation was hardcoding TMP as the
dest/src register, the assert that the register != TMP failed with large
offsets. Now we instead perform a check to see if the offset will fit to
determine whether or not we can use TMP or if we need to fall back and
use LR as our temporary (we can do this since we're in the middle of a
ParallelMove).

Fixes https://github.com/dart-lang/sdk/issues/38654

Change-Id: I4d8cc8b54f6090d86992aabb8ff44d088bc02d3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119584
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-10-09 17:06:00 +00:00
Brian Wilkerson 091568dcc9 Rework the way tag insertion works to allow nested tags and multiple tags for the same region
Change-Id: I8f014fe7bdae72c21d5df4f5e45169c610df632e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-10-09 16:25:30 +00:00
Jens Johansen 41d13f0ffe [CFE] Cleanup unused parts in uriToSource
Change-Id: Ie26fb25a0394999df1c681296ef96a90d51d8c13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120789
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-09 13:28:12 +00:00
Jens Johansen f09edd1d32 [CFE] Add incremental serializer
Add an incremental serializer that can be used to avoid re-serializing
the same thing again and again.
It does this by grouping libraries into Components / bundles,
serializing them individually and using the concatenated dill feature to
output the wanted data --- just potentially faster if we had the data
in cache.

Note that the serialized output might contain *more* than the input given
if we cached the wanted data into a bigger bundle.
The output will always be "closed" though, i.e. if the stuff that is
included that is too much added a new dependency, that dependency will be
included as well.
This should generally make it safe, although one can imagine situations
where it could pull in lots of dependencies that it wouldn't otherwise
have.

It is being driven by the incremental compiler which makes sure to
invalidate the cache when the data changes.

Except for situations where the libraries are changed externally after
being serialized, but before being serialized again, where one then wants
the updated library serialized, the feature should be safe.

Change-Id: I2a504abe6dbb68434c3b04abff13480ef72a6a6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120786
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-09 13:28:12 +00:00
Daco Harkes ff23f546db [vm/ffi] Work around dartdoc crash to fix API doc generation
Issue: https://github.com/dart-lang/sdk/issues/38786

Change-Id: Ida4bb78da1aabdf6da259e0d66840d9db4b1428d
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120788
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-09 12:37:52 +00:00
Alexander Thomas 7a6e62332f [co19] Prepare to roll from pre-nnbd branch
The master branch in the co19 repository is now the NNBD fork. For the
time being, we want to roll the legacy variant into co19_2. At a later
stage, we will also depend on the NNBD fork, but it will likely be a
different suite.

Change the script to use dart/try rather than the legacy bucket format.

TBR=whesse@google.com

Change-Id: I9b43d9d4a49f2cfd16b8be9cca025c6d750cf2bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120781
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2019-10-09 10:36:57 +00:00
Alexander Thomas 8e33090fd0 [co19] Roll co19 to a8f7aa15ab860a309667168243bda01fda0794df
From this roll on forward, co19_2 is tracking the pre-nnbd branch rather than the master branch in
the co19 repo. The master branch (the NNBD fork of co19) will be re-introduced as a different suite
later.

Issues reported:
https://github.com/dart-lang/co19/issues/492 (ShortCircuitOperators_A01_t12 test is wrong)
https://github.com/dart-lang/co19/issues/493 (ShortCircuitOperators_A04_t27 has a syntax error)
https://github.com/dart-lang/co19/issues/494 (ShortCircuitOperators_A03_t12 is an invalid test)

2019-10-04 irina.arkhipets@gmail.com Issue 490: useless constant-update-2018 option removed from the tests.
2019-10-04 irina.arkhipets@gmail.com Issue 490: useless constant-update-2018 option removed from the tests.
2019-10-04 sgrekhov@unipro.ru Fixes 484. Use floating point value which decimal part
2019-10-04 sgrekhov@unipro.ru Fixes 486. Fix test expectations (method call has higher priority than unary minus)
2019-10-04 sgrekhov@unipro.ru Fixes 483. Use List instead of Iterable
2019-10-04 irina.arkhipets@gmail.com Issue 485, 488: test expectations corrected.
2019-09-30 irina.arkhipets@gmail.com Issue 477: More tests for constant short circuit operations added.
2019-09-30 irina.arkhipets@gmail.com Issue 477: More tests for constant short circuit operations added.
2019-09-25 irina.arkhipets@gmail.com Issue 481: Test expanded into A Function(Null) instead of A Function(A) by the instantiate-to-bound algorithm.
2019-09-23 irina.arkhipets@gmail.com Issue 477: tests for Constant-2019-update added.
2019-09-19 sgrekhov@unipro.ru Fixes 480. Use '==' for checking actual type
2019-09-17 irina.arkhipets@gmail.com Issue 477: tests for Constant-2019-update added.
2019-09-17 irina.arkhipets@gmail.com Issue 477: tests for Constant-2019-update added.
2019-09-17 sgrekhov@unipro.ru NNBD tests removed from this legacy branch
2019-09-16 irina.arkhipets@gmail.com Issue 477: tests for short circuit operators added.
2019-09-13 sgrekhov@unipro.ru 466. Subtyping tests for NNBD added.
2019-09-12 sgrekhov@unipro.ru 466. Subtyping tests for NNBDc. Copyright year updated
2019-09-12 sgrekhov@unipro.ru 466. Subtyping tests for NNBDc. Right Object tests added
2019-09-11 sgrekhov@unipro.ru 464. Added tests for legacy type fields
2019-09-11 irina.arkhipets@gmail.com Issue 465: tests for Generics in NNBD added.
2019-09-10 irina.arkhipets@gmail.com Issue 465: test for Generics in NNBD added.
2019-09-10 sgrekhov@unipro.ru 466. Subtyping tests changed according to NNBD spec
2019-09-09 sgrekhov@unipro.ru 466. Subtyping tests changed according to NNBD spec
2019-09-06 irina.arkhipets@gmail.com Issue 465: tests for Generics in NNBD added.
2019-09-06 sgrekhov@unipro.ru More tests for type Never
2019-09-05 irina.arkhipets@gmail.com Issue 465: tests for Generics in NNBD added.
2019-09-05 sgrekhov@unipro.ru Fix using and checking of Never
2019-09-04 sgrekhov@unipro.ru Fixes 464. Legacy-libraries tests added
2019-09-04 irina.arkhipets@gmail.com Fixed Issue 460: tests for Null promotion added, typos corrected.
2019-09-02 sgrekhov@unipro.ru Fixes 458. More null-aware operators tests
2019-09-02 sgrekhov@unipro.ru Fixes 459. Late fields and variables test added
2019-09-02 sgrekhov@unipro.ru 459. Late fields and variables tests added
2019-08-30 sgrekhov@unipro.ru 459. Late fields and variables tests added
2019-08-29 sgrekhov@unipro.ru 459. Late fields and variables tests added
2019-08-29 sgrekhov@unipro.ru 389. Fixed static warnings processing
2019-08-28 sgrekhov@unipro.ru 458. Null-aware operators tests added
2019-08-27 sgrekhov@unipro.ru 458. Null-aware operators tests added
2019-08-27 sgrekhov@unipro.ru Removed covariant final member
2019-08-27 sgrekhov@unipro.ru Typo and order of modifiers fixed
2019-08-23 sgrekhov@unipro.ru 461. A couple of NNBD nested nullable types tests added
2019-08-23 sgrekhov@unipro.ru 389. NNBD static errors tests. Some tests fixed, several tests added (mainly for legacy libraries)
2019-08-23 sgrekhov@unipro.ru Fixes 389. A couple of legacy types tests added
2019-08-23 sgrekhov@unipro.ru Fixes 461.Conditional expression ambiguities tests added
2019-08-23 sgrekhov@unipro.ru 461. Add nested nullable types tests
2019-08-23 sgrekhov@unipro.ru Fixes 475. Modifier 'late' must be before 'final'
2019-08-22 sgrekhov@unipro.ru 389. NNBD static errors tests. Fixed work with legacy libraries and new tests added
2019-08-22 sgrekhov@unipro.ru 461. NNBD syntax tests added for required and null-aware selector

Change-Id: Icd4d0c536f0091100aa0276ff5b836b16db0ff35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120782
Reviewed-by: William Hesse <whesse@google.com>
2019-10-09 10:36:35 +00:00
Jens Johansen 6ebf3f0889 [kernel] Clear a few lists when loading dill
Prior to this change, loading the sdk dill twice for instance would
result in additional exports as well as parameter counts doubling,
essentially destroying the result.

Change-Id: I4d694bec1926d6df6572e9bb36e8a88ec0822e27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120785
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-09 10:34:07 +00:00
Aske Simon Christensen d1124c3b2b [CFE] Fail at runtime when a const constructor redirects to a non-const
If a const constructor redirects to a non-const constructor, report a
compile-time error (no change here).

At runtime, a const instantiation will result in an invalid expression,
whereas a non-const (explicit or implicit new) instantiation will
work normally.

Closes https://github.com/dart-lang/sdk/issues/23622

Change-Id: Ief0e9c62fb8de34203df49fd862f20aba41a3cde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120042
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-09 10:18:37 +00:00
Jens Johansen 05f56ef160 [kernel] Fix printing of additional exports
Change-Id: I65ee82646555cd31eccad33e3a125f0ef2af3a35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120784
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-09 10:10:33 +00:00
Jens Johansen e7a128ecc2 [CFE] Refactor incremental compiler test(s)
Change-Id: I538d5bb5f50af2409d0c99e8ab15b803b9e10fc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120783
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-09 10:10:32 +00:00
Johnni Winther 46a9273664 [cfe] Opt in to NNBD using experimental flag _and_ version number
+ add testing of nnbd types and opt-out in static_types_test

Closes #38287

Change-Id: I019753a74cdc6980dadb0608f7ac486c127af6f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120666
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-10-09 08:43:03 +00:00
Alexander Aprelev cee3f71e29 [build] Advise ninja to ignore out-of-date .lib files.
MSVC won't update .lib file if there were no changes, and this restat attribute tells ninja to honor that.

Change-Id: If78184aecf13578617570478cbf158276981e25d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120747
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-10-09 03:16:50 +00:00
asiva b12bed36a8 [VM] Implement isExtensionMember in MethodMirror and VariableMirror
Added ability to recognize a MethodMirror to be a mirror of an extension member
Added ability to recognize a VariableMirror to be a mirror of a static
extension field.

Change-Id: I56715a491bba0d8cafb2796ebb755bd339e147c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120760
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-10-09 00:27:30 +00:00
Ryan Macnak 5092b8ef82 Revert "[vm, bytecode] Use CoreTypes and ClassHierarchy from non-incremental front end results when generating bytecode."
This reverts commit f2c882bd87.

Reason for revert: batch mode failures

Original change's description:
> [vm, bytecode] Use CoreTypes and ClassHierarchy from non-incremental front end results when generating bytecode.
> 
> Change-Id: I9a8b2530009ff6cc6880ee177a6bee4bb9101e82
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120626
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com

Change-Id: I8ea8e155af0d2a4c4382107d723f7bf8a50dc3d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120748
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-09 00:21:14 +00:00
Brian Wilkerson 9ababcf650 Improve message for overriding methods
Change-Id: I6fed64a852f94f2323972f511be4015a22fb4ebd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120746
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-10-09 00:12:50 +00:00
Alexander Markov 2ca6bc29b3 [vm,bytecode] More efficient bytecode for calls through fields/getters
Previously, calls through field/getter were generated as dynamic calls
because InterfaceCall with field/getter target doesn't correctly
represent what such call should do. This results in a quite inefficient
code in AOT mode.

With this change, calls through fields/getters are decomposed into two
calls, while keeping the same order of evaluation.

Change-Id: Ieb33927c1b39d1b4d8eafb7bd542675820474068
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120628
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-10-08 22:27:10 +00:00
Régis Crelier 735d8b7c64 [VM/nnbd] Propagate nnbd flag on Library from kernel to VM and bytecode.
Also fix a few obsolete comments.

Change-Id: Ice4d36abb950575316db02c3dad2b94a505d7e0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120743
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-08 22:25:20 +00:00
Ryan Macnak f2c882bd87 [vm, bytecode] Use CoreTypes and ClassHierarchy from non-incremental front end results when generating bytecode.
Change-Id: I9a8b2530009ff6cc6880ee177a6bee4bb9101e82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120626
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-08 21:58:30 +00:00