Commit Graph

303 Commits

Author SHA1 Message Date
Daco Harkes 4558112105 Rereland "[vm/ffi] Disallow Pointers and structs in finalizers and expandos"
`Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
`dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Expandos no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Cleans up unused object_store->ffi_struct_class.

Reland 1: Allow importing `dart:ffi` from `dart:core` with
          `--enable-ffi=false`.
Reland 2: Allow the new `_Compound` class to extend `NativeType`. (This
          got triggered in this CL on the build because of the import
          from `dart:core`.)

Closes: https://github.com/dart-lang/sdk/issues/45071
Breaking change: https://github.com/dart-lang/sdk/issues/45072

TEST=vm/cc/DartAPI_FinalizableHandleErrors
TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
TEST=tests/ffi(_2)/expando_test.dart

Change-Id: I133278e16bd75cd2bb6234e7ddf042ffa0a54fd6
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195079
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-14 12:07:18 +00:00
Daco Harkes c33dad37e5 Revert "Reland "[vm/ffi] Disallow Pointers and structs in finalizers and expandos""
This reverts commit 3f0ad61daa.

Reason for revert: Conflicts with https://dart-review.googlesource.com/c/sdk/+/194765

Original change's description:
> Reland "[vm/ffi] Disallow `Pointer`s and structs in finalizers and expandos"
>
> `Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
> `dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
> as values passed in to the `object` parameter.
>
> Expandos no longer accept `Pointer`s and subtypes of `Struct`s
> as values passed in to the `object` parameter.
>
> Cleans up unused object_store->ffi_struct_class.
>
> Closes: https://github.com/dart-lang/sdk/issues/45071
> Breaking change: https://github.com/dart-lang/sdk/issues/45072
>
> TEST=vm/cc/DartAPI_FinalizableHandleErrors
> TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
> TEST=tests/ffi(_2)/expando_test.dart
>
> Change-Id: I9af6d0173db60614091068c218391f73756c135f
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195061
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>

TBR=kustermann@google.com,dacoharkes@google.com

Change-Id: I90064b6b73155a43f37388f987c6b29f72ce9770
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195076
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-13 15:05:07 +00:00
Daco Harkes 3f0ad61daa Reland "[vm/ffi] Disallow Pointers and structs in finalizers and expandos"
`Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
`dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Expandos no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Cleans up unused object_store->ffi_struct_class.

Closes: https://github.com/dart-lang/sdk/issues/45071
Breaking change: https://github.com/dart-lang/sdk/issues/45072

TEST=vm/cc/DartAPI_FinalizableHandleErrors
TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
TEST=tests/ffi(_2)/expando_test.dart

Change-Id: I9af6d0173db60614091068c218391f73756c135f
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195061
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-13 13:52:36 +00:00
Alexander Markov 5129cff930 [vm/aot] Discard Code objects from the heap
While deserializing AOT snapshot, Code objects which do not contain
valuable information besides entry point and stack maps are discarded
and not allocated on the heap (they are replaced with
StubCode::UnknownDartCode()).

PC -> Code/CompressedStackMaps lookup is implemented using a separate
table (InstructionsTable).

Flutter gallery in release-sizeopt mode:
Heap size of snapshot objects: arm -26.89%, arm64 -27.68%

Large Flutter application in release mode with --dwarf-stack-traces:
Heap size of snapshot objects: -24.3%.
Discarded Code objects: 72.5% of all Code objects.

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

TEST=existing tests; "--dwarf_stack_traces --no-retain_function_objects
--no-retain_code_objects" mode is enabled for a few tests.

Change-Id: I5fe3e283630c8e8f4442319d5dcae38d174dd0d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189560
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-04-13 02:36:16 +00:00
Daco Harkes ac2412ca01 Revert "[vm/ffi] Disallow Pointers and structs in finalizers and expandos"
This reverts commit 2376ab5186.

Reason for revert: Importing dart:ffi from dart:core breaks the VM when using --enable-ffi=false

Original change's description:
> [vm/ffi] Disallow `Pointer`s and structs in finalizers and expandos
>
> `Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
> `dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
> as values passed in to the `object` parameter.
>
> Expandos no longer accept `Pointer`s and subtypes of `Struct`s
> as values passed in to the `object` parameter.
>
> Cleans up unused object_store->ffi_struct_class.
>
> Closes: https://github.com/dart-lang/sdk/issues/45071
> Breaking change: https://github.com/dart-lang/sdk/issues/45072
>
> TEST=vm/cc/DartAPI_FinalizableHandleErrors
> TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
> TEST=tests/ffi(_2)/expando_test.dart
>
> Change-Id: I1f11adfa073c7d2c979f3c2bb15c7444c7c767a0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186280
> Commit-Queue: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=lrn@google.com,vegorov@google.com,kustermann@google.com,dacoharkes@google.com

Change-Id: Ib76d27e59391dc6107d3f8e8fba3d67640ea9a5c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195060
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-12 16:30:57 +00:00
Daco Harkes 2376ab5186 [vm/ffi] Disallow Pointers and structs in finalizers and expandos
`Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
`dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Expandos no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Cleans up unused object_store->ffi_struct_class.

Closes: https://github.com/dart-lang/sdk/issues/45071
Breaking change: https://github.com/dart-lang/sdk/issues/45072

TEST=vm/cc/DartAPI_FinalizableHandleErrors
TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
TEST=tests/ffi(_2)/expando_test.dart

Change-Id: I1f11adfa073c7d2c979f3c2bb15c7444c7c767a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186280
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-04-12 14:04:16 +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 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
Martin Kustermann 461fb4ec8e [vm/concurrency] Remove redundant fields in Isolate
The object store related fields in [Isolate] are not needed anymore:

  Isolate::object_store_
  Isolate::cached_object_store_
  Isolate::object_store_shared_ptr_

and can be directly accessed from [IsolateGroup].

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

TEST=Refactoring of existing implementation.

Change-Id: Ia01da92cbb4e7cf5862c8419e27578ea07d4bdf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184268
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-02-12 13:14:37 +00:00
Ryan Macnak b1c09ecd8f [vm] Make naming more consistent when converting between handles, tagged and untagged pointers.
Currently we have things called XPtr which are not what you get from ptr().

Old world:
handle->raw() returns RawObject* (tagged)
raw_obj->ptr() returns RawObject* (untagged)

After 6fe15f6df9:
handle->raw() returns ObjectPtr
obj_ptr->ptr() returns ObjectLayout*

New world:
handle->ptr() returns ObjectPtr
obj_ptr->untag() returns UntaggedObject*

TEST=ci
Change-Id: I6c7f34014cf20737607caaf84979838300d12df2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149367
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-15 23:32:02 +00:00
Regis Crelier b3bca1821c [VM/runtime] Decouple representation of function signatures from Function objects.
This fixes issue https://github.com/dart-lang/sdk/issues/43088

This CL improves on https://dart-review.googlesource.com/c/sdk/+/166920 by keeping the names of type parameters.

See go/dart-vm-signatures for motivation for this change.

TEST=existing suites

Change-Id: Ia82f1d322f72d07b2fb253cf914f9b868025c71e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176981
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-01-07 23:45:37 +00:00
Clement Skau 2d36c85ff8 [vm] Removes support for --causal-async-stacks
All existing embedders have been opted into --lazy-async-stacks, the
VM also uses it as it's default in all configurations.

After this CL, any user of --causal-async-stacks will get an error
message when trying to use it.
=> In any such case, please simply remove the flag.

TEST=Exhaustive CQ.

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: Ia440afcf2dba464aa8b8cf381b93bbac8eb9f8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172564
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-01 07:27:14 +00:00
Liam Appelbe 504e9a32f9 Reland "[wasm] Remove dart:wasm"
This is a reland of ade333dd54

Original change's description:
> [wasm] Remove dart:wasm
>
> I'm not entirely sure why I had to modify a random set of fingerprints
> in runtime/vm/compiler/recognized_methods_list.h, but when I did a debug
> build it had some fingerprint errors.
>
> Change-Id: Ib0a0cccb37f2efba509e2b37b6eabe790fa933c4
> TEST= Deleting stuff, so not really necessary
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170620
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Liam Appelbe <liama@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: I0d1388f6312358cc62bb32f5ac7b88a3187223c9
TEST= Deleting stuff, so not really necessary
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171940
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2020-11-13 20:40:24 +00:00
Siva Annamalai 54a91f26c4 Revert "[wasm] Remove dart:wasm"
This reverts commit ade333dd54.

Reason for revert: This broke both the Flutter HHH and Google3 bots. It looks like some co-ordination is required between the Google3 and Flutter engine build changes for this CL to land.

Original change's description:
> [wasm] Remove dart:wasm
>
> I'm not entirely sure why I had to modify a random set of fingerprints
> in runtime/vm/compiler/recognized_methods_list.h, but when I did a debug
> build it had some fingerprint errors.
>
> Change-Id: Ib0a0cccb37f2efba509e2b37b6eabe790fa933c4
> TEST= Deleting stuff, so not really necessary
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170620
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Liam Appelbe <liama@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I244d7b3549845dd71719176a62b6ec3a4c4b5f86
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171860
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-11-13 01:54:10 +00:00
Liam Appelbe ade333dd54 [wasm] Remove dart:wasm
I'm not entirely sure why I had to modify a random set of fingerprints
in runtime/vm/compiler/recognized_methods_list.h, but when I did a debug
build it had some fingerprint errors.

Change-Id: Ib0a0cccb37f2efba509e2b37b6eabe790fa933c4
TEST= Deleting stuff, so not really necessary
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170620
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-11-12 19:22:29 +00:00
Clement Skau 27ca552ddb [SDK] Replaces async's _AsyncAwaitCompleter with _Future.
Run time (less is better) impact:
dart:
- Calls.AwaitAsyncCall  -43.95% ~ -55.50%
- Calls.AwaitAsyncCallClosureTargetPolymorphic  -40.33% ~ -53.58%
- Calls.AwaitAsyncCallInstanceTargetPolymorphic  -42.69% ~ -55.65%
- Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits  -42.05% ~ -56.14%
- Calls.Await...  0% ~ -13%
dart-aot:
- Calls.AwaitAsyncCall  -9.748% ~ -11.13%
- Calls.AwaitAsyncCallClosureTargetPolymorphic  -8.673% ~ -13.19%
- Calls.AwaitAsyncCallInstanceTargetPolymorphic  -9.799% ~ -11.74%
- Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits  -5.412% ~ -13.43%

Code size impact:
- flutter_gallery_app_so_brotli_size  -0.1237% ~ -0.2410%
- flutter_gallery_readonlydata_size  0.1693% ~ 0.2041%
- flutter_gallery_instructions_size  0.1157% ~ 0.1779%
- flutter_gallery_total_size  0.1021% ~ 0.1413%

Bug: https://github.com/dart-lang/sdk/issues/39119
Change-Id: I64d28a8bea078277946d7be43737e265920c8f16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126322
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-05 09:51:13 +00:00
Ben Konyi d5118d5fc8 Reland "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional"
This reverts commit f78c40e32a.

Change-Id: Id838b39afcb371d3b50f0009322ecf0fb2080894
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169461
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-10-29 02:52:03 +00:00
Alexander Markov 7588ed86de Remove bytecode mode from the VM
Change-Id: Ief167b7ffc128105a03cc225ab750234c9a6a7a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169147
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-28 17:42:35 +00:00
Tess Strickland f78c40e32a Revert "Reland "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional""
This reverts commit a5d4511847.

Reason for revert: Failure in test standalone_2/io/unix_socket_test on reload bots, see https://github.com/dart-lang/sdk/issues/43952.

Original change's description:
> Reland "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional"
>
> This reverts commit b71477a2a6.
>
> Change-Id: Iba11c41e43ec8c08b48147bbd07b71a151c3d1e6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169243
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

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

Change-Id: I2ac1f18fef03d29bf74df4f49a91406a26f1ce26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169323
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-10-28 10:51:40 +00:00
Ben Konyi a5d4511847 Reland "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional"
This reverts commit b71477a2a6.

Change-Id: Iba11c41e43ec8c08b48147bbd07b71a151c3d1e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169243
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-10-28 00:49:11 +00:00
Ben Konyi b71477a2a6 Revert "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional"
This reverts commit 5bf9163e1b.

Reason for revert: Tests failing on bots.

Original change's description:
> [ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional
> parameter for ReceivePort and RawReceivePort
>
> This change collects additional information related to ReceivePort
> allocation locations and an optional debug name that will be displayed
> by tooling. ReceivePort is now a special InstanceKind and a ReceivePort
> @Instance will include the port ID, allocation stack trace, and debug
> name.
>
> Change-Id: I003cfff2b7649218e37d9b653c0e953df5d992e7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167902
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I39c3abb07c8c40c158eb4549749b076399bccce9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169160
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-10-27 03:14:30 +00:00
Ben Konyi 5bf9163e1b [ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional
parameter for ReceivePort and RawReceivePort

This change collects additional information related to ReceivePort
allocation locations and an optional debug name that will be displayed
by tooling. ReceivePort is now a special InstanceKind and a ReceivePort
@Instance will include the port ID, allocation stack trace, and debug
name.

Change-Id: I003cfff2b7649218e37d9b653c0e953df5d992e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167902
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-26 23:09:47 +00:00
Alexander Markov c0ebcb9f1b [vm/compiler/nnbd] Add slow path for loads of late fields without initializer
When loading a late field without initializer, we check if it was not
initialized and throw an exception. This change adds slow path (shared
if supported) for throwing LateInitializationError instead of calling
an initializer which would throw an exception. This improves register
allocation around accesses to such late fields.

In addition, this CL removes duplicated code for generating shared
stubs.

Size of Flutter gallery snapshot on armv8 -0.45%
(gzip -0.34%, brotli -0.41%)

Null-safe version of ParticleSystemUpdate benchmark on x64
JIT +9-17%, AOT +3-4%.

Change-Id: Ia12c1efec0871a2fd7acc6db75f255853af52d0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168993
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-26 18:55:26 +00:00
Alexander Markov d77fff7307 [vm/nnbd] Add separate Snapshot::Kind for core snapshots
Core snapshots should be agnostic to the sound null safety mode
(so they can be used both in weak and strong modes), and snapshot
writer verifies that.

Snapshot::kFull was previously used both for core snapshots and
app snapshots on ia32. However, app snapshots are not guaranteed to
be agnostic, which appeared as failures on a few test on ia32.
Also, VM should be able to detect null safety mode from app snapshots,
even if they do not contain code, but null safety mode was not
written into features string of kFull snapshots.

In order to disambiguate core snapshots, a new Snapshot::Kind is
added. Snapshot::kFullCore works exactly as Snapshot::kFull, except
for verification of agnostic null safety and snapshot features string
omitting null safety mode. All snapshots except kFullCore now have
null safety mode included into their features string.

Fixes https://github.com/dart-lang/sdk/issues/43626
Issue https://github.com/dart-lang/sdk/issues/43613

Change-Id: I8cd3b049ef4e428dd5e1ce666d4c7aa3b596d70c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166308
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-08 19:59:15 +00:00
Alexander Markov 13aaaae1b2 [vm/compiler] Introduce AllocateTypedData IL instruction
This is the first step towards optimizing typed data array allocations,
which is useful for e.g. package:vector_math.

Opaque call to a typed data factory constructor is replaced with IL
instruction which doesn't have side-effects and doesn't prevent
other optimizations (e.g. load forwarding) from happening.

Asm intrinsics for typed data factories are replaced with stubs.

Issue: https://github.com/dart-lang/sdk/issues/43228
Change-Id: Icc7d4863f2f94ea5d8bb4620d041f7b6fe664098
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161840
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-09-16 03:16:42 +00:00
Martin Kustermann f6906f856e [vm/compiler] Add type testing stubs to allow TypeParameter types to be called indirectly
Right now AssertAssignable will not call the TTS of a TypeParameter but
instead load the value for the type parameter inline and then call it's
TTS.

To prepare for future changes where we want to call TTS of an arbitrary
type object, we need to be able to install a functioning TTS on
TypeParameter, which this CL does.

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

Change-Id: I0792cc1a796fe8afb2167b7665580b3f1385005b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162007
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-09-09 17:33:09 +00:00
Ryan Macnak 569fc70a91 [vm] Factor out common structure from the three kinds of snapshot.
Reduces Serializer::WriteVM/Program/UnitSnapshot to Serializer::Serialize, and likewise for deserialization.

Change-Id: Idd641ccbbfea410b128e50fe37fca171a0662a95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160000
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-08-26 21:07:55 +00:00
Alexander Markov 9138edd1ad Reland "[vm/compiler] Infer type of LoadIndexed from array type"
This is a reland of 501a7ae7b0

The change is re-landed as is, without any extra changes.
The change was reverted due to timeout on internal test (b/163882044),
but that timeout was actually not related to this particular change.

Original change's description:
> [vm/compiler] Infer type of LoadIndexed from array type
>
> After inlining we may have more accurate information about array being
> accessed. This change adds computation of type of LoadIndexed
> instruction based on the type of array being accessed.
>
> The computation is able to skip loading of GrowableArray.data.
> If array was loaded from a field, it takes static type of a field
> into account.
>
> Benchmarks with null safety in JIT mode on x64:
> ForInLoop +80-106%
> DeltaBlueIterators +15-31%
>
> Change-Id: Ia61aa761f4ccd4692e05fdac043f8a2a46f88f21
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157823
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: Iae4fc5132f62fa2635159cbf9ec47636826e1402
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158526
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-08-14 17:52:06 +00:00
Daco Harkes 44fdd8f69d [vm/ffi] fix callbacks in --no-use-bare-instructions
Closes: https://github.com/dart-lang/sdk/issues/43035

Change-Id: I3a4e972f00ef7c7436d8ce5176bdc43c7636c25d
Cq-Include-Trybots:dart/try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158399
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-08-14 12:49:37 +00:00
Alexander Markov 39c1f06cce Revert "[vm/compiler] Infer type of LoadIndexed from array type"
This reverts commit 501a7ae7b0.

Reason for revert: timeout on internal test, b/163882044

Original change's description:
> [vm/compiler] Infer type of LoadIndexed from array type
> 
> After inlining we may have more accurate information about array being
> accessed. This change adds computation of type of LoadIndexed
> instruction based on the type of array being accessed.
> 
> The computation is able to skip loading of GrowableArray.data.
> If array was loaded from a field, it takes static type of a field
> into account.
> 
> Benchmarks with null safety in JIT mode on x64:
> ForInLoop +80-106%
> DeltaBlueIterators +15-31%
> 
> Change-Id: Ia61aa761f4ccd4692e05fdac043f8a2a46f88f21
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157823
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I10f6488b85b310fae394b372a2682a8ef802316c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158401
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-08-13 01:50:08 +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
Alexander Markov 501a7ae7b0 [vm/compiler] Infer type of LoadIndexed from array type
After inlining we may have more accurate information about array being
accessed. This change adds computation of type of LoadIndexed
instruction based on the type of array being accessed.

The computation is able to skip loading of GrowableArray.data.
If array was loaded from a field, it takes static type of a field
into account.

Benchmarks with null safety in JIT mode on x64:
ForInLoop +80-106%
DeltaBlueIterators +15-31%

Change-Id: Ia61aa761f4ccd4692e05fdac043f8a2a46f88f21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157823
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-08-10 20:18:53 +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
Regis Crelier 994c6ba6cd [VM/nnbd] Class Future may be used for type normalization before it is cached in the object store.
Class Future is resolved on the fly if not already cached.
Note that postponing type normalization until type finalization does not help
and results in the same error.

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

Change-Id: Id4dbeba6a246dbc952cce4168a10137a49d3ce70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153901
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-07-14 00:42:19 +00:00
Ryan Macnak d4ffb92ed8 [vm] Reify loading units.
Loading unit metadata is expanded to create an object representing each loading unit, and each library to reference the loading unit it is a part of.

To be used at compile-time to help assign objects to snapshots.

To be used at runtime to track which units have been loading and the base objects for cross-snapshot references.

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Icd3fa95ffd5949bd8f7f84a6f750c4c515de0dba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151865
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-07-09 00:15:07 +00:00
Alexander Markov 06a8cc8dea [vm/nnbd] Use separate runtime entry for throwing _CastError in null check operator
Previously, NullError runtime entry was used both to throw
NoSuchMethodError and _CastError. _CastError was used if selector is
null. However, with --dwarf-stack-traces CodeSourceMap is not preserved
and selector is not available, so wrong exception type was thrown.

This is fixed by introducing separate NullCastError runtime entry along
with corresponding shared stubs.

NullErrorSlowPath is extended to support 3 exception types
(NoSuchMethodError, ArgumentError and CastError).
NullArgErrorSlowPath is removed as it duplicates NullErrorSlowPath.

Fixes vm/dart/null_checks_with_dwarf_stack_traces_test
Fixes https://github.com/dart-lang/sdk/issues/42149

Change-Id: I4f2b34ad2b161459491de60d8737bb4f87117336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153040
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-01 20:52:34 +00:00
Daco Harkes 6544c69e23 [vm/ffi] Convert Objects to Dart_Handles in FFI calls
This includes support for calling Dart_PropagateError in native code
when doing FFI calls, and catching uncaught exceptions with Dart_IsError
when doing FFI callbacks.

The support for Dart_PropagateError adds a catch entry to the FFI
trampoline, which prevents inlining these trampolines in AOT. This
regresses the FfiCall benchmarks by 1-2% in AOT.

In addition, Dart_PropagateError requires maintaining a bit whether we
entered native/VM code from generated code through FFI or not. That way
we can do the proper transition on the exception path. When entering
generated code, we store this bit on the stack, right after the entry
frame.

Design: http://go/dart-ffi-handles

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

Change-Id: Idfd7ff69132fb29cc730931a4113d914d4437396
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145591
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-12 11:14:22 +00:00
Regis Crelier c0c66ab10f Reland "[VM/nnbd] Canonicalize TypeParameter objects in the VM."
This is a reland of 6a98e2719e

Original change's description:
> [VM/nnbd] Canonicalize TypeParameter objects in the VM.
> 
> Prior to this CL, type parameters were all assumed canonical, even duplicate ones.
> 
> Per a new convention introduced in this CL, the type parameter array in generic classes and generic functions contains canonical type parameters. As these type parameters get cloned with a different nullability, they are inserted in a new hash table of canonical type parameters.
> 
> This fixes performance issue https://github.com/dart-lang/sdk/issues/41421
> 
> Change-Id: I9086158fa6b6261e9997bb50edec6d7c54abbfa1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148223
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: I4a42d0f9d53c2244b1a638432ed2cd6a055fa72a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150266
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-06-11 00:44:05 +00:00
Régis Crelier c48263e901 Revert "[VM/nnbd] Canonicalize TypeParameter objects in the VM."
This reverts commit 6a98e2719e.

Reason for revert: Unexpected test failures

Original change's description:
> [VM/nnbd] Canonicalize TypeParameter objects in the VM.
> 
> Prior to this CL, type parameters were all assumed canonical, even duplicate ones.
> 
> Per a new convention introduced in this CL, the type parameter array in generic classes and generic functions contains canonical type parameters. As these type parameters get cloned with a different nullability, they are inserted in a new hash table of canonical type parameters.
> 
> This fixes performance issue https://github.com/dart-lang/sdk/issues/41421
> 
> Change-Id: I9086158fa6b6261e9997bb50edec6d7c54abbfa1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148223
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I0ca3b6b66e2281c285eba6b564f78c0e6b2f2217
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150265
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-06-05 23:36:45 +00:00
Regis Crelier 6a98e2719e [VM/nnbd] Canonicalize TypeParameter objects in the VM.
Prior to this CL, type parameters were all assumed canonical, even duplicate ones.

Per a new convention introduced in this CL, the type parameter array in generic classes and generic functions contains canonical type parameters. As these type parameters get cloned with a different nullability, they are inserted in a new hash table of canonical type parameters.

This fixes performance issue https://github.com/dart-lang/sdk/issues/41421

Change-Id: I9086158fa6b6261e9997bb50edec6d7c54abbfa1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148223
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-06-05 22:56:50 +00:00
Martin Kustermann ecd82166c3 [vm/concurrency] Avoid allocating objects if not needed (and possibly cache objects)
Two growable arrays needed for possibly re-hashing objects when sending
messages using the snappshotter are often unused. Only create them when
needed.

When looking up message handler and calling it avoid repeated
allocations of small arrays (they can be cached savely because right
the transition stubs will copy the arguments out of those arrays).

This improves performance of high-frequency messages but small message
handlers.

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

Change-Id: I623aba5b29064f3a75ea294557ee153067a63d08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148263
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-16 06:45:02 +00:00
Ryan Macnak 6b91f92154 [vm] Move megamorphic miss handling into the megamorphic call stub.
This removes the only stub code with a function owner.

Change-Id: I629eb3a1b231430afaf0a2777032bba8eaddd2aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148124
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-15 20:28:21 +00:00
Alexander Aprelev 8c79102889 [vm/isolates] Move saved_initial_field_table to isolate group.
This improves performance of spawn isolate since it drops a need to lock isolate group when spawning new isolate.

Change-Id: I867c13c808a3eb356f3d53323bb8aef06541019e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147046
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-05-07 19:13:28 +00:00
Alexander Markov 994f454996 [vm/nnbd] Call field initializer from stubs for late instance fields
This change introduces 2 new stubs, InitLateInstanceField and
InitLateFinalInstanceField. Those stubs call field initializer
directly without going to runtime.

Fixes the regressions on Uri.pathSegments.easy and Uri.pathSegments.hard.normalized
benchmarks with NNBD SDK after https://dart-review.googlesource.com/c/sdk/+/143189.

Change-Id: I6bde7a98010ac1321a95eda8b0f125105f3993c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144807
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-28 21:35:23 +00:00
Ryan Macnak 6fe15f6df9 [vm] Represent tagged pointers as C++ value types instead of C++ pointer types.
This works around bugs in UndefinedBehaviorSanitizer and Clang.

Bug: b/28638298
Change-Id: I6be595f9664516019d28017d24559583a1ae3a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144354
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-25 05:21:27 +00:00
Alexander Markov 53860a5822 [vm/nnbd] Take Never type out of the VM isolate
Never type in the VM isolate causes bootstrapping problems when
null-safety mode is auto-detected. We cannot initialize its type
testing stub without knowing null-safety mode and we cannot patch it
after figuring out null-safety mode because VM isolate is read-only.

The solution is to move Never type (and Never class) out of the VM
isolate and make them per isolate.

Issue: https://github.com/dart-lang/sdk/issues/41206
Change-Id: Iede937aa5becd5f1f7b029db836c25a1b20fbc5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144488
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-04-23 01:31:57 +00:00
Alexander Markov 69791c50f8 [vm/nnbd] Use InitInstanceField instruction for late instance fields
Fixes https://github.com/dart-lang/sdk/issues/41299
Issue https://github.com/dart-lang/sdk/issues/41417

Change-Id: I1219ddaffcf3a2b17226305eeea8455c73f4ca78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143189
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-04-20 23:30:14 +00:00
Martin Kustermann bc59a40918 [vm/compiler] Use PC-relative calls in AssertAssignable when calling TTS
Additionally the TTS itself will also use pc-relative tail-call to the
slow path.

This reduces AssertAssignable by 1 instruction and generated
type testing stubs by 2 instructions.

Flutter gallery total size:

  armv8: -0.3%
  armv7: -0.27%

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

Change-Id: Ib29ff9afd1df4034c8fa47f66c80c22e226c0979
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142988
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2020-04-18 20:27:38 +00:00
Alexander Aprelev 9c4a322b08 Reland "[vm/isolates] Introduce fast isolate spawn in AOT."
This reverts commit 922ea3e9b6 in patchset 1, fix for assertion triggered in https://ci.chromium.org/b/8883214567628884960 in patchset 2, fix for deadlock around symbols table mutex in patchset 4.

Original commit description:

Speed up is achieved by sharing most of the dart code, object store
and class table between isolates in single isolate group. So
instead of bootstrapping isolate from the snapshot, isolate is
initialized by setting pointers to existing data structures already
set up for first isolate, and only few isolate-specific structures (moved
to newly introducted isolate_object_store) are created.

To allow for safe cross-isolate switchable call site, type test cache
mutations additional synchronization via RunWithStoppedMutators(that
relies on safepoints) was added.
Besides switchable call sites, no other mutation to the dart code is
done in AOT, which allows such sharing.

Bug: https://github.com/dart-lang/sdk/issues/37835
Bug: https://github.com/dart-lang/sdk/issues/36097
Change-Id: I655e337198214c9dfacbe76f7852b941b5a7e910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143462
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-04-17 03:02:27 +00:00
Martin Kustermann c522e79a0b [vm/compiler] Use PC-relative (tail)call for calling various stubs
This CL introduces a mechanism to allow a stub to use a pc-relative
tail-call to another stub by populating the code's static_calls table.

We use this in allocation stubs which can tail-call the generic object
allocation stub.

Flutter gallery total size:

  - armv7: -0.72%
  - armv8: -0.88%

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

Change-Id: I6afafe2a357b7833da843403f90281aee363a95b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142987
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2020-04-16 04:55:00 +00:00