Only check for if-case is implements for now.
Change-Id: I57d1b8b33fbe2bf7adc848b5d607ff99b878b479
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This changes the VM patch files to use parts explicitly, making
handling of patch libraries similar to regular libraries.
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Change-Id: I6280d62edba3d12a1f77ae6a7f64e1e9b5d18227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224949
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
There is no need to put data into local variables, and invoke
something for the InterfaceType. We can call it directly at the end
of each branch.
Change-Id: Iee0d2304fb45b526604f2c6bd6a81363820d5909
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262103
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This CL adds an interactive command line tool to analyze
heapsnapshots generated by the Dart VM.
The tool works by operating on sets of objects. It supports operations
like users, transitive closure, union, ...
An example usage that loads snapshot, finds all live objects, finds
the empty lists in them and prints retainers of the empty lists:
```
% dart bin/explore.dart
(hsa) load foo.heapsnapshot
(hsa) all = closure roots
(hsa) stat all
size count class
-------- -------- --------
43861 kb 8371 _Uint8List dart:typed_data
...
-------- -------- --------
108904 kb 400745
(hsa) empty-lists = dfilter (filter all _List) ==0
(hsa) empty-growable-lists = filter (users empty-lists) _GrowableList
(hsa) retain empty-growable-lists
There are 5632 retaining paths of
_GrowableList (dart:core)
⮑ ・UnlinkedLibraryImportDirective.configurations (package:analyzer/src/dart/analysis/unlinked_data.dart)
⮑ ﹢_List (dart:core)
⮑ ・...
```
For now the tool lives only in dart-lang/sdk.
TEST=pkg/heapsnapshot/test/*_test.dart
Change-Id: I671c2e3ca770e1a5aa3e590e850a5694070b4c3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261100
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Makes `Dart_Handle` FFI returns behave as the following snippet:
```
Dart_Handle ExampleSnippet() {
Dart_Handle result;
if (Dart_IsError(result)) {
Dart_PropagateError(result);
}
return result;
}
```
Also makes FFI consistent with Dart_NativeFunctions, which will
automatically throw upon return if Dart_SetReturnValue set the result
to an error.
`UnhandledExceptions` cannot flow out into Dart generated code. So,
the implementation needs to be in `FfiCallInstr::EmitNativeCode`.
Using `Dart_IsError` is slow compared to a machine code class id
check. So, we should do the handle unwrapping and class id check in
machine code.
Unwrapping Handles in machine code is only safe when the GC is
guaranteed to not run: Either (1) in `kThreadInGenerated`, or (2) in
`kThreadInNative`, but only when transitioned into safepoint. So, the
handle cannot be unwrapped immediately after the FFI call in machine code. We first need to transition back to generated.
This means we need to transition again to native to do the actual
`Dart_PropagateError` call. We can do so without the stub in JIT
because we never return with normal control flow.
Performance impact of this change is within benchmark noise in both
JIT and AOT.
Size impact is 42 bytes on x64, which is 10% in AOT and 12% in JIT.
For more numbers see: go/dart-ffi-handle-error
TEST=runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
TEST=tests/ffi/vmspecific_handle_test.dart
Closes: https://github.com/dart-lang/sdk/issues/49936
Change-Id: Ie8fabeb6d53bc80689541bc4470cb37ee2200581
Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261603
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Previously, when the migration tool needed to change one type variable
to another during a substitution, it created a DecortedType to
represent the substitution using
`DecoratedType._forTypeParameterSubstitution`. This was problematic
because the resulting DecoratedType had a null nullability `node`.
This in turn forced nearly every reference to `DecoratedType.node` to
be followed by a `!` operator.
With this change, we now have a new base class, `SubstitutedType`,
which can either be a `DecoratedType` (representing a fully general
substitution) or a `_TypeVariableReplacement` (representing a simple
change from one type variable to another). This paves the way for a
follow-up CL that will make `DecoratedType.node` non-nullable.
Change-Id: I7fdaef57994c7678ecd517ab4fe84d00f0d81424
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261941
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
These linker flags are causing issues with the Dart->Flutter roll,
and so I'm removing them for now until we can figure out how to
reintroduce them later.
To avoid overwriting section contents, even at a much reduced
amount, I also reland the clang DEPS revert in CL 256208.
TEST=pkg/dartdev/test/commands/compile_test
Bug: https://github.com/flutter/flutter/issues/112687
Change-Id: I35d3ff6a2a0a46e2f589469fb47bca5f9ca6df1d
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262161
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Add RecordType to the dart2js DartType hierarchy.
The RecordShape is made explicit so that processing the record type usually means processing the list of field types.
This pattern of shape + combined-fields will be used elsewhere, e.g. constants.
Filled out some uses of ir.RecordType until it gets converted to a dart2js DartType.
Change-Id: I6aa4d4a920cbb0e4f37e7079bc4d9d10e366a849
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261581
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Looks like we might need a feature to cause record fields to be suggested
before Object members. Hard to say though without tests. Anyway, that's
a task for another CL.
Change-Id: I123d6953b1ed10ac926885ce2b1a4d5926a908ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262024
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
DDC:
Adding return types avoids casts on the returned values and
using JS foreign functions avoids the cast when setting the
value during truncation as well as avoiding the extra
method dispatch for setting and getting elements.
Dart2js:
Updated the return types for consistency but the dynamic
return type was already being inferred to avoid casts.
Change-Id: Ic9abaffd8dee3d12793d5083c78d35a9ada47527
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261787
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
dartdoc (62bc150..866338f):
866338f1 2022-09-29 Sam Rawlins Bump to 6.1.2 (#3198)
html (8243e96..faafebf):
faafebf 2022-09-29 Devon Carew Merge pull request #188 from dart-lang/update_readme
d27b898 2022-09-29 Devon Carew Merge pull request #189 from dart-lang/update_ci
5a0be75 2022-09-29 Devon Carew update to our current CI best practices
4185afd 2022-09-29 Devon Carew add markdown badges to the readme
intl (5464b3b..7639a15):
7639a15 2022-09-27 Nate Bosch Simplify the IntlStream class (#494)
a4b44a9 2022-09-27 Lasse R.H. Nielsen Cleanup of `var this.`, dynamic parameters, and more (#497)
mime (0a75a41..bf041aa):
bf041aa 2022-09-26 Devon Carew update action versions; add dependabot config (#69)
usage (e287a72..9a98c89):
9a98c89 2022-09-29 Devon Carew whitespace change to the LICENSE file (#182)
cf284c7 2022-09-29 Kevin Moore analysis options and lint cleanup (#183)
Change-Id: I0a6bd0de7bc75cd84b20e1de6f0463544ac68a70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262020
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
...while it is still an experiment.
Change-Id: Ib606a3c099b45343686b8e921c0aa1c24dec59da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
I also noted how many ParserErrorCodes are 'needsEvaluation'
Change-Id: I487976c918038903ef49a87a3cb97d1af2327398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Fixes failing post-submit Windows tests,
and causes the examples/api IDE navigation results to return absolute paths.
Change-Id: If6d1ca9848644b78ff6f8e9549b84df7139b7ffc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261801
Auto-Submit: Greg Spencer <gspencer@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
+ convert LSP folding tests to use TestCode parser.
A change in VS Code means two folding regions are no longer allowed to end/start on the same line (the second range is silently dropped). This truncates folding regions if they end on the same line that another starts to end on the line before (but only if a client only supports line-folding mode).
Fixes https://github.com/Dart-Code/Dart-Code/issues/4121.
Change-Id: Ic26f58f84c44a01ae5157c336ed0f207d1c0eeb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Moves `RangeCheck` from the intrinsifier to the assembler.
Also, unifies the signature and semantics and adds documentation.
TEST=refactor
Change-Id: I274e5e46fde6a6e8baf30d8b732932f4f46d5855
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simriscv64-try,vm-kernel-precomp-linux-debug-simriscv64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261681
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This CL changes the import uri of a patch library builder to be its
file uri. This makes patch libraries more like regular libraries,
preparing for full support for patch parts.
Change-Id: I1fa4c10998f17945d6607e1307337b5f66992c3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224947
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This comment was relevant in a previous revision of the patterns
parsing logic and I neglected to revert it.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: Ia4034d66c3cc354e2ea6f2e1485380bccf7333dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
`internal/patch.dart` is changed to be an actual part of
`dart:_internal` and backends are changed to all use the `patch`
constant from `dart:_internal` in `@patch` annotations.
This is done in preparation for changing the import uri of a
patch library builder to be its file uri, with which the
`internal/patch.dart` part can no longer declare itself as
`part of 'dart:_internal';` through a patch library.
Change-Id: I884e939d4a56782e64fb527cdf900769c2b2fcfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224946
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
The original code assumed that only the initial symbol in the
dynamic symbol table had an empty name, and so any symbol with an
empty name was checked as if it was the initial symbol.
However, it turns out that in at least one case on our testing
infrastructure, the assembler generates a dynamic symbol with an
empty name.
Thus, we change the test to check the initial symbol separately
from the rest of the symbols in the symbol table.
TEST=vm/dart{,_2}/use_add_readonly_data_symbols_flag
Bug: https://github.com/dart-lang/sdk/issues/50071
Change-Id: Ie5d443ee2a45f8fb3400955d8bdfb3e726ab028a
Fixed: 50071
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261820
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
To create a Dart standalone executable on MacOS, we modify the
dartaotruntime executable to add the snapshot contents, and the
VM looks into the executable on disk to find the snapshot to load.
Previously, we did this by adding a new 64-bit segment load command
with a single section, where the section's file offset and size
describes the inserted snapshot. This meant the Mach-O header size increased by 152 bytes.
Originally, this wasn't an issue as there was plenty of padding, but
later clang updates removed most of this padding, and so writing the
new header actually overwrote the initial contents of the first section
in the file, which happens to be the __text section. In addition, since
the first section's offset was now declared to be within the header,
utilities that strictly validated the Mach-O format, like codesign,
would report errors.
This CL changes it so that we actually reserve space in the
dartaotruntime header using the -add_empty_section flag to the linker.
In addition, we change from using a segment load command to using a
(40 byte) note load command. This is because a segment load command
specifies that the contents should be loaded in memory, but we don't
use that loaded version. Instead, the VM reloads it from the executable
on disk so it can appropriately mmap the different parts of the
snapshot. A note section instead just declares a section of the
executable as arbitrary data that the owner can read from the file
and use as desired, which is semantically closer to our current usage.
This CL also adds a test to pkg/dartdev/test/commands/compile_test to
ensure that corrupting a random part of the snapshot in the executable
causes signature verification to fail.
This CL also reverts CL 256208, thus relanding the clang changes
starting from June that originally raised awareness of the issue by
greatly reduced the amount of padding after the load commands.
TEST=pkg/dartdev/test/commands/compile_test
Bug: https://github.com/dart-lang/sdk/issues/49783
Change-Id: Iee554d87b0eabaecd7a534ca4e4facfefbce6385
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260108
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This change is a small incremental step, but should allow us to delete
the public NoSuchMethod constructor in dart:core. The change simply creates
a private constructor in the dart2js patch file and uses that instead.
https://github.com/dart-lang/sdk/issues/49529
Change-Id: I51cb2ec3b7f169a6cb831e753a3e5e9bf0752dbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260940
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>