Commit Graph

1267 Commits

Author SHA1 Message Date
Alexander Aprelev 26e503612a [vm/sendport] Ensure that partially instantiated static closures keep types when sent over SendPort.
Fixes https://github.com/dart-lang/sdk/issues/43343.

Change-Id: If2a741ba9b13f7817ff765d83f3f5a920860cb9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163133
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-09-17 19:17:53 +00:00
Alexander Markov a53a66b7db [bots] Add pkg/vm_snapshot_analysis to vm-kernel fileset
pkg/vm_snapshot_analysis is used in
runtime/tests/vm/dart/v8_snapshot_profile_writer_test.dart
which can run on sharded bot configurations such as
dartkp-weak-asserts-linux-release-x64.

Change-Id: Ie843a38069394f42be79b432d8a71bbf6d472073
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159322
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-09-16 03:08:51 +00:00
Nicholas Shahan cdd1260ef0 [tests] Move regression test to run on all backends
This same error recently surfaced on a flutter web target.

Change-Id: If4c093cde85887105e93ab46469b1c3b2ea55d03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162243
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-09-14 21:13:37 +00:00
Tess Strickland 781094f2ce [vm/bytecode] Add parameter flags to FunctionDeclaration.
We create the parameter names array when loading the
FunctionDeclaration, but the required parameter flags are only set later
when we load the Code declaration. If there's an intermediate use of the
Function object that copies the required parameter flags, like creating
an ImplicitClosureFunction when loading a tearoff stored in the object
pool, there will be no set flags at that point.

Add a copy of the parameter flags to the FunctionDeclaration so the
required flags can be set at the same time as the parameter name and
type to avoid this scenario.

To avoid adding unneeded flags to the kernel bytecode, we only serialize
the parameter flags needed for each declaration, so FunctionDeclaration
and ClosureDeclaration only contain the required flag, and Code contains
all flags _but_ the required flag.

There are no trybots for strong mode + bytecode, but manually checked
by running the following on the main branch (cherry-picking the
test_matrix.json changes) and this branch:

python tools/test.py \
    -n dartkb-mixed-strong-linux-release-x64,dartkb-interpret-strong-linux-release-x64 \
    tests/language/nnbd/required_named_parameters/missing_required_argument_dynamic_test.dart

Cq-Include-Trybots: luci.dart.try:vm-dartkb-linux-release-simarm64-try,vm-dartkb-linux-release-x64-try
Change-Id: Ic75b831d5ceed08154e2c61b8f64461705558653
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162501
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-09-14 15:28:20 +00:00
Vyacheslav Egorov 62354c1540 [vm/arm64] Refactor leaf runtime call sequence.
Leaf runtime calls a silently clobbering R23 and R25 registers, which
causes bugs when these calls happen from write barriers (which are not
expected to clobber anything outside of R25).

We introduce a special helper class to handle saving and restoring
necessary registers.

The bug originally reported by Joe Lin <zuojian.lzj@alibaba-inc.com>
who proposed a fix[1]. This CL builds on top of that fix and tries to
make it more safe by forcing users to use a more strict API.

[1] https://dart-review.googlesource.com/c/sdk/+/162300

TEST=vm/dart/write_barrier_register_clobber_test

Change-Id: I93e0a13a3c4c38ad28210b35750a66e615e3e44a
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162191
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-09-11 07:37:51 +00:00
Alexander Aprelev a9ed5d1d1e [dart/sendandexit] Fix validation of the sendAndExit messages and the test.
The validation was not actually traversing the message and the test was not actually testing sendAndExit, rather standard message passing.

Brought error messages reported by sendAndExit in line with regular message passing error messages.

Bug: https://github.com/dart-lang/sdk/issues/43382

Change-Id: Iceb26ab9027a39e9eb3847b42a64ce991521578e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162249
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-09-10 18:33:37 +00:00
Aske Simon Christensen e0c9b5e45f [vm/aot/tfa] Group unboxing info via dispatch table selector IDs.
Also fix a copy/paste error in the unboxing metadata handling which
prevented setter parameters from being unboxed.

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

Change-Id: I0a37b432f15b34e50b4f60cefea774bacca174a5
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156915
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-08-27 11:00:27 +00:00
Vyacheslav Egorov ab591454c5 [vm/arm64] Fix optional parameters overflow
Functions with too many optional positional parameters were causing
an assertion failure in ARM64 backend because LoadIndexedUnsafe
we not taking large offsets into account.

ARM64 only gives 9 bits for encoding a negative offset while
ARM32 gave 12+1 bits for these offsets.

Closes https://github.com/flutter/flutter/issues/64526

R=kustermann@google.com

Change-Id: Ia49fd237f3fa8465b01f6dc4aabceef40c2fc256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160066
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-08-25 11:34:40 +00:00
Alexander Markov 5e551dd926 [vm/aot/tfa] Avoid stack overflow in TFA due to deeply nested calls
Issue: https://github.com/flutter/flutter/issues/63560
Change-Id: I995adf4c7ee17123f9a4979e07e651911c9577db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158720
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-08-19 18:39:27 +00:00
Ryan Macnak 4c3ae7bca6 [test] Fix URI parsing on Windows in incompatible_loading_unit_test.
The input is already a URI, not a path.

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I6f2ba57867c75ddedff99c5723207bf5fe6d37d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159180
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-08-18 22:26:00 +00:00
Ryan Macnak 56a4d7c5f8 [vm] Support --use_table_dispatch when splitting snapshots.
When reading a secondary snapshot, re-run the dispatch table initialization found in the root snapshot. Since each loading unit's contribution to the dispatch table is scattered, it would take more snapshot size to try to serialize their contributions separately. We'll revisit this when we can defer Class, Function and Code, which will prevent the root snapshot from referencing all Codes.

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Iefd2b98647b96ae59a7efe92897538f5cf8c2426
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158923
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-08-18 16:46:50 +00:00
Ryan Macnak 28ad17bee9 [gen_snapshot] Include library URIs in the loading unit manifest.
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Ifb7de4698563b5c1210d388bd3d069986fc0f541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158725
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-08-18 00:28:56 +00:00
Alexander Markov d77e4eb4d6 [vm/aot/nnbd] Fix class range 'is' tests for nullable types
Issue: https://github.com/flutter/flutter/issues/63819
Change-Id: I7d3fe2a3f6c40b4a5bae9b1ba3ab1dd36fab8f5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158800
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-08-17 17:07:09 +00:00
Tess Strickland 787446213c [vm/compiler] Move argument shape (not type) checks out of closures.
This CL performs the following checks in the invoke field dispatcher for
dynamic closure calls when lazy dispatchers are enabled:

* The provided function type arguments vector (if any) has the correct
  length.

* No function type arguments should be provided if the closure has
  delayed type arguments.

* All required arguments (positional in all modes, named in appropriate
  null safety modes) have been provided by the caller.

* If there are optional positional arguments, an appropriate number
  has been provided.

* If there are optional named arguments, their names are valid.

Since the runtime already handles checking the argument shapes when lazy
dispatchers are disabled, these checks are now completely removed from
closure bodies in all cases. Thus, the only remaining checks in closure
bodies are the type checks performed by AssertSubtype and
AssertAssignable when lazy dispatchers are enabled.

Changes in the Flutter Gallery:

* ARM7, release: -3.61% instructions, -2.19% total
* ARM7, sizeopt: -3.62% instructions, -2.55% total
* ARM8, release: -3.66% instructions, -1.98% total
* ARM8, sizeopt: -3.65% instructions, -2.37% total

Most of these changes are already exercised by existing tests such as
(but not limited to):

* corelib{,_2}/dynamic_nosuchmethod_test
* language{,_2}/call/call_test
* language{,_2}/closure/tearoff_dynamic_test
* language{,_2}/generic/function_bounds_test
* language{,_2}/parameter/named_with_conversions_test
* language{,_2}/vm/no_such_args_error_message_vm_test

I've added one test to specifically check the interaction between
dynamic calls and required named parameters. There is some coverage in
other NNBD tests, but those are not directly focused on testing this
specifically.

Other changes:

* Adds initial cached ranges for certain BinarySmiOp and ShiftIntegerOp
  instructions when the RHS is a constant, to avoid false negatives for
  deoptimization and throw checks prior to range analysis.

* Adds new slots for various Function fields.

* Adds the ability to define unboxed native slots, which are always
  unboxed after retrieval even in unoptimized code. In the first
  iteration, the backend only handles loads from Uint32 unboxed native
  slots. Part of https://github.com/dart-lang/sdk/issues/42793.

* Removed the special handling for loading from non-nullable int fields
  in AOT compilation. Instead, their treatment is unified with the
  treatment of the new unboxed native fields, since the source field is
  always unboxed and the result of the load is also always unboxed, as
  code involving them is always optimized.

Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: Ia02aa3e872c1fefd906fd67b55021ea1797556e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155604
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-08-17 08:58:08 +00:00
Ryan Macnak d8950da048 [vm] Fix --no-retain-function-objects when there are calls through Code.
With --no-use-bare-instructions or with splitting, not all calls are pc-relative. We must replace the Function with its Code in the static call table before detaching the Function's code as part of removing Function objects.

Also handle WeakSerializationReferences in AssignLoadingUnitsCodeVisitor.

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I29f9258c240f5a2b1b8dca52f74146dfe44d6401
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158165
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-08-13 17:01:24 +00:00
Ryan Macnak 91ed534139 [vm] Support --use_bare_instructions when splitting snapshots.
- Don't use PC-relative calls when calling between loading units.
 - Sort the contents of the code cluster by loading unit, then by text offset.
 - Handle binding PC-relatives calls and inserting trampolines per loading unit.
 - Create one code order table per loading unit to implement PC -> Code lookup.
 - Read code order tables directly, instead of copying into malloc'd memory.

--use_table_dispatch still not yet supported.

This slightly shrinks non-split binaries (~2% clustered part, 0.4% total snapshot) due to the new delta encoding when Code references Instructions.

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I51052ebc7b4968b554897d1710135a6c41821302
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157820
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-08-12 17:23:14 +00:00
Vyacheslav Egorov 3ebe4c534a [gardening] Mark regression test slow
TBR=sstrickl@google.com

Change-Id: I33ea1cd8fdf8607a81749785d06e004e77a686bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157740
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-08-07 10:25:07 +00:00
Vyacheslav Egorov 8835116b19 [vm/compiler] Fix Slot::cid_ type
Concrete cids are 16-bit unsigned values, but Slot::cid_ was erroneously
declared as a signed value - which causes issues in program with large
amount of classes once it flows into variables of larger signed types
(classid_t or intptr_t).

Fixes b/162922506

Fixed: 162922506
Change-Id: Id116273aa34dbf6886c352427cf4565fc5dc2293
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157487
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-08-07 07:24:44 +00:00
Ryan Macnak 9cb5d8e5be [standalone] Fix Isolate.spawnUri to work with AOT snapshots.
Fixes missing initialization of dart:_builtin during AOT.

Change-Id: If9f24f3658b91f490fc8215f2e9343bd437b2744
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156050
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-08-04 19:00:18 +00:00
Ryan Macnak 6b9b934d84 [vm, gc] Reduce growth rate as the heap size approaches --old_gen_heap_size.
Normally the heap grows in steps proportional to the size of the heap, so it grows faster the closer it gets to memory exhaustion.

The closer the heap size approaches --old_gen_heap_size, the less the heap will grow between GCs. This is useful on systems that respond to low memory conditions by killing processes instead of failing allocations. It is expected the asymptote will be chosen as some fraction of memory available from the OS (hundreds of MB on mobile).

Change-Id: I65cb4ab833e7a965595642312ce551719c0ade50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151635
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-08-03 17:47:11 +00:00
Martin Kustermann fd959b824e [vm/compiler] Graph intrinsify implicit getters/setters in common cases.
To make implicit getters/setters frameless in common cases we use graph
intrinsics. We do this for boxed as well as unboxed fields. We do this
only for simple cases (e.g. not if field guards or possible boxing are
involved).

It also removes the hand-written assembly intrinsics for the getters,
which avoids bugs if boxing-state of field is not the same as
boxing-state of setter/getter.

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

Change-Id: Id3bd7842ead0278fee61d4a21c8661ce18dbccee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155900
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-07-29 14:49:45 +00:00
Ryan Macnak fbc753337f [test] Skip scavenger_abort_test on AOT.
Bots seem much slower than local testing.

Change-Id: If5ce44a0b59b82c8651017f7efe810b8a4c65ef5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156052
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-07-29 00:36:55 +00:00
Ryan Macnak 5a085c6bcb [test] Prevent tree-shaking of fields in scavenger_abort_test.
Change-Id: I427987827200d9311ba94040d673e4d2a8e06d65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156049
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-07-28 21:57:51 +00:00
Ryan Macnak 19e6ae22b2 [vm, gc] Do not FATAL when the scavenger fails to allocate.
With the introduction of paged new-space, it became possible for the scavenger to fail to allocate if old-space could not grow and survivors did not pack after being reordered, and the scavenger would FATAL out. Long before that, the scavenger could fail to allocate the other semispace and FATAL out. Now an allocation failure causes the scavenge to abort, and partial forwarding to be reversed.

Change-Id: Idadfa4d9797aa7afce362bf70343e66b1b1dfeaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155683
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-28 19:42:09 +00:00
Clement Skau 6ca00d12c0 [VM] Adds Future.wait support for --lazy-async-stacks.
- Makes Future.wait a recognised function, and asserts its chained
future, _future is allocated at a known index in the context.
- Adds logic to locate, extract the chained future during lazy async
stack unwinding.
- Adds tests for the Future.wait async case.
- Minor consistency nits, comments.

This change is similar to a previous CL, adding Future.timeout support:
https://dart-review.googlesource.com/c/sdk/+/152328

Change-Id: I7439750968595d25d7bbac0068ad64fcc891e176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155420
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-28 05:41:01 +00:00
Johnni Winther 37c8c709bf Move BytesBuilder class and implementation to dart:typed_data.
Change-Id: Ic4fe1944ef4af19732f23c389845b6a74af0bc32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154682
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-24 11:37:21 +00:00
Alexander Markov 3350455f97 [tests/nnbd] Pass null safety options to gen_kernel in vm tests
runGenKernel helper function now passes all null safety options to
gen_kernel tool implicitly, so callers don't bother.

runGenKernelWithoutStandardOptions helper is added in case those
options should not be passed (e.g. for null safety autodetection test).

This change fixes vm/dart/minimal_kernel_test and
vm/dart/bytecode_and_ast_mix_test tests (with null-safe package:path).

Change-Id: I772f715c1c84362f8a1c96e6f77cb8423f6743ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155066
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-21 03:38:24 +00:00
Ryan Macnak c5a94db091 [vm] Initial implementation of deferred loading.
(Assignment of libraries to loading units is already done in the kernel generation step.)

After compiling and before serializing, we walk the program and for each Code we assign its Instructions, CodeSourceMap and CompressedStackMap to the loading unit of that Code's defining library. Deduplication may cause Instructions, CodeSourceMaps and CompressedStackMaps to belong to more than one loading unit; in this case the objects are assigned to the root loading unit. Later they can be more precisely assigned to the dominating loading unit.

All objects except some Instructions, CodeSourceMaps and CompressedStackMaps belong to the root loading unit's snapshot. This snapshot is written like an unsplit snapshot, except that when serializing Code, we will write a reference to a stub or null when the Code's Instructions, CodeSourceMap or CompressedStackMap belongs to a non-root loading unit. The snapshots of non-root loading units contain these deferred objects and references to the corresponding Code objects to patch. The types of objects we defer (Instructions, CodeSourceMaps and CompressedStackMaps) usually represent 70+% of the snapshot size.

Bare instructions mode must be disabled when splitting because we cannot have PC-relative calls between loading units. Later we can re-enable this for calls within loading units.

Broken: Compactor probably crashes we can now have an unbounded number of image pages and the compactor assumes a fixed number.

Embedder's guide:

At compile-time, gen_snapshot should be passed --loading_unit_manifest with a path, which will enable splitting and output a mapping from loading unit ids to snapshot output paths.

At runtime, sometime during isolate startup, an embedder should call Dart_SetDeferredLoadHandler, probably near an existing call to Dart_SetLibraryTagHandler. The callback is given a loading unit id, and should eventually call Dart_DeferredLoadComplete[Error].

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Ib597eb87c8cd634416d5ee1f00629c5550aebb00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152427
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-07-17 19:29:47 +00:00
Martin Kustermann b425ef8413 [vm/compiler] Do not try to optimize Float{32,64}List if we do not support unboxed doubles (i.e. --no-use-vfp)
Issue https://github.com/dart-lang/sdk/issues/42745

Change-Id: I63d70a0954aa06b5e4e6f7cfd9fee9d3a847f45a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154696
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-07-17 18:10:16 +00:00
Ryan Macnak 3844e74adb [vm, compiler] Fix bypassed EnsureIsNewOrRemembered in CreateArrayInstr slow path.
If inline bump-pointer allocation fails, allocation stubs must check whether the allocation result from the runtime is old and ensure it is in the remembered set if so to make write barrier elimination safe. CreateArrayInstr would directly call the runtime entry if inline bump-pointer allocation failed without performing the remembered check. This CL changes the slow path to call the AllocateArray stub instead, matching every other allocation slow path.

Bug: https://github.com/dart-lang/sdk/issues/42489
Change-Id: Ic502e43683607e1d0f85154f0e3a8c3ea11deefa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154623
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-16 20:52:54 +00:00
Martin Kustermann f955b82a92 [vm/compiler] Support unboxing of return values of getters
This CL adds support for unboxing of return values of getters and
therefore completes the work on unboxing support for normal members
(closures are still missing).

As with existing unboxing support for methods and setters, we utilize
TFA information to proof a getter will always return non-nullable
int/double.

We then make such a getter return unboxed int/double. If there are
dynamic calls to the getter a dyn:get:* forwarder will be created
which performs boxing of the return value.

Overall this reduces RX by eliminating BoxInt64 instructions. It
sometimes increases metadata due to more dyn:get:* function objects.

=> On our main size benchmark targets show no significant change.

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

Change-Id: If7450ef7e5e3fc9c2e0eaa6b86ffa817699a7e17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154329
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-07-16 20:26:04 +00:00
Martin Kustermann 90bba3ae27 [vm] Ensure SDK hash is correctly embedded for CFE and other tools that produce Kernel
The missing --short=10 was causing (depending on git version and
configuration) us to sometimes default to using '0000000000'.

Furthermore the build rules were missing two places where -Dsdk_hash has
to be set.

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

Change-Id: I83dbfcce677e2594074c1139093bd9592d4fa3ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154684
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2020-07-16 18:43:24 +00:00
Alexander Markov 0ac6ce5f9d [vm/aot/nnbd] Avoid deduplicating mixins with different NNBD modes
CFE adds signature members to classes based on the NNBD mode of
an enclosing library, so identical anonymous mixin applications
in libraries with different NNBD modes could end up being different.

This change fixes mixin deduplication transformation to take
NNBD mode of anonymous mixin applications into account.

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

Change-Id: Ib83ae55f8193177012fa1a592fecf381ca8fdbff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154164
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-14 18:27:10 +00:00
Aske Simon Christensen b6d14a940a [gardening] Import NNBD version of FFI in NNBD thread_pool_test.
Change-Id: Ia44c34915939dff338f50e7b765f47a66a9bbe09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153961
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2020-07-10 12:41:37 +00:00
Alexander Markov 6f6b1f8818 [vm] Rename --null-safety option to --sound-null-safety
Deprecated option --null-safety still remains in order to allow
graceful migration.

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

Change-Id: Ie47b1bebc9dd6532658a60743ecb85dc7fdc108c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153660
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-09 01:37:23 +00:00
Clement Skau 219935a48f [VM] Adds Future.timeout stack unwinding support for --lazy-async-stacks.
Bug: https://github.com/dart-lang/sdk/issues/40815
Change-Id: I1603e1effe67b727d5dc47c0830b4758c764cf4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152328
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-08 06:50:40 +00:00
Clement Skau 494d261a41 [Test] Skips sdk_hash_test for unsupported dartkp-android.
This fixes the currently red CI bot:
vm-kernel-precomp-android-release-arm64 / dartkp-android-release-arm64

Change-Id: I583c59595d029a59e823f62824082982e51f6182
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153350
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-07-07 10:45:59 +00:00
Clement Skau 0ce83987d6 Reland "[SDK] Adds an SDK hash to kernels and the VM."
Note: This is a reland of https://dart-review.googlesource.com/c/sdk/+/150343

Adds a new SDK hash to kernels and the VM which is optionally checked
to verify kernels are built for the same SDK as the VM.
This helps catch incompatibilities that are currently causing
subtle bugs and (not so subtle) crashes.

The SDK hash is encoded in kernels as a new field in components.
The hash is derived from the 10 byte git short hash.

This new check can be disabled via:
  tools/gn.py ... --no-verify-sdk-hash

This CL bumps the min. (and max.) supported kernel format version,
making the VM backwards incompatible from this point back.

This also bumps the min. and current ABI version.

Bug: https://github.com/dart-lang/sdk/issues/41802
Change-Id: I2f85945045a603eb9dcfd1f2c0d0d024bd84a956
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152802
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-07 06:08:20 +00:00
Clement Skau 3dec28a20c [VM] Enables --lazy-async-stacks for Precompilation (AOT).
This change applies to stand-alone Dart.
Many other embedders (e.g. Flutter) have this already enabled.

Benchmarking shows improvements:
- Isolate.SendReceiveBytes.. +15-50%
- Calls.Await.. -35-90%
- FileIO_read.. +15-20%

Change-Id: I20cc74d9cafcda47d70fb0cf10d9e15d7cdb0bbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153144
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-03 13:05:27 +00:00
Clement Skau 3cde9904d9 [SDK] Fixes lint errors in vm.status
This was fixed by running:
  dart pkg/status_file/bin/normalize.dart \
      -w runtime/tests/vm/vm.status

The linter can be run to verify the result:
  tools/sdks/dart-sdk/bin/dart \
      pkg/status_file/bin/lint.dart \
      runtime/tests/vm/vm.status

Change-Id: I99d35f900b2d4ff5c6da332ed8fe347e2a7ac96d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153204
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-07-03 11:06:20 +00:00
Martin Kustermann 35398a2fef [gardening] Disable vm/cc/CodeExecutability on system/architectures where --dual-map-code is not supported
This test flakily times out on MacOS (the FATAL(),  which calls abort(),
somehow is stuck) and spams the flakiness dashboard.

Though the test shouldn't even run on MacOS, since we don't support
--dual-map-code on non-linux/fuchsia.

Change-Id: I6a93b825c3021028a43b46a8bf33f84e34838211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153142
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-07-03 08:59:00 +00:00
Martin Kustermann fdeb01897f [vm] Ensure a switchable callsite never looses knowledge of it being dyn:* during transitions
Issue https://github.com/dart-lang/sdk/issues/42517

Change-Id: I6fb414740b59f7f710fba10c27c126997a4346b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152847
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-07-01 19:53:34 +00:00
asiva bb8d145616 Revert "[SDK] Adds an SDK hash to kernels and the VM."
This reverts commit edde575dcd.

Reason for revert: Breaks the Dart to Flutter roll and golem

Original change's description:
> [SDK] Adds an SDK hash to kernels and the VM.
>
> Adds a new SDK hash to kernels and the VM which is optionally checked
> to verify kernels are built for the same SDK as the VM.
> This helps catch incompatibilities that are currently causing
> subtle bugs and (not so subtle) crashes.
>
> The SDK hash is encoded in kernels as a new field in components.
> The hash is derived from the 10 byte git short hash.
>
> This new check can be disabled via:
>   tools/gn.py ... --no-verify-sdk-hash
>
> This CL bumps the min. (and max.) supported kernel format version,
> making the VM backwards incompatible from this point back.
>
> Bug: https://github.com/dart-lang/sdk/issues/41802
> Change-Id: I3cbb2d481239ee64dafdaa0e4aac36c80281931b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150343
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,jensj@google.com,cskau@google.com

Change-Id: I34cc7d378e2babdaaca4d932d19c19d0f35422fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/41802
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152703
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-06-26 18:54:17 +00:00
Clement Skau 411c9cc992 [Test] Skips sdk_hash_test for incompatible setups.
Change-Id: Ib46814516085a5332538ca867caccb61313b8c1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152655
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-06-26 17:27:08 +00:00
Clement Skau 1a278118dd [Test] Fixes sdk_hash_test broken by Windows line breaks.
Change-Id: I4e87b39515e1e99197f7b03759234252b8cfa233
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152653
Auto-Submit: Clement Skau <cskau@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-26 15:00:52 +00:00
Clement Skau edde575dcd [SDK] Adds an SDK hash to kernels and the VM.
Adds a new SDK hash to kernels and the VM which is optionally checked
to verify kernels are built for the same SDK as the VM.
This helps catch incompatibilities that are currently causing
subtle bugs and (not so subtle) crashes.

The SDK hash is encoded in kernels as a new field in components.
The hash is derived from the 10 byte git short hash.

This new check can be disabled via:
  tools/gn.py ... --no-verify-sdk-hash

This CL bumps the min. (and max.) supported kernel format version,
making the VM backwards incompatible from this point back.

Bug: https://github.com/dart-lang/sdk/issues/41802
Change-Id: I3cbb2d481239ee64dafdaa0e4aac36c80281931b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150343
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-26 13:35:42 +00:00
Martin Kustermann 53807c1d79 [vm] Remove ARMv6 related code
This also allows unaligned access, since it's mandatory for ARMv7 (we
already take advantage of it for ARMv8).

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

Change-Id: I0bd61a930e61dea330ab21fd187fe64b057ca28e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152322
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-06-26 09:39:15 +00:00
Alexander Markov 993af42292 [vm/aot] Fix crash in AotCallSpecializer due to unreachable code
Fixes https://github.com/dart-lang/sdk/issues/42202

Change-Id: Id7ab1ceb5c7e8400f10d883bfbc9333e9e25e6c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152620
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-06-26 01:16:13 +00:00
Alexander Markov 1003d3fc36 [vm/nnbd] Test for type casts with null-safety auto-detection
Issue: https://github.com/dart-lang/sdk/issues/41206
Change-Id: Ia07f5aeb518991016bc5f5a1df670bfa9617b0ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144495
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-06-23 22:54:35 +00:00
Tess Strickland 4d2b3b9084 [gardening] Fix changed package path for v8 snapshot profile analysis.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: Iac9ffdcea30f70dcd91f4f646b28750fea3c6713
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152140
Commit-Queue: Tess Strickland <sstrickl@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-06-23 18:20:03 +00:00