Commit Graph

18413 Commits

Author SHA1 Message Date
Daco Harkes e7acc69507 [vm/ffi] Support packed Structs backend - part 2
With packed structs, the x64 non-Windows ABI only put structs in CPU/FPU
registers when all it fields happen to be aligned. The previous CL did
not check the alignment of nested structs and structs in inline arrays
based on their offset in an outer struct.

Follow up of: https://dart-review.googlesource.com/c/sdk/+/186142.
Split off: https://dart-review.googlesource.com/c/sdk/+/186143.

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

tools/build.py run_ffi_unit_tests && tools/test.py ffi_unit
TEST=runtime/vm/compiler/ffi/native_type_test.cc
These tests are exercised on vm-precomp-ffi-qemu-linux-release-arm-try.

Change-Id: Ic64bdef2c13ac737dbf58864911f043fc7a3d831
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191720
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-03-19 15:34:42 +00:00
Tess Strickland 6d1ea68cc9 [build] Move from the C++11 to the C++17 standard.
Also includes some example changes using C++14/C++17 features.

TEST=vm/cc/BitField_Assert

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,dart-sdk-win-try,vm-kernel-win-release-x64-try,vm-kernel-win-release-ia32-try,dart-sdk-mac-try,vm-kernel-mac-release-x64-try
Change-Id: Icf5c5267431daf9cea2e61b67131021557675f3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192183
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-03-19 15:29:57 +00:00
Martin Kustermann caa31f55be [vm/compiler] Make codegen of InstantiateTypeArgumentsInstr sharable
Simplifies work for adding deopt info to this IR instruction.

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

TEST=Existing test suite.

Change-Id: Ia0936647f8f025397131b6d89764885a79cba9c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192185
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-19 15:04:37 +00:00
Martin Kustermann 3930eb8fce [gardening] Mark class as entrypoint to preserve name in obfuscation mode
Fixes https://github.com/dart-lang/sdk/issues/45385

TEST=Fixes service/allocation_test in obfuscation mode.

Change-Id: I80ac204866c5224cf88d2f5f2079655e224691c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192143
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-03-19 13:15:29 +00:00
Tess Strickland d504084f42 [vm] Fix uses of NullIsAssignableTo at runtime.
NullIsAssignableTo only takes the type to check for nullability.
However, while a type parameter may itself be non-nullable, its
instantiation with a nullable type is nullable.

Thus, this CL adds type instantiation before runtime uses of
NullIsAssignableTo in Function::DoArgumentTypesMatch.

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

TEST=vm/dart/regress_45270

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try
Change-Id: Iaefffe9ab6d4d3ad889c4962489b2153d2bbaee1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190443
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2021-03-19 12:29:27 +00:00
Johnni Winther 9ad76fe7bd [cfe] Support annotations on function type parameters
The fix includes processing of type parameters elsewhere and also
adding support for annotations on extensions.

Closes #28981

TEST=existing

Change-Id: I71ab5640bd3a16f4a024b6edd047a525eed1c399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191404
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-19 11:52:57 +00:00
Alexander Markov c665bac02d [vm/compiler] Follow-up to SupportsUnboxedInt64 cleanup
This is a follow-up to https://dart-review.googlesource.com/c/sdk/+/191761.
That change removed FlowGraphCompiler::SupportsUnboxedInt64() which is
always true, but incorrectly changed

  return (compiler::target::kSmiBits >= 32) ||
         FlowGraphCompiler::SupportsUnboxedInt64();

to

  return (compiler::target::kSmiBits >= 32);

in CanUnboxInt32(). That resulted in a performance regression on
golem benchmarks as certain methods were not inlined.

This change cleans up CanUnboxInt32() as it is also always true.

TEST=Manually verified one of the benchmarks on IA32.

Change-Id: I9fd72f3adc27e2e31340559cf79df1701bd98da7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192062
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-03-19 03:56:14 +00:00
Martin Kustermann dbd2c76e22 [vm/compiler] Remove InstanceOf runtime call from IL instruction, call stub instead
Having pushed arguments inside generated code makes deopt environments
incorrect, so we'll move all runtime calls out of IL instructions into
stubs.

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

TEST=Existing test suite.

Change-Id: I843ba1ba626c3d704d75d4a7088752100ddfb906
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191900
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-03-19 03:53:24 +00:00
Ryan Macnak da5fa77042 [vm] Avoid populating page table entries for the compressed heap up front.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/45331
Change-Id: I1bb8e7ea3fce88dceb28edf8a81cee48db83f144
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191982
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2021-03-18 23:04:14 +00:00
Ryan Macnak 19e5899a02 [vm] Switch most non-Instances to compressed pointers.
The following are not compressed: Code, ObjectPool, Context, CallSiteData and subclasses.

Code::instructions_ is uncompressible because the VM doesn't control the address of Instructions when they are loaded via dynamic library.

Loads from the ObjectPool are a frequent occurrence in generated code, and shrinking ObjectPool entries would be offset by longer code sequences to decompress them. Also, some ObjectPool entries contain uncompressible pointers to C functions.

Context is not compressed based on reports from earlier work on compressed pointers that compressing them is disproporately bad for performance. The earlier work used a different, more-expensive compression scheme, so we should reinvestigate this.

CallSiteData et al. are on the hot path for unoptimized code but make up a comparatively small portion of the heap size.

TEST=ci
Change-Id: I9a425fa4e12113c9fd0b51999525d32a7e589a90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190600
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2021-03-18 22:52:04 +00:00
Ryan Macnak c5eaf317b6 Revert "[vm, compiler] Convert binary Smi ops to graph intrinsics."
This reverts commit 051ec30ff0.

Reason for revert: Failures on ARM32 AOT

Original change's description:
> [vm, compiler] Convert binary Smi ops to graph intrinsics.
>
> Keep left shift as an ASM intrinsic because it includes fallbacks to Mint operations on 32-bit architectures that graph intrinsics aren't good at expressing.
>
> This should be close to neutral on performance, but removes a fair amount of redundant code.
>
> TEST=ci
> Change-Id: Ic9c7d3b2d015ebf31972163a58c6bc9a27bad4ca
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187164
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I2a08df5b4aa0269a6237a3d967729c155c88a1c7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192061
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-03-18 22:11:56 +00:00
Ryan Macnak 051ec30ff0 [vm, compiler] Convert binary Smi ops to graph intrinsics.
Keep left shift as an ASM intrinsic because it includes fallbacks to Mint operations on 32-bit architectures that graph intrinsics aren't good at expressing.

This should be close to neutral on performance, but removes a fair amount of redundant code.

TEST=ci
Change-Id: Ic9c7d3b2d015ebf31972163a58c6bc9a27bad4ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187164
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-03-18 20:33:34 +00:00
Ryan Macnak 08295a8cb3 [vm, compiler] Consider T{_IntegerImplementation} as equivalent to T{int} for optimization purposes.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/45297
Change-Id: Ic6a8956ad6344058c480e20018e876f5aae4c610
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191662
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-03-18 17:59:03 +00:00
Alexander Markov 817582a155 [vm/compiler] Cleanup --no-unbox_mints flag and SupportsUnboxedInt64()
Unboxed int64 are supported on all architectures which Dart VM supports.
The only was to disable support for unboxed int64 is to use
--no-unbox_mints flag, which is not used and not tested.
This change cleans up this flag and corresponding compiler predicates.

TEST=ci

Change-Id: Ib667319eaf87f0ded8bf9d9505272a3693a9e63e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191761
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-18 17:49:28 +00:00
Tess Strickland 5fc2ba5fc4 [platform] Adjust Utils::StringHash() for misaligned starts.
Fixes https://github.com/dart-lang/sdk/issues/45290

TEST=vm/cc/StringHash

Cq-Include-Trybots: luci.dart.try:vm-kernel-ubsan-linux-release-x64-try,vm-kernel-precomp-ubsan-linux-release-x64-try
Change-Id: I7c1ef59cece77c6c9b705116e956e945bfcb55d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190882
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-18 17:42:53 +00:00
Daco Harkes fbaf439b75 [vm/ffi] Fix ScopeBuilder uninitialized read
Closes: https://github.com/dart-lang/sdk/issues/45362

TEST=MSAN build

Change-Id: Ic51eba97b94656e75261001134e75db2fd2e352d
Cq-Include-Trybots: luci.dart.try:vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191882
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-03-18 12:37:48 +00:00
Alexander Aprelev 7b94d56d67 [observatory] Provide isolate for send data events because observatory expects it for write events.
_ConsoleStreamPrinter::onEvent expects isolate on WriteEvent. It's absence causes exceptions in Observatory. This started with https://dart-review.googlesource.com/c/sdk/+/190303

TEST=updated capture_stdio_test with isolate expectations; run observatory to ensure to exceptions are generated

Change-Id: I73efe9c1ab5b0d779d9432fd64ad5ccc5fcc14ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191661
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-03-17 23:30:47 +00:00
Ryan Macnak 2e56467afb [vm, compiler] Unpredicate boolean loads on x64.
This reverts part of c9e10c931c, which Golem reports as negative for Xeon.

Generate dist8 branches for these cases.

TEST=ci
Change-Id: I77432e478c0d3a46868a530a2d75036994c8809e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191469
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-17 22:59:07 +00:00
Alexander Markov bed0589676 [vm] Fix access to parameters in async closure body inside field initializer
For async closure parsed_function_ could be an outer function
which is unrelated to the closure. So, ScopeBuilder should not
attempt to mark parameters of parsed_function_ with
set_is_forced_stack() if it sees kSyncYielding FunctionNode.
Parameter variables might not be even allocated if
async closure is used inside an instance field initializer
and parsed_function_ is a constructor.

TEST=runtime/tests/vm/dart/regress_45306_test.dart
Fixes https://github.com/dart-lang/sdk/issues/45306

Change-Id: I1b0082cb0e217039c43f19b35d77190493069edc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191325
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-03-17 19:17:05 +00:00
Alexander Aprelev 4baf7e5e3d [vm/concurrency] Introduce GroupDebugger that takes CodeBreakpoints management away from isolate Debugger.
CodeBreakpoint class tracks patching of the call targets for the purpose of routing the call to the debugger runtime.
With this CL CodeBreakpoint instance is managed by GroupDebugger, debugger class owned by IsolateGroup, and can be associated with multiple BreakpointLocation, one location per isolate that set a breakpoint at particular code location.

TEST=observatory/tests/service/break_on_function_child_isolate_test

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

Change-Id: I3b3d0974a0fb9668742e5c1e2a2ce13b84b1d630
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190732
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-17 18:03:14 +00:00
Martin Kustermann 4c0edc6720 [vm] Extend BitField class to allow storing negative numbers by sign-extending when decoding
Will be used to encode deopt-id (which can be -1) into bit field.

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

TEST=Newly added vm/cc/BitFields_SignedField.

Change-Id: I537820d813a191006388b8bfc08a3bac6f23f79f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191360
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-03-17 15:27:32 +00:00
Martin Kustermann df439941e4 [vm/compiler] Change various allocation fast paths to check for --use-slow-path and --no-inline-alloc
This will allow future tests to force allocations to go to runtime. This
will be used to test deoptimization on allocation slow paths.

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

TEST=Existing test suite.

Change-Id: I0d552c2b313147ce08c5fbb22761a400388abe7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191043
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-03-17 14:49:42 +00:00
Martin Kustermann 26f0eba03b [vm/compiler] Make AssertSubtypeInstr always call stub - including on ia32
This simplifies the code and makes it easier for later work
related to lazy-deopt of the instruction when returning from
runtime call.

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

TEST=Existing test suite.

Change-Id: I056baac434532d3ed034ba488252ed0ff77eb488
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191041
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-03-17 13:16:49 +00:00
Martin Kustermann 0834f9b7ac [vm/compiler] Move runtime call out of InstantiateTypeInstr to stub
This simplifies the code and makes it easier for later work
related to lazy-deopt of the instruction when returning from
runtime call.

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

TEST=Existing test suite.

Change-Id: I72e72554bdc306a9490a1460927d1dd650bfbe7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191040
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-03-17 13:08:01 +00:00
Martin Kustermann 1055db533c [vm/compiler] Add infer range to Utf8ScanInstr
This tells the compiler that boxing the result of Utf8ScanInstr will
always fit in a Smi and the boxing instruction can therefore never go to
runtime (and e.g. cause a lazy-deopt).

Noticed as part of https://github.com/dart-lang/sdk/issues/45213

TEST=Existing test suite.

Change-Id: I30712ec50378c7e0f70e1a5d95a2390b4f5d8ebc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190481
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-03-17 11:17:41 +00:00
Martin Kustermann 1ca7593c44 [vm/compiler] Mark various additional IR instructions as kNoGC
Some IR instructions (e.g. RawStoreField) can never deopt by-design. Some
instructions are calling runtime entries but those are leaf calls (e.g.
InvokeMathCFunction). Some are synthetic IR instructions that never
actually emit code (e.g. Constraint). Some IR instructions cannot deopt
due to inputs (e.g. Boxing instructions whose value is guaranteed to fit
into Smi).

Part of https://dart-review.googlesource.com/c/sdk/+/190481

TEST=Existing test suite.

Change-Id: I770b7d094ef36221d357157c736710476fd6bfb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190482
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-17 11:13:01 +00:00
Regis Crelier 33cabf4313 [VM/runtime] Allow generic function types as type arguments in the VM.
Type parameter scopes were not set properly when loading bounds with generic function types from kernel file.
The trail to avoid infinite recursion while comparing type parameter bounds was not used properly.

Fixes https://github.com/dart-lang/sdk/issues/45313
Fixes https://github.com/dart-lang/sdk/issues/45322
Fixes https://github.com/dart-lang/sdk/issues/44930

TEST=regression tests added

Change-Id: I096b7d8c22aa5b3a3a9e12a59b1417388ff5171f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191465
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-17 00:16:41 +00:00
Ryan Macnak c9ba99ae6d [vm, compiler] Make the difference between the CompileTypes for int and _IntegerImplementation visible when printing IL.
TEST=ci
Change-Id: I17f6a79e3642a809a57f7d240c3894a093429a81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191460
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2021-03-16 21:57:01 +00:00
Tess Strickland 901fed103b [vm] Use the cached number of parent type args in FunctionType.
Also ensure the number of parent type arguments is appropriately
adjusted in the returned FunctionType when partially instantiating
a FunctionType, and that free parent type arguments are _not_
included in types built while reading constants.

Since the number of parent type arguments is now cached there, we
no longer need to also cache them in ClosureData. We can also remove
the parent walking in Function::NumParentTypeArguments().

Previously, a FunctionType where the component types did not use
parent type parameters was considered instantiated. This CL changes
it so that FunctionType with free parent type parameters are never
considered instantiated. This is necessary because otherwise,
when instantiating the parent type parameters, a FunctionType that
does not use its parent type parameters will be used unchanged
instead of creating a copy with fewer parent type parameters.

Because of this, places where IsInstantiated was used to simply
check for generic parent functions (namely, for implicit closure
creation) has been appropriately weakened to check
!HasGenericParent() instead.

TEST=Existing tests on CI.

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
Change-Id: Ifb4a0a1273d8d01908cdf4ffc3c4c28a1c33ffa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190021
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-03-16 15:04:51 +00:00
Alexander Aprelev 3162957a78 [gardening] Add explicit type to ensure templated function applies.
Follow-up to d42de4ed06

TEST=build engine ios_debug_arm target

Change-Id: I7f86f74467c7e7ed05feddfce921b46f05586e68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191326
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-03-16 04:34:44 +00:00
Ryan Macnak 829ef92778 [vm] Expand compressed heap to 4GB.
We originally sized the compressed heap at 2GB to avoid implementing alignment offsets. (When decompression is sign-extension + base, base should be the middle of a 4GB-aligned region.) After 8db0a975c1, the needed alignment offset is zero, and we no longer need to avoid the high bit being set.

TEST=ci
Change-Id: Ib6e6c40bcb9638e01867edd527b3acaaccec570b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191321
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2021-03-16 01:27:24 +00:00
Ryan Macnak 2472db0031 [vm] Inform the OS that it can reclaim free'd portions of the compressed heap.
TEST=ci
Change-Id: I26c5963d5d3596f95d3089b1dadc482bd2182543
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191301
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2021-03-16 00:12:54 +00:00
Ryan Macnak c9e10c931c [vm, compiler] Predicate boolean loads.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/29908
Change-Id: I5a5c57a8a79dbe4f2ee5303a4b9436bd36e8d7be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189921
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-15 20:53:04 +00:00
Alexander Markov 16beb34813 [vm/aot] Remove special cases of dynamic function lookups from precompiler
Flutter gallery AOT snapshot size
release: no change;
release-sizeopt: arm -0.24%, arm64 -0.25%.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/44852
Change-Id: I847bfc311552bb4e80222e0040b50b4766a18dbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190783
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-03-15 17:53:23 +00:00
Vyacheslav Egorov d42de4ed06 [vm] Crash on impossible GDT null errors
This CL adds code to detect situations when we hit
null error through GDT call with non-null receiver.

We achieve this by making receiver's cid part of the
GDT calling convention and checking this cid
in runtime entry responsible for throwing the null
error.

This CL is an attempt to narrow down b/179632636
and collapse various impossible crash reports
into a single native crash cluster by crashing VM
instead of throwing a null error.

TEST=tested manually

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try
Change-Id: If2ed4646c4c0f403016266e4e83e296a7b234cb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191141
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-15 15:35:10 +00:00
Vyacheslav Egorov 69ec09825a [vm] On Android set abort message before aborting
Android L and newer (API level 21) provides a way to
specify abort message which will be included into
crash report created by debuggerd.

Make sure our DynamicAssertionHelper uses this functionality
if available.

TEST=tested manually

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-android-release-arm64-try,vm-kernel-mac-release-x64-try
Change-Id: If25cd168d43677e0a0fe9b63e21a017415686ab7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191140
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-15 15:35:10 +00:00
Tess Strickland dc62c9c3c2 [vm/compiler] Write retained reasons JSON to a file.
Instead of being part of the --trace-precompiler output, there is
is a new flag --write-retained-reasons-to=<path>.

To allow for non-functions to have reasons for retention, the
JSON objects in the array now have one additional field:

* type: a string, the C++ type of the Dart object.

This CL also wraps all the machinery in a RetainedReasonsWriter
class instead of putting it in the Precompiler interface.

TEST=vm/dart{,2}/use_trace_precompiler_flag

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
Change-Id: Ifa40ac64fdcbdad5114499425c7f8b08e327fa76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190525
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-15 08:37:40 +00:00
Alexander Markov 11d6203130 [vm/aot] Fix retaining of exception types and auxiliary functions
There are two fixes:

1) If a function was compiled but not retained, precompiler
should still trace through types used in exception handlers.

2) Certain auxiliary functions such as implicit closure functions
and field initializers were added to 'possibly_retained_functions_'
set but were not traced through AddTypesOf and were not added to
'functions_to_retain_' set.

Flutter gallery AOT snapshot size
release - no changes
release-sizeopt arm +0.13%, arm64 +0.14%

TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/45179
Issue https://github.com/dart-lang/sdk/issues/44852

Change-Id: Ide9a7e82a7bb9098dc90bc41a76e527e7a5cb603
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190781
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-03-13 00:30:38 +00:00
Vyacheslav Egorov 4e027fae97 [vm/compiler] Force unboxing of int phis on 64-bit platforms
More specifically on 64-bit platforms, when other heuristic fail:

- in AOT mode unbox all int typed phis.
- in JIT mode unbox all non-Smi int typed phis i.e. mixed
  Mint/Smi phis.

This brings treatment of int phis closer to how we treat other
boxed phis.

This considerably improves AOT code quality for loops which
our current conservative heuristic does not currently hit,
for example:

  void foo(int start, int end) {
    for (var i = start; i < end; i++) {
    }
  }

Code like this would use a boxed Phi previously which does not make
sense.

In JIT mode to really benefit from aggressive unboxing we
might need to shift from over-reliance on Smi operations, e.g.
when phi is unboxed we want to cascade that through and unbox
operations which are performed on it transitively. This requires
much more sophisticated algorithm and is outside of scope for this
change.

In AOT we in general treat all arithmetic operations as operations
over 64-bit int values so unboxing phis makes more sense.

As a result of this change we see small improvement in code size:

  flutter_gallery_app_so_gzip_size -0.2392%

TEST=ci


Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try
Change-Id: Iae9a16f353e53f649da4e665d2812ad47099a674
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187860
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-11 22:20:51 +00:00
Ryan Macnak 8db0a975c1 [vm] Allow garbage in the upper-half of compressed Smis.
Allows removing a branch when decompressing pointers and removing fixup sign-extension after Smi ops that use 32-bit ops to detect overflow. Increases the code size of indexed and stores for some widths due to addressing mode limitations.

TEST=ci
Change-Id: Ia48353cccbbc586dd0d2e055a843c65e37c63a30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185660
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2021-03-11 19:39:01 +00:00
Alexander Markov c73ab38596 [vm] Count heap size for canonical tables
This is a follow-up to https://dart-review.googlesource.com/c/sdk/+/185381.
That change introduced a more compact serialization of canonical sets,
but it didn't include correct counting of heap size of tables
allocated during deserialization of canonical sets.

This change adds counting of heap size of canonical tables.
The heap size benchmark numbers will regress with this change,
but this is only due to a more accurate counting, not due to a real
regression.

TEST=ci

Change-Id: I42ee3bd91f0420bf41c660d2eaa51e9901d9b198
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190580
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-03-11 17:47:41 +00:00
Tess Strickland 5b8b55dfdd [vm/compiler] Fix size regression with symbolic stack traces enabled.
TEST=Manually checked via Golem.

Change-Id: I4986d99afd9dbcc5f63292baa89ec9053b0f37a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190524
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-03-11 11:16:41 +00:00
Vyacheslav Egorov a942c10bff [vm] Remove IL serializer.
Unfortunately, we never capitalized on having it (e.g. original plan was
to use it for writing tests, among other things) and continuing to
maintain it does not make sense.

TEST=ci

Change-Id: I02b2c35149298a295aa0de75916d48434d4a3ea9
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,pkg-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190220
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-10 10:02:58 +00:00
Vyacheslav Egorov 3ed83c398d [vm] Fix compressed pointers build
Only use unified kStringCid cluster in non-compressed variant (when
we write strings into rodata section)

TEST=x64c bots

Change-Id: Id1781801eae40f570228503fefac43a90d033c7b
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190221
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2021-03-10 09:50:18 +00:00
Tess Strickland 7ba7d65e5b [vm/compiler] Print retained functions when tracing precompiler.
To get this information, enable --trace-precompiler.

There are two version of the output: a human readable version
and a JSON version (preceded by 'JSON for function decisions:')
for easier tabulation. The JSON version is an array of objects,
where the fields of the object are as follows:

* name: a string, the function name
* kind: a string, the function kind
* retained: a boolean, whether the function was retained
* reasons: an array of strings, reasons for retaining
  (only for retained objects)

TEST=vm/dart{,_2}/use_trace_precompiler_flag_test.dart

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
Change-Id: I9b006a49e1410a832950a1bd29a0abaabe9431f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190000
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-10 08:21:58 +00:00
Ben Konyi dbbd71cd75 [ VM ] Remove requirement for presence of current isolate for
Dart_ServiceSendDataEvent

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

Fixed: 44720
TEST=Existing dart:io tests
Change-Id: I003a339a91dca84dafc39c44ba804ecf3f6f84ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190303
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-03-10 00:42:37 +00:00
Vyacheslav Egorov fa12114202 [vm] Remove traces of LLVM backend
The code has been dead for quite some time.

TEST=ci

Change-Id: Iddcb63e14e9e4d95230f006ac05da64f444f0712
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190024
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-03-09 20:37:20 +00:00
Vyacheslav Egorov 0e12cdb7fa [vm] Remove unused field in TimeoutQueue
TEST=ci

Change-Id: I82bda5017d9af36c32d0bbc413b6e6a2aa492566
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189209
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-09 20:28:05 +00:00
Ryan Macnak d1605bc5c5 [vm, compiler] Don't touch memory in AssertBoolean and BooleanNegate.
AssertBoolean may assume its input is nullable bool. BooleanNegate may assume its input is non-nullable bool. Use fixed alignment bits to distinguish true, false and null.

TEST=ci
Change-Id: Ife694e66c1225d943881c2325cd67f18575a47e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189240
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-09 20:27:00 +00:00
Ryan Macnak 927d45d013 [vm, gc] Remove data race updating TypedDataView::pointer_ during parallel scavenge.
TEST=tsan

Bug: https://github.com/dart-lang/sdk/issues/45217
Change-Id: I0045b793767b8397c62ce992cc775eff989e8642
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189800
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-09 20:20:00 +00:00