Commit Graph

68 Commits

Author SHA1 Message Date
Ryan Macnak 9ab5245b89 Reapply "[vm] Don't use a fuzzy lookup for recognized methods."
- Fix incorrectly named ALL_INTRINSICS_LIST to ASM_INTRINSICS_LIST and restore setting intrinsic bit for graph intrinsics.
 - Remove more dead code.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/56007
Change-Id: Iebceaab86509e34f47e3d6918706b0e69ed7dfc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374842
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-07-09 16:33:19 +00:00
Ryan Macnak b5d6c50e1a Revert "[vm] Don't use a fuzzy lookup for recognized methods."
This reverts commit 1dbb56c77a.

Reason for revert: affects Golem results

Original change's description:
> [vm] Don't use a fuzzy lookup for recognized methods.
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/56007
> Change-Id: I30debb6b9c9890739cc1b25b7b2c097551b4c2aa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374200
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

Bug: https://github.com/dart-lang/sdk/issues/56007
Change-Id: I1b8fddb967f0189ce223aad1768477229a8a36b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374863
Commit-Queue: Alexander Aprelev <aam@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Ryan Macnak <rmacnak@google.com>
2024-07-08 21:40:47 +00:00
Ryan Macnak 1dbb56c77a [vm] Don't use a fuzzy lookup for recognized methods.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/56007
Change-Id: I30debb6b9c9890739cc1b25b7b2c097551b4c2aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374200
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-07-08 18:25:48 +00:00
Alexander Markov 6ca015ab20 [vm] Cleanup obsolete pragma vm:non-nullable-result-type
Since sound null safety, 'vm:non-nullable-result-type' pragma is
no longer useful as the same information is conveyed by a non-nullable
return type.

TEST=ci

Change-Id: Ie6a61aca38cfea47cb005b12ca7f0d7631791024
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372200
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-06-20 20:24:44 +00:00
Alexander Markov ad95bb6f89 Reland "[vm] Implement typed data view GetIndexed in flow graph builder"
This is a reland of commit a7e2dce0cc

Fixes the crash during code generation when typed data view
LoadIndexed was used on an internal typed data array
(in the unreachable code path) without loading its payload.

TEST=runtime/tests/vm/dart/regress_b_334128316_test.dart
TEST=manually verified repro from b/334128316

Original change's description:
> [vm] Implement typed data view GetIndexed in flow graph builder
>
> Typed data view 'operator []' is now implemented in the flow
> graph builder. This unifies all typed data GetIndexed operations
> and removes unnecessary address calculations.
>
> TEST=ci
>
> Change-Id: I8d2ca6e7c7bf18b2590536a643f92cad5beb6d95
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361283
> Reviewed-by: Tess Strickland <sstrickl@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

Change-Id: I3786fa17e971f8ba6cd01a57f1a68504bf24bc47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362821
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-04-16 14:39:48 +00:00
Alexander Markov 8a4c626086 Revert "[vm] Implement typed data view GetIndexed in flow graph builder"
This reverts commit a7e2dce0cc.

Reason for revert: VM crash (b/334128316)

Original change's description:
> [vm] Implement typed data view GetIndexed in flow graph builder
>
> Typed data view 'operator []' is now implemented in the flow
> graph builder. This unifies all typed data GetIndexed operations
> and removes unnecessary address calculations.
>
> TEST=ci
>
> Change-Id: I8d2ca6e7c7bf18b2590536a643f92cad5beb6d95
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361283
> Reviewed-by: Tess Strickland <sstrickl@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

TEST=ci

Change-Id: I4c5b2e16d1218b92b717c4d0e8eea548d3113eab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362620
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-04-12 19:46:56 +00:00
Alexander Markov a7e2dce0cc [vm] Implement typed data view GetIndexed in flow graph builder
Typed data view 'operator []' is now implemented in the flow
graph builder. This unifies all typed data GetIndexed operations
and removes unnecessary address calculations.

TEST=ci

Change-Id: I8d2ca6e7c7bf18b2590536a643f92cad5beb6d95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361283
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-04-12 15:48:22 +00:00
Alexander Markov 0af6dde79d Reland "[vm] Replace array GetIndexed graph intrinsics with flow graph builder implementation"
This is a reland of commit d24b5d1f5e

On top of the original change, the following is fixed and improved:

1) Flow graph builder (FGB) body is now also applied to
   dynamic invocation forwarders (similarly to graph
   intrinsics).

2) Frame can be omitted for functions which have a
   call on a shared slow path. This is needed to make
   FGB implementation of GetIndexed frameless, as it has
   GenericCheckBound which calls on shared slow path.
   (Graph intrinsics are frameless).

3) Range analysis is enabled for force-optimized functions,
   so more efficient code can be generated for boxing
   instructions. Range analysis is fixed to avoid crashes
   and correctly intersect ranges with constant boundaries
   (needed for some force-optimized FFI functions).

4) EliminateStackOverflowChecks pass is enabled for
   force-optimized functions so CheckStackOverflow can be
   eliminated.

Original change's description:
> [vm] Replace array GetIndexed graph intrinsics with flow graph builder implementation
>
> _Array, _GrowableList, internal and external typed data 'operator []'
> are now implemented in the flow graph builder.
>
> Unlike graph intrinsics, flow graph created in the flow graph builder
> can be used by the inliner. Corresponding graph intrinsics and native
> methods are removed.
>
> Also, this change adds missing external typed data indexing operations.
>
> TEST=ci
>
> Change-Id: Ic19784481feadf54c096a587413e67b4e18353dc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359940
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TEST=ci

Change-Id: I04ef008a04238d432683d7543cd047e35bad17c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360560
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-04-02 20:41:19 +00:00
Alexander Markov a33270dc0a Revert "[vm] Replace array GetIndexed graph intrinsics with flow graph builder implementation"
This reverts commit d24b5d1f5e.

Reason for revert: performance regression
(Graph intrinsics are applied to dynamic invocation forwarders,
but flow graph builder implementation isn't.)

Original change's description:
> [vm] Replace array GetIndexed graph intrinsics with flow graph builder implementation
>
> _Array, _GrowableList, internal and external typed data 'operator []'
> are now implemented in the flow graph builder.
>
> Unlike graph intrinsics, flow graph created in the flow graph builder
> can be used by the inliner. Corresponding graph intrinsics and native
> methods are removed.
>
> Also, this change adds missing external typed data indexing operations.
>
> TEST=ci
>
> Change-Id: Ic19784481feadf54c096a587413e67b4e18353dc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359940
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: I2b31b06edaa4b8a09d256f25f923d4489e28518b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360305
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2024-03-29 17:27:50 +00:00
Alexander Markov d24b5d1f5e [vm] Replace array GetIndexed graph intrinsics with flow graph builder implementation
_Array, _GrowableList, internal and external typed data 'operator []'
are now implemented in the flow graph builder.

Unlike graph intrinsics, flow graph created in the flow graph builder
can be used by the inliner. Corresponding graph intrinsics and native
methods are removed.

Also, this change adds missing external typed data indexing operations.

TEST=ci

Change-Id: Ic19784481feadf54c096a587413e67b4e18353dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359940
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-03-28 20:43:59 +00:00
Ryan Macnak de2abc6091 [vm] Update NULL to nullptr in runtime/vm/compiler.
TEST=build
Change-Id: I54cd75bbc942e11c4d719edcc64640da67077634
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291965
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-30 18:23:53 +00:00
Ryan Macnak 7c0a694668 [vm] Avoid a second map lookup when dispatching isolate messages.
- Use the currently-unused ReceivePort.handler field instead of a second map.
 - Recognize ReceivePort's fields instead of using natives.

This also has the effect that if one discovers that a port handler is holding onto a large amount of memory via its context, the receive port along with its debug name will appear in the retaining path.

TEST=ci
Change-Id: I4b8d0764a41729a3b397b85bc4603e4d6b0ca9a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285403
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-27 18:08:25 +00:00
Ryan Macnak eb17dad604 [vm] Give mutable and immutable arrays a common superclass.
Allows CHA to notice `length` and `[]` have a single target the receiver is a mutable or immutable array.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/48361
Change-Id: I9e3ecabab1d32a4baa6e635cd660184ed9bb8fb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232425
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-23 18:34:03 +00:00
Daco Harkes d50c51ce35 [vm] Add dart:_internal as bootstrap library
This changes the hash of existing recognized methods. So its better to
land this separately from the CL that starts recognizing more methods in
`dart:_internal`:
https://dart-review.googlesource.com/c/sdk/+/229544

All private names are mangled, and the index of the library depends on
the order the libraries are registered.

TEST=SDK build, which checks the hashes.

Change-Id: I61b34859bb74e788f0828b164c637a2efd492901
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233565
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-02-21 12:08:54 +00:00
Daco Harkes acdf82de17 [vm/ffi] ABI-specific integers
This CL adds support for users defining integers which are mapped to
differing sizes and signedness based on the application binary interface
the Dart VM is running on.

Notable implementation design decisions:
- ABIs are open world, so that adding an ABI to the Dart VM does not
  break existing definitions. Thus, we only figure out in the VM that
  we're missing a mapping. We throw compile-time errors.
  - In AOT, these show up in the precompilation step.
  - In JIT, these show up as `_CompileTimeError` at runtime. Note that
    these can be caught. So in subsequent compilation steps we need to
    ensure that we also throw the same compile-time error.
- We match on the call-sites (streaming_flowgraph_builder) rather than
  method bodies (kernel_to_il) of AbiSpecific loads and stores so that
  we can compile for the int-size of the call site.

API design decisions:
https://github.com/dart-lang/sdk/issues/42563#issuecomment-981774001

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

TEST=tests/ffi_2/abi_*_test.dart
TEST=tests/ffi/function_*_generated_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart
Change-Id: I8c8df36fab939b6fb614c5f1ee8e1bf46b6e9521
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,benchmark-linux-try,dart-sdk-linux-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-canary-linux-debug-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-fuchsia-release-x64-try,vm-kernel-checked-linux-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64c-try,vm-kernel-mac-debug-x64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221501
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-12-16 22:07:00 +00:00
Clement Skau 94bdcc2084 [VM] Adds native field accessor in Dart.
Adds GetNativeField(o,i) to access NativeFieldWrapperClass{1-4}
native fields directly in Dart instead of through VM API.
This will allow us to pass `this` as a raw pointer instead of as
a Dart handle which needs to be unwrapped.
This will in turn allow ffi native calls for instance methods.

TEST=Adds vm/cc/DartAPI_NativeFieldAccess

Bug: https://github.com/dart-lang/sdk/issues/43889
Change-Id: I8006c735569fcbe5e49915a4c7e72c4ca85b356e
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205482
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-07-28 08:31:17 +00:00
Ryan Macnak e5bc0f0b86 [vm] Make various arrays const.
TEST=build
Change-Id: I8d3445b87caa979472c9a37df62507f152a4aefb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203202
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-06-14 20:45:18 +00:00
Alexander Markov 7f8001218b [vm] Support unsigned shift operator int.>>>
TEST=runtime/tests/vm/dart/unsigned_shift_right_test.dart and other
tests for >>>.

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

Change-Id: I7f0a9e1e486be06576c5d9bff3659b0aa6d68c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184921
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2021-02-24 00:14:57 +00:00
Daco Harkes fca959e5f6 [vm/ffi] Add class to vm:ffi:struct-fields pragma
This CL changes `@pragma('vm:ffi:struct-fields', [...])` to
`@pragma('vm:ffi:struct-fields', _FfiStructLayout([...]))` which makes
it easier to add more data in subsequent CLs.

Extends `FindPragma` to allow returning multiple matched pragma's, so
that we can filter them. (In this case to avoid matching user-defined
pragma's that do not have an instance of the private class.)

Separated out from https://dart-review.googlesource.com/c/sdk/+/183640
because of the extra constant in existing expectation files.

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

TEST=tests/ffi(_2)/*_by_value_*_test.dart

Change-Id: Idef9f82e9b53c2a32dffabcec19669eae550fe2f
Cq-Include-Trybots: luci.dart.try:front-end-nnbd-mac-release-x64-try,front-end-linux-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184181
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-11 18:09:05 +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
Aske Simon Christensen 1ab705f60c [vm] Require all recognized methods to be marked with pragma.
Adds a @pragma("vm:recognized", <kind>) to all recognized methods, where
<kind> is one of "intrinsic", "graph" or "other", corresponding to the
kind of recognized method.

When running in debug mode, it is checked that all recognized methods
are marked with the correct kind of pragma, and that all methods marked
with the pragma are in fact recognized.

This enables kernel-level analyses and optimizations to query whether
a method is recognized by the VM.

TEST=Asserts that check the correspondence both ways, covered by test
suite, in particular the various CompileAll tests that compile all code.
Change-Id: I12f3305c72a93ecb1aefae2d66e3d9a7dae23b44
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168951
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-16 13:49:50 +00:00
Daco Harkes 2a9516a8fe [vm] Output all mismatching fingerprints instead instead of one
Change-Id: Ice341078f1511a97b98f9f56be9f00833051fc21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154466
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-16 09:22:03 +00:00
Martin Kustermann 06183779d7 [vm/compiler] Make the compiler use dyn:* selectors when calling getters
We already make the callsites use dyn:* selectors for normal method
calls as well as setters, this is doing the same thing for getters.

Once callsites use dyn:get:* various pieces in runtime need to be
adjusted to accomodate for that (e.g. NSM handling, etc).

A follow-up CL will then start actually generating dyn:* getters in
certain situations.

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

Change-Id: If219603bc0b8eb119edd08b211a8897d21ec0fb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154320
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-07-15 12:38:04 +00:00
Alexander Markov 0162e7c1f8 [vm] Enable fingerprints checking of recognized methods
Fixes https://github.com/dart-lang/sdk/issues/36376

Change-Id: I470b95a1f854ef6e3798422508a89bc61f71cd0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153740
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-09 17:10:57 +00:00
Aske Simon Christensen cf6f8903a5 [vm] IL instruction for UTF-8 scan.
Speeds up decoding across the board, with medium-length pure ASCII
strings seeing about 2x on X64 and IA32.

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

Change-Id: I1c8e0bc69baaaeb6755d4c775e6fa0e6d18e1c57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148762
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-08 15:03:34 +00:00
Alexander Markov 4f3293c70e [vm/compiler] Recognize List.filled factory
Recognized factories have known result type and its type arguments
and length are automatically forwarded (length is forwarded only for
fixed-size lists).

List.filled factory is recognized only if optional 'growable' parameter
is not passed.

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

Change-Id: I0d63428f1c4667f3981447a939dbef67170e542e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149385
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-29 03:12:48 +00:00
Vyacheslav Egorov beb7114861 [vm/compiler] Add check to prevent inclusion of compiler headers into AOT runtime
This relands commit b0a71d364c

Cq-Include-Trybots: dart/try:vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: I1d32e5d0d44f4e422d188643b548ed81859f7d74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143807
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-17 13:11:08 +00:00
Alexander Aprelev c7861f309f Revert "[vm/compiler] Add check to prevent inclusion of compiler headers into AOT runtime"
This reverts commit b0a71d364c as it broke precomp builds.

Change-Id: Ieb776739b8d3e9ac74794e05fc20a793625e5f09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143865
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-04-16 23:51:09 +00:00
Vyacheslav Egorov b0a71d364c [vm/compiler] Add check to prevent inclusion of compiler headers into AOT runtime
#if defined(DART_PRECOMPILED_RUNTIME)
  #error "AOT runtime should not use compiler sources (including header files)"
  #endif  // defined(DART_PRECOMPILED_RUNTIME)

Remove #if defined(DART_PRECOMPILED_RUNTIME) from most compiler sources.

Change-Id: Id175c83fdbea38d9d5e1371ff433e3888f2afe8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143523
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-16 22:59:03 +00:00
Victor Lima b951498903 [vm/aot] Allow static methods to have unboxed args and return
Static methods and constructors may receive unboxed parameters.
This change adds a bitmap to the RawFunction object indicating
which parameters are unboxed and their types. Also, the stack frame
bitmap was updated to include new bits for those parameters.

The ArgumentsDescriptor object was updated to store not only the number
of arguments, but also their size, since 32-bit platforms would use two
words for each int64 and double value.

In addition, static methods that return non-nullable integers
and doubles may return these values unboxed.

Dart AOT x64:

TypedData.Uint8ClampedListViewVarBench  +11.73%
DeltaBlue                               +9.32%
Meteor (Intel Xeon)                     +4.64%

Flutter release android-armv8:

velocity_tracker_bench                  -2.32% (less is better)

flutter_gallery_readonlydata_size       +0.18%
flutter_gallery_total_size              +0.13%
flutter_gallery_instructions_size       +0.12%

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

Change-Id: I97e310f8f30213920af2333fbdedf193d03db5c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135313
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-05 15:17:04 +00:00
Samir Jindel 445ae73b32 [vm/tfa] Use pragma to pass type arguments to exact return types.
Change-Id: Ie2a1de07653c53e8b9506c54a0a66a5fe6503b9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129160
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-01-03 14:08:19 +00:00
Ryan Macnak b39ab2e6ac [vm] Don't unroll initialization code based on macro lists.
-47k (-0.20%) out/ProductX64/exe.stripped/dart
 -8k (-0.17%) out/ProductX64/exe.stripped/dart_precompiled_runtime

Change-Id: Id3f6c451acf69ba7965ae51a0a3c4a8aa9ab1d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115775
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 19:11:38 +00:00
Ryan Macnak cbdbb464ca [vm] Repair fingerprinting of recognized methods.
Bug: https://github.com/dart-lang/sdk/issues/36376
Change-Id: I8102d5d10abc98e4410c16d0d08bf5015e459b46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116481
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-09-11 01:11:34 +00:00
Daco Harkes 51f4574e50 Reland "[vm/ffi] Support structs on 32bit architectures"
Fixes alignment checks on GCC <= 7 and Clang <= 7.

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

Original CL is in patchset 1.

Tested GCC 7 and Clang 7 behavior of alignof and offsetof manually (our CQ uses newer tooling).

Change-Id: I828b00ad3d36be68a0d28b0a710fea938ca17784
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try, app-kernel-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-ffi-android-product-arm-try,vm-dartkb-linux-release-x64-abi-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112254
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-08-09 14:14:32 +00:00
Teagan Strickland 4932ee6d80 Reland "[vm/compiler] Use pragmas instead of separately-maintained lists for inlining."
This closes https://github.com/dart-lang/sdk/issues/36571.

Change-Id: I14c623aba6b7183191ae93e294e26af9f4dcf34f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110441
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-07-30 13:14:57 +00:00
Alexander Aprelev dd59b193c7 Revert 52cace8160 as it breaks flutter tests on android nexus 5x.
This reverts 'Reland "[vm/ffi] Support structs on 32bit architectures"' 52cace8160 reviewed on https://dart-review.googlesource.com/c/sdk/+/108818, reverts FfiStruct part of https://dart-review.googlesource.com/c/sdk/+/108724.

```
runtime/vm/compiler/ffi.cc:63:1: error: static_assert failed "FFI transformation alignment"
static_assert(alignof(double) == 4, "FFI transformation alignment");
^             ~~~~~~~~~~~~~~~~~~~~
runtime/vm/compiler/ffi.cc:64:1: error: static_assert failed "FFI transformation alignment"
static_assert(alignof(uint64_t) == 4, "FFI transformation alignment");
^             ~~~~~~~~~~~~~~~~~~
````

Change-Id: I0c3bf985f68b2184261e8999320f8ee89fe3f896
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110362
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-07-25 04:00:23 +00:00
Alexander Markov d3a09dda15 [vm/bytecode] Recognize list factories and set result type for static calls
Sudoku +15.62%

Issue: https://github.com/dart-lang/sdk/issues/36429
Change-Id: I58cde03ffc9788b2eebe889fcc1a98a82698c39a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109887
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-22 21:50:34 +00:00
Siva Annamalai 1eaaca642d Revert "[vm/compiler] Use pragmas instead of separately-maintained lists for inlining."
This reverts commit 33a757284b.

Reason for revert: This CL seems to depend on
@pragma('vm:never-inline')`
@pragma('vm:prefer-inline')`
being implemented which has been reverted.

Original change's description:
> [vm/compiler] Use pragmas instead of separately-maintained lists for inlining.
> 
> This closes https://github.com/dart-lang/sdk/issues/36571.
> 
> Change-Id: I4d77192f2c33dd4872d58ef07ccd32069b8b63df
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99154
> Commit-Queue: Teagan Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: Ied0686ad282f2ed772ff9adbc551f64ba8855aff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109340
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-07-16 22:44:50 +00:00
Teagan Strickland 33a757284b [vm/compiler] Use pragmas instead of separately-maintained lists for inlining.
This closes https://github.com/dart-lang/sdk/issues/36571.

Change-Id: I4d77192f2c33dd4872d58ef07ccd32069b8b63df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99154
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-07-16 10:37:02 +00:00
Daco Harkes 52cace8160 Reland "[vm/ffi] Support structs on 32bit architectures"
Fixed Flutter iOS build.

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

Change-Id: Idee38671cf0f33797824b37f08a92f32f931d8e0
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try, app-kernel-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-ffi-android-product-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108818
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-07-15 16:57:36 +00:00
Ben Konyi 70bafa8864 Revert "[vm/ffi] Support structs on 32bit architectures"
This reverts commit 0c9abb8816.

Reasoning: breaking iOS build for Flutter engine, blocking SDK roll.
Change-Id: I8905f09114a192202e5d1144d189ba0ae0fd62eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108962
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-07-12 22:40:51 +00:00
Daco Harkes 0c9abb8816 [vm/ffi] Support structs on 32bit architectures
Fixes: https://github.com/dart-lang/sdk/issues/36334

Change-Id: Ie22e7fe87724f8d2497934cd681908c9015bd2f2
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try, app-kernel-linux-debug-x64-try, vm-kernel-linux-debug-simdbc64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108103
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-07-11 16:50:38 +00:00
Stevie Strickland 13fa51ed54 [vm] Make Library::FindPragma a static method.
It already is a static method in implementation, so this way
we don't duplicate the work of looking up the library. In addition,
it checks has_pragma, so we don't need to check before calling it.

Change-Id: I88281cf22615e30157c842c570bd0f6b499a6a3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101821
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-05-08 14:49:45 +00:00
Alexander Markov ee529e3451 [vm] Fix typo forwader => forwarder
Change-Id: I67906e25ddaf2fb6650f61dad7c12c96b6367222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96821
Commit-Queue: Samir Jindel <sjindel@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-03-13 16:39:02 +00:00
Martin Kustermann 0ef66e0f5c [VM] Add @pragma("vm:non-nullable-result-type") annotation
A field/function annotated with this pragma must be guaranteed to not
return `null` at runtime.

Make use of this non-nullable annotation in the VM's type propagator.

Annotates the "_TypedListView._typedData" field to ensure the VM knows it
returns a non-nullable _TypedListView.

Furthermore annotates methods on the integer implementation.  Those particular
methods are recognized methods with a "dynamic" return type.  This caused
the type propagator to use CompileType::Dynamic() as result type.  Since a
previous CL started to only utilize the annotated type if it is better than
"dynamic" more integer operations got handled in-line, though with null-checks.
Annotating those methods to return non-null improves the in-line handling of
integer operations.

This improves dart-aot

On arm7hf:
  SHA256: +5%, SHA: +6%, JsonObjectRoundTrip: +7%, ...

On arm8:
  SHA1: +28%, MD5: +25%, SHA256: +15%, TypedData.Int16ListViewBench: +18.5%, StringInterpolation: +18%, ...


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

Change-Id: Ia4263a37241a36c9dc35e8a48893297effa6f4b2
Reviewed-on: https://dart-review.googlesource.com/c/84421
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-22 16:18:27 +00:00
Martin Kustermann 08a4e020b3 [VM] Get rid of duplicate return-type-cid information from method recognizer
When @pragma('vm:exact-result-type') was introduced, the return types
specified in the recognized method lists were **duplicated** (they were
in the method recognizer macro lists as well as in the dart source code).

This CL removes this duplication by removing the result types from the
method recognizer lists.

Change-Id: I2082110cf77fc3b97d1a541cb153abb8c17990d0
Reviewed-on: https://dart-review.googlesource.com/c/84220
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-22 11:53:27 +00:00
Martin Kustermann 94c325a889 Reland "[VM] Make @pragma annotations work generally"
Currently the @pramga('vm:exact-result-type') annotation only works if
the function is a recognized method.  This change changes that to make
the VM just look if a function has the annotation (no matter if it's
also in the list of recognized methods or not).

Furthermore this CL lets the type propgagator use
@pragma('vm:exact-result-type') annotations to narrow the [CompileType]
set on [LoadFieldInstr]s.

Since the @pragma is a general feature, this CL moves the
`Function::FindPragma()` to `Library::FindPragma` (which is where any
other metadata lookup happens).  We also let the `FindPragma` accept any
of Class/Function/Field objects.

Furthermore the `FindPragma()` function is fixed to handle the case
when the evaluation of the metadata results in an error.
In this case we simply claim to not have found a pragma annotation.

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

Change-Id: If03f566e334cd53549985823ee3dd6b5e9672969
Reviewed-on: https://dart-review.googlesource.com/c/85163
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-22 10:54:44 +00:00
asiva 0ca1c57593 Reland "[VM] Remove unused flags"
This is a reland of 1a4cff1bd4

Original change's description:
> [VM] Remove unused flags
> 
> Remove the following flags which are always ON
> --strong
> --reify_generic_functions
> 
> and these flags which are not applicable anymore
> --error-on-bad-override
> --error-on-bad-type
> --enable-type-checks
> 
> Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
> Reviewed-on: https://dart-review.googlesource.com/c/79431
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

Change-Id: Ib4452c22fb05eed38820708abb648939e03b1df0
Reviewed-on: https://dart-review.googlesource.com/c/84923
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-11-20 17:25:42 +00:00
Siva Annamalai f6c41ac3bc Revert "[VM] Remove unused flags"
This reverts commit 1a4cff1bd4.

Reason for revert: The precompiled arm bot failed a test.

Original change's description:
> [VM] Remove unused flags
> 
> Remove the following flags which are always ON
> --strong
> --reify_generic_functions
> 
> and these flags which are not applicable anymore
> --error-on-bad-override
> --error-on-bad-type
> --enable-type-checks
> 
> Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
> Reviewed-on: https://dart-review.googlesource.com/c/79431
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

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

Change-Id: Ib0fe4f33c044047ef1cb31bca9d38591176b7d40
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/84883
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-11-20 07:32:11 +00:00
asiva 1a4cff1bd4 [VM] Remove unused flags
Remove the following flags which are always ON
--strong
--reify_generic_functions

and these flags which are not applicable anymore
--error-on-bad-override
--error-on-bad-type
--enable-type-checks

Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
Reviewed-on: https://dart-review.googlesource.com/c/79431
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-20 06:41:06 +00:00