Commit Graph

223 Commits

Author SHA1 Message Date
Ryan Macnak d36adbacaf [vm] Remove the VM isolate.
The former contents of the VM isolate are now included into each isolate group. This makes each isolate group's heap independent, and in particular allows each heap to be allocated to a separate pointer cage (not done in this CL).

The duplicated stubs that allowed PC relative calls are removed, since the originals can now be the target of PC relative calls.

The bootstrapping needing to load an AppJIT or AppAOT snapshot is reduced to allocating the oddballs. The code is entirely dropped in the AOT runtime, but the JIT runtime still has it to allow for flags to affect the compilation of the stub code. Further refactoring might be able to remove this for the JIT runtime too, with only gen_snapshot knowing how to bootstrap.

Class serialization no longer distinguishes predefined classes.

The page containing null is marked as never-evacuate. null, false and true must not move because the compiler relies on their low bits having certain patterns for some optimizations. (Previously, the entire VM isolate heap never moved.)

Compaction is disabled for IA32. Due to register pressure, some stub calls must not use a scratch register and embed the address of Code.

The page containing the call-through-safepoint stub is frozen when running with --write-protect-code and the stub is created at runtime (instead of loaded from an AppJIT or AppAOT snapshot). This stub must remain executable even during a safepoint, as a foreign call might during return during a safepoint and only block after the stub directs it to the runtime.

The snapshot symbols are renamed to kDartSnapshotData and kDartSnapshotText. There is no need to distinguish the VM isolate's snapshot, and snaphots are per isolate group not per isolate. Aliases with the old names are added to ease migration.

Some global flags that were automatically set based on the VM isolate's snapshot are now isolate group flags and automatically set by the isolate group's snapshot.

TEST=ci
Change-Id: Iee82016057d609112e9b021d178fc3d4d18b5044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500621
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-18 11:35:03 -07:00
Ryan Macnak 97886e6dbf [vm, ffi] Remove special case for Fuchsia FFI callback thunks, take 2.
Require the embedder to place a blob containing the FFI callback stub at pkg/lib/ffi_callback_stub.bin. All blobs in the package can be loaded as executable VMOs.

Also reapply "Remove special case for simulator FFI callback thunks."

TEST=ci
Change-Id: I6ab4a73fc28fb750e45e67797b0bf9deee9d8b53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495840
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-05-04 10:45:15 -07:00
Ryan Macnak df5cae97dc Revert "[vm, ffi] Remove special case for Fuchsia FFI callback thunks."
This reverts commit 61f45d66b2.
This reverts commit a0ab33ac52.
This reverts commit 68e2512ace.
This reverts commit fb732a570d.

TEST=ci
Bug: b/501539846
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try,vm-fuchsia-release-arm64-try,vm-ffi-mac-debug-simarm64_arm64-try,vm-ffi-mac-release-simarm64_arm64-try
Change-Id: I7f27bb15bf1fcb26fe8793a043b7530ed99a02a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495480
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-14 12:22:48 -07:00
Ryan Macnak fb732a570d [vm, ffi] Remove special case for Fuchsia FFI callback thunks.
TEST=ci
Bug: https://dartbug.com/52579
Change-Id: I2c1ca144253bc0dbeda53321aa6fe462698095b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493502
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-04-08 16:43:02 -07:00
Ryan Macnak 0a1678c06c [vm] Record stack for JIT TSAN.
The main interesting thing is that deopt can expand one optimized frame to multiple unoptimized frames, so deopt needs to call  __tsan_func_entry enough times to rebalance the stack.

Also fixes stack balance for throw error slow paths for AOT.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/61352
Change-Id: I3fdc8481bc8db7a3aec0fa1938ac3e0e96ac13a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452943
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-10-20 10:49:20 -07:00
Ryan Macnak c77f3db89c [vm] Switch switchable calls to load the target before the data.
Needed to be able to update call sites without pausing Dart execution.

TEST=ci
Change-Id: I8dd6e5cc4bec617da3c1198c6064cefbe86dbec2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441721
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-07-29 12:54:49 -07:00
Alexander Markov 4d3689138e [vm] Remove obsolete --[no-]unbox_doubles flag
All our target platforms support unboxed doubles and this obsolete
option is no longer used.

TEST=ci

Change-Id: I1d9214b49e875bc52e4f25650dacf8446a2e40a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371980
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-06-17 22:45:59 +00:00
Ryan Macnak 6c95160d23 [vm, compiler] Don't emit AOT instance calls with --no_polymorphic_with_deopt.
TEST=dartfuzz
Bug: https://github.com/dart-lang/sdk/issues/55622
Bug: https://github.com/dart-lang/sdk/issues/55623
Change-Id: Ib327d9cb2621eb6cfd509db83b2e04d17967d857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364960
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-05-02 17:52:02 +00:00
Alexander Markov b9b341f4a7 [vm] Simplify and optimize method extractors
Previously, method extractors (getter functions which return
tear-offs) where implemented in the following way:

Method extractor body is an asm intrinsic which loads a few registers
and jumps to BuildMethodExtractor stubs.
BuildMethodExtractor stub loads more registers, calls AllocateClosure
stub and initializes a few fields of a closure (this stub also used
to call AllocateContext but it is no longer needed for tear-offs).
AllocateClosure allocates a closure object and initializes closure
fields.

Instead of doing 2 hops to the object allocation, method extractor
body now calls AllocateClosure stubs directly which initializes
all closure fields. This saves a jump and a handful of instructions
to load certain things on registers and set closure fields.

Assembler intrinsic for method extractor body and
architecture-specific BuildMethodExtractor stubs are now removed.

Also, as method extractors are really tiny, they are now always
inlined.

TEST=ci

Change-Id: Icfeed18414659a76c7d24d3f6f53a76c91e5bbd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356302
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-03-11 15:56:33 +00:00
Ryan Macnak c5c578e671 [vm, ffi] Don't read out-of-bounds when marshalling structs by value.
Switch the Windows ARM64 builds to use MSVC. Clang disagrees with itself about handling of small structs in variadic functions, allowing splitting between the last argument register and the stack as the callee but not as the caller.

TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-linux-release-arm64-try,vm-mac-debug-arm64-try,vm-mac-release-arm64-try,vm-win-debug-arm64-try,vm-win-release-arm64-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-ia32-try,vm-linux-release-ia32-try,vm-win-release-ia32-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-mac-debug-x64-try,vm-mac-release-x64-try,vm-win-debug-x64-try,vm-win-release-x64-try
Bug: https://github.com/dart-lang/sdk/issues/52644
Bug: https://github.com/dart-lang/sdk/issues/53829
Change-Id: I2fd6c40620a885479f11bb8528ca1e9df3948a2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331209
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-11-14 19:23:33 +00:00
Daco Harkes 9fbaa62a1a [vm] Use SnapshotBehavior for switchable call pool entries
Follow up of:
* https://dart-review.googlesource.com/c/sdk/+/328861
* https://dart-review.googlesource.com/c/sdk/+/331087
* https://dart-review.googlesource.com/c/sdk/+/331120

The pool entries for switchable calls have their pool entries
transformed during snapshot loading in AOT. This behavior is now folded
into `SnapshotBehavior`.

Because snapshot behavior is set on the call sites, and the call sites
are already AOT specific, no conditionals inside app_snapshot.cc are
needed anymore.

The Arm64 implementation does not use the assembler for implicitly
adding pool entries, it does so explictly and loads two pool entries
in one load.

We could consider doing these explicit loads in the other architectures
as well. This would avoid adding the snapshot_behavior argument to
`LoadUnqiueObject` for the other architectures.

IA32 has no AOT support.

TEST=precomp bots

Change-Id: I75f70e00ca44f6545694d9b59e3ad08ad8bb3f8e
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-simriscv64-try,vm-aot-mac-product-arm64-try,vm-aot-win-debug-arm64-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-ffi-qemu-linux-release-arm-try,vm-aot-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331101
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-10-19 22:11:48 +00:00
Ryan Macnak 197ceef612 [vm] Remove dead megamorphic call resetting code.
AOT no longer emit call sites that immediately use the megamorphic dispatch stub. Such call sites are now generated as unlinked switchable call sites that may eventually transition to megamorphic.

TEST=ci
Change-Id: Iec342a2b3bc8fe27612bfa14b516e3c0512c1134
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331087
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-10-19 15:55:23 +00:00
Daco Harkes 243cf59776 [vm] Object pool SnapshotBehavior for bootstrapping native functions
`NativeCallInstr::EmitNativeCode` `link_lazily` code path uses the
new snapshotting behavior, and the non-`link_lazily` checks that it's
never snapshotted.

The snapshot behavior argument is threaded from the the EmitNativeCode
to the places where the pool entry is constructed.

Does not yet migrate `kSwitchableCallMissEntryPoint` and
`kMegamorphicCallEntryPoint`.

TEST=CI

Change-Id: I8dd1dc5aa525f888b493856c60ae385087463d02
Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-simriscv64-try,vm-aot-linux-release-arm64-try,vm-aot-android-release-arm64c-try,vm-aot-win-debug-arm64-try,vm-aot-mac-product-arm64-try,vm-mac-debug-arm64-try,vm-ffi-android-debug-arm-try,vm-ffi-qemu-linux-release-arm-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-aot-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328861
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-10-18 13:27:26 +00:00
Ryan Macnak 785f4d649e [vm, ffi] Windows ARM64 varargs.
- Don't use float registers
- Even for the fixed arguments before the variable arguments
- These changes apply only to the arguments not the result

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52644
Change-Id: Ifa600a929f9a54b44e78a6f15eafe1cee7141466
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329803
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-10-12 16:50:23 +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
Vyacheslav Egorov 27230ae008 [vm/compiler] Split ParallelMove codegen into scheduling and emission
This CL does not contain any changes to behaviour, but simply moves
ParallelMoveResolver to a separate file. Additionally instead of
immediately generating code we produce a move schedule which is
attached to the ParallelMoveInstr and later converted to the
native code.

This refactoring prepares the code for subsequent improvements, e.g.
we want to rework how temporaries used by move resolution are
allocated: instead of pushing/poping them around every move that needs
them we will allocate space for them in spill area.

Having ParallelMove scheduling separated from code emission also
allows to unit test it.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64c-try,vm-aot-linux-product-x64-try,vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try
Change-Id: Ifeb17940f4cfb3c0cc004cb3f74895f0d3c2b7bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285840
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-02-28 12:21:41 +00:00
Slava Egorov e5ea38a757 Revert "[vm/compiler] Split ParallelMove codegen into scheduling and emission"
This reverts commit 32b093379b.

Reason for revert: various test failures across the board.

Original change's description:
> [vm/compiler] Split ParallelMove codegen into scheduling and emission
>
> This CL does not contain any changes to behaviour, but simply moves
> ParallelMoveResolver to a separate file. Additionally instead of
> immediately generating code we produce a move schedule which is
> attached to the ParallelMoveInstr and later converted to the
> native code.
>
> This refactoring prepares the code for subsequent improvements, e.g.
> we want to rework how temporaries used by move resolution are
> allocated: instead of pushing/poping them around every move that needs
> them we will allocate space for them in spill area.
>
> Having ParallelMove scheduling separated from code emission also
> allows to unit test it.
>
> TEST=ci
>
> Change-Id: If3f7a88836037a9812a85c1cfc2ef21a7fe15747
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284222
> Commit-Queue: Slava Egorov <vegorov@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Change-Id: I82952d024816327ca5f084a2185fa1ab566cfa82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285560
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-02-25 22:03:08 +00:00
Vyacheslav Egorov 32b093379b [vm/compiler] Split ParallelMove codegen into scheduling and emission
This CL does not contain any changes to behaviour, but simply moves
ParallelMoveResolver to a separate file. Additionally instead of
immediately generating code we produce a move schedule which is
attached to the ParallelMoveInstr and later converted to the
native code.

This refactoring prepares the code for subsequent improvements, e.g.
we want to rework how temporaries used by move resolution are
allocated: instead of pushing/poping them around every move that needs
them we will allocate space for them in spill area.

Having ParallelMove scheduling separated from code emission also
allows to unit test it.

TEST=ci

Change-Id: If3f7a88836037a9812a85c1cfc2ef21a7fe15747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284222
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-02-25 16:54:05 +00:00
Vyacheslav Egorov 93e73bf93a [vm/compiler] Rename PushArgument to MoveArgument
This is follow up to 65f4a733bb,
which switched optimized code to use fixed frame for outgoing
arguments.

Change Kernel to IL translation to handle null-checks in
invocations differently: this code used to duplicate receiver on
the stack to accomodate for PushArgument in unoptimized code, but
PushArgument has not been inserted since f4e61eacfd,
which means duplication of the receiver is no longer necessary.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try
Change-Id: I6c1f1e8c354f9ea92424b6602b83b9e9ebce8b69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284184
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-02-20 14:57:57 +00:00
Vyacheslav Egorov 65f4a733bb [vm/compiler] Stop pushing arguments in optimized code.
After this change we no longer push outgoing arguments for normal
Dart calls, but instead simply move them into an area reserved for
outgoing arguments at the top of the frame. This allows us to stop
mutating SP and avoid explicit Drop(argc) after each call.

There are still other places in the generated code where we
push something onto the stack either to free a temporary
register or spill a value across a slow-path call.

This is the first step towards switching to native SP on ARM64.

# Code Size Impact

I have tested this on a large internal application and got the
following size delta

## ARM

|        | Before   | After    | Delta   |       |
|--------|----------|----------|---------|-------|
| ROData | 6366632  | 6463680  | +97048  | +1.5% |
| Code   | 22714192 | 22043984 | -670208 | -2.9% |
| Total  | 33723701 | 33150477 | -573224 | -1.6% |

## ARM64

|        | Before   | After    | Delta   |       |
|--------|----------|----------|---------|-------|
| ROData | 7122032  | 7214288  | +92256  | +1.3% |
| Code   | 21607196 | 20741788 | -865408 | -4.0% |
| Total  | 33375769 | 32602544 | -773225 | -2.3% |

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm64-try
Bug: https://github.com/dart-lang/sdk/issues/39083
Change-Id: Icace0c986285b9c16e41786cded44f88277bd25f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282029
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-02-16 19:22:45 +00:00
Ryan Macnak 715866aed3 [vm, compiler] Remove quadratic time spent verifying handle lifetime.
Instead of checking whether a handle is a zone handle rather than a scoped handle by iterating the zone handle blocks, reserve an extra slot in debug mode to record the handle's lifetime.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50408
Change-Id: I121c76d02b03e5d2141450077bc6e9da3cb60a5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268801
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-11 18:37:44 +00:00
Vyacheslav Egorov 83ab5d5ca3 [vm] Remove dynamic field unboxing in JIT
Instead apply the same approach as we do in AOT: unbox based on the
static type information. There are no TFA results available in JIT,
but we could still unbox fields when running in sound null-safety.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-linux-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-rollback-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-linux-debug-simriscv64-try,vm-kernel-precomp-linux-debug-simriscv64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try
Change-Id: Ide2e78c6659261ef8d245a4586cf699ea0fbb459
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256211
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-09-20 13:42:45 +00:00
Vyacheslav Egorov 912577baec [vm] Follow up to 4a4eedd860
* Avoid calling memmove(dst, nullptr, 0) as this is flagged by UBSAN.
* Avoid hitting a bug[1] in the linker: LLD's identical code folding
(ICF) happens to replace RecordCoverageInstr::DebugName() with
DispatchTable::LargestSmallOffset() because they happen to contain
the same machine code, ICF fails to accomodate that DebugName also
contains a relocation to constant string. To avoid this we simply
eliminate LargestSmallOffset and replace it with a constant. Same for
OriginElement.

TEST=manually tested previously failing tests

[1]: reported https://github.com/llvm/llvm-project/issues/57693

Change-Id: I38637df6475c7670081b7af0a2de75ca37f6f07c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258801
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-09-12 12:33:57 +00:00
Alexander Markov af4da780be [vm] New async/async* implementation in JIT mode
The new implementation is based on suspend/resume stubs and doesn't
use desugaring of async functions on kernel AST.

Previously, new implementation of async/async* was only supported in
AOT mode. This change adds all necessary bits for the JIT mode:

 * Suspending variable-length frames (for unoptimized code).
 * Handling of Code and pool pointers in Dart stack frames.
 * OSR.
 * Deoptimization.
 * Hot reload.
 * Debugger.

The new implementation is not enabled in JIT mode yet.

Design doc: go/compact-async-await.
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I477d6684bdce7cbc1edb179ae2271ff598b7dcc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246081
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-06-02 23:39:45 +00:00
Ryan Macnak ec56446604 [vm, compiler] Various stub calls do not need to be patchable.
TEST=ci
Change-Id: Icdaed8bd764e72646732e73cb8fbb35d283261f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244540
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-05-16 17:23:49 +00:00
Ryan Macnak 2cf4bf72a8 [vm, compiler] Handle large offsets with double spill slots on RISC-V.
Fix non-existent addressing mode in ARM fpu spilling.

TEST=ci
Change-Id: I0ecb973059a6cab11dce5b87137b54e0d1ac5ac5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243703
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-05-05 22:11:17 +00:00
Alexander Markov c3e0d770dd [vm] Introduce FUNCTION_REG constant
This refactoring introduces FUNCTION_REG constant for a register
containing target function object when calling Dart functions in JIT
mode. This register is similar to CODE_REG and ARGS_DESC_REG
registers which are also a part of Dart calling conventions.

Hardcoded registers are replaced with new constant where
appropriate. Also, ARGS_DESC_REG and IC_DATA_REG are used instead of
hardcoded registers in more places.

TEST=ci (pure refactoring)

Change-Id: I9e71022d7bca8d4e555b9e4f22558f388073495f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243681
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-05-04 22:59:24 +00:00
Alexander Markov 4075e8b3f9 [vm] New async*/yield/yield* implementation based on suspend/resume stubs
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I0c2ca9269b2c8f008a79c139a0ce10231996732d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242923
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-05-02 20:53:01 +00:00
Alexander Markov bf4bb95308 [vm] New async/await implementation in the VM, part 2 - vm
The new implementation moves away from desugaring of async
functions on kernel AST, state machine generated in the flow graph and
capturing all local variables in the context.

Instead, async/await is implemented using a few stubs
(InitSuspendableFunction, Suspend, Resume, Return and
AsyncExceptionHandler). The stubs are implemented in a
platform-independent way using (macro-)assembler helpers.
When suspending a function, its frame is copied into a SuspendState
object, and when resuming a function it is copied back onto the stack.
No extra code is generated for accessing local variables.
Callback closures are created lazily on the first await.

Design doc: go/compact-async-await.

Part 1 (kernel): https://dart-review.googlesource.com/c/sdk/+/241842

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Ibad757035b7cc438ebdff80b460728b1d3eff1f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242000
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-04-29 01:03:50 +00:00
Tess Strickland 95d1ae911d [vm] Reduce class id reloads in TTSes when possible.
Now GenerateCidRangesCheck in the flow graph compiler returns
whether the class id register was clobbered, so users that
make multiple calls to it for the same cid know whether the cid
needs reloading after the generated check.

Also unifies FlowGraphCompiler::EmitTestAndCheckCid across
architectures, since the non-Intel versions would have
always forced reloading.

TEST=vm/cc/TTS

Change-Id: I08835dc97ba457b7dc8dfa51206b4741a607db22
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-nnbd-mac-release-arm64-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-linux-debug-simriscv64-try,vm-kernel-precomp-linux-debug-simriscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238583
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-03-29 08:03:35 +00:00
Ryan Macnak 5f45f9f46d [vm, compiler] Assume availability of VFP when targeting ARM32.
This is not implied by ARMv7 per se, but is implied by the Debian and Android ABIs.

TEST=ci
Change-Id: Ie838eeec0e7e2e7e64e29e9ad69338532df16cbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/223740
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-12-14 20:05:55 +00:00
Vyacheslav Egorov 71c9c2cd83 [vm] Remove support for non-bare AOT snapshots
Every AOT user out there has been using bare instructions mode
and continuing to maintaining non-bare instructions mode simply
adds costs (both in terms of time spent making changes to work
in a mode that is not used and CI resources spent on testing it).

This change removes FLAG_use_bare_instructions and changes the code
to assume that FLAG_precompiled_mode implies bare instructions.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,app-kernel-linux-release-x64-try,app-kernel-linux-debug-x64-try
Change-Id: I5032b13bfcb613f79865f2cfa139cca8d1b42556
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220964
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-11-24 13:03:52 +00:00
Vyacheslav Egorov 8bdae002f1 [vm] Fix symbolization of future listener frame.
For future listener frames async unwinding produces frames with
`pc_offset` set to 0, because this frames correspond to closures
which will be invoked once the future completes. Such frames
are different from most other frames which correspond to real
call or yield locations within native code and have non-zero
`pc_offset`.

Because there is no call-/yield- site at 0 compiler does not emit
any source location information into CodeSourceMap and consequently
runtime can't produce much beyond file name in the stack trace for
these special frames.

To make matters worse ordering of code objects in the AOT snapshot
could affect symbolization of such frames - sometimes resulting in
an arbitrary token position being attached to the symbolized frame.

This CL adds more special handling of these frames into
StackTrace::ToCString and changes compiler to emit a dummy source
position descriptor for the start of every closure function.

This descriptor is encoded as

    ChangePosition function.token_pos()
    AdvancePC 0

in the CodeSourceMap. This entry is then handled specially when
generating DWARF.

This is reland of https://dart-review.googlesource.com/c/sdk/+/219781 with
fixes for ARM build.

TEST=vm/dart{,_2}/causal_stacks/async_throws_stack_lazy{,_lazy_non_symbolic}_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try
Change-Id: I06f80c1125422675758917ea12cdf2c70a2f6deb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219795
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-11-10 17:52:03 +00:00
Slava Egorov df38f320ee Revert "[vm] Fix symbolization of future listener frame."
This reverts commit 64d30f848b.

Reason for revert: breaks ARM build.

Original change's description:
> [vm] Fix symbolization of future listener frame.
>
> For future listener frames async unwinding produces frames with
> `pc_offset` set to 0, because this frames correspond to closures
> which will be invoked once the future completes. Such frames
> are different from most other frames which correspond to real
> call or yield locations within native code and have non-zero
> `pc_offset`.
>
> Because there is no call-/yield- site at 0 compiler does not emit
> any source location information into CodeSourceMap and consequently
> runtime can't produce much beyond file name in the stack trace for
> these special frames.
>
> To make matters worse ordering of code objects in the AOT snapshot
> could affect symbolization of such frames - sometimes resulting in
> an arbitrary token position being attached to the symbolized frame.
>
> This CL adds more special handling of these frames into
> StackTrace::ToCString and changes compiler to emit a dummy source
> position descriptor for the start of every closure function.
>
> This descriptor is encoded as
>
>     ChangePosition function.token_pos()
>     AdvancePC 0
>
> in the CodeSourceMap. This entry is then handled specially when
> generating DWARF.
>
> TEST=vm/dart{,_2}/causal_stacks/async_throws_stack_lazy{,_lazy_non_symbolic}_test
>
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try
> Change-Id: I80740dd2c3cb03d6c03c35e1b3bde2cacbe033e0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219781
> Commit-Queue: Slava Egorov <vegorov@google.com>
> Reviewed-by: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Clement Skau <cskau@google.com>

TBR=vegorov@google.com,cskau@google.com,sstrickl@google.com

Change-Id: I134ed9e5ccd1dbf3f7c07d046d92be298fe96eb3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219794
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2021-11-10 16:35:36 +00:00
Vyacheslav Egorov 64d30f848b [vm] Fix symbolization of future listener frame.
For future listener frames async unwinding produces frames with
`pc_offset` set to 0, because this frames correspond to closures
which will be invoked once the future completes. Such frames
are different from most other frames which correspond to real
call or yield locations within native code and have non-zero
`pc_offset`.

Because there is no call-/yield- site at 0 compiler does not emit
any source location information into CodeSourceMap and consequently
runtime can't produce much beyond file name in the stack trace for
these special frames.

To make matters worse ordering of code objects in the AOT snapshot
could affect symbolization of such frames - sometimes resulting in
an arbitrary token position being attached to the symbolized frame.

This CL adds more special handling of these frames into
StackTrace::ToCString and changes compiler to emit a dummy source
position descriptor for the start of every closure function.

This descriptor is encoded as

    ChangePosition function.token_pos()
    AdvancePC 0

in the CodeSourceMap. This entry is then handled specially when
generating DWARF.

TEST=vm/dart{,_2}/causal_stacks/async_throws_stack_lazy{,_lazy_non_symbolic}_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try
Change-Id: I80740dd2c3cb03d6c03c35e1b3bde2cacbe033e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219781
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-11-10 14:50:23 +00:00
Ryan Macnak 779dfaa63b [vm, compiler] Remove some unnecessary loads of null on ARM64.
TEST=ci
Change-Id: Ie3cb4bb919a200d22853184c0c28903efc2e5bd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218783
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-11-02 16:36:02 +00:00
Ryan Macnak d89e42bef5 [vm] Rename clustered_snapshot.h/cc to app_snapshot.h/cc.
Since bbefc05748, both serialization formats in the VM are based on clustering. The distinguishing feature of the older clustered serializer is that it represents apps/programs rather than messages.

TEST=ci
Change-Id: If3185c21c6aadeec61a940b12ba23d17f2752761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211501
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-09-16 00:13:34 +00:00
Alexander Markov 2765b7c911 [vm/compiler] Cleanup passing of try_index
FlowGraphCompiler::CurrentTryIndex() always returns correct try_index,
even when generating slow path code. So we can cleanup passing of
try_index for slow paths.

Also, removed unnecessary arguments from EmitMegamorphicInstanceCall as
it is no longer called on slow paths.

TEST=ci

Change-Id: I2fc29914c0c45068c1732eac27f3da3fd4da6823
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213411
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-15 16:51:17 +00:00
Alexander Markov 307bc3ef2c [vm] Faster double.toInt() in AOT mode
double.toInt() micro-benchmark on AOT/x64:
Before: BenchToInt(RunTime): 438.67258771929824 us.
After:  BenchToInt(RunTime): 118.8603434955726 us.

double.floor() micro-benchmark on AOT/x64:
Before: BenchFloor(RunTime): 537.2132688691916 us.
After:  BenchFloor(RunTime): 321.2052352657781 us.

TEST=ci
Issue https://github.com/dart-lang/sdk/issues/46876
Issue https://github.com/dart-lang/sdk/issues/46650

Change-Id: Id37c827bceb7f374ae5b91b36871ccf0d9e92441
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211620
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-01 16:57:59 +00:00
Alexander Markov 25d0ae2304 [vm/compiler] Support UnboxedDouble representation in unoptimized code
In the unoptimized code unboxed double inputs are now unboxed in the
instruction prologue, and unboxed double output is boxed in the
instruction epilogue. Double values are still always boxed on the
expression stack in the unoptimized mode.

Support for unboxed doubles in unoptimized code allows us to have
one implementation of double and dart:math built-in functions,
shared across optimized and unoptimized modes.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/46650
Change-Id: Ic1e42b72ee80cb2c12019b7abab8111240b05efd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211302
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-08-26 23:21:56 +00:00
Tess Strickland 0920ac883c [vm] Ensure only generic closures have empty delayed type arguments.
Closures created via Closure::New() set the delayed type arguments to
the null type argument vector for non-generic closure functions and to
the empty type argument vector for generic closure functions.  However,
closures created via the method extractor stub would always have the
empty type argument vector for delayed type arguments.  Make the two
consistent by creating two method extractor stubs, one for generic
extracted methods and one for non-generic ones.

With this change, Closure::IsGeneric simply compares the delayed type
arguments against the empty type argument vector. This change also makes
method extraction for non-generic functions slightly faster, since the
delayed type arguments field is not changed post-allocation.

The old version of Closure::IsGeneric was the only use of
Closure::NumTypeParameters, so remove the latter method.

Related cleanups:

* Use similar checks for Class::IsGeneric and FunctionType::IsGeneric,
  since they only have non-null type_parameters fields when generic.
  For Class::IsGeneric, this avoids having to fetch the current thread
  if the class declaration has been loaded.

* Refactor methods that read packed fields in FunctionType into two
  methods, a static method that takes a FunctionTypePtr and an instance
  method that calls the static method. Replace the methods in Function
  that also directly read FunctionType packed fields with delegations to
  the static methods.

* Rework Closure_equals to avoid unneeded handle allocation in certain
  cases for non-equal closures.

* Replace cases that allocates a handle for the closure function only
  for retrieving the signature with calls to Closure::signature().

TEST=language_2/closure/tearoff_dynamic_test
     language_2/regress/regress45890_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try
Change-Id: I29c8859c3350ed7b3f1a8f71d82a4393496b7c2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206820
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-07-15 22:51:57 +00:00
Liam Appelbe 155ac440f7 [vm] Migrate Arrays and Instances to compressed pointers
Change-Id: I8264b340ee91d883afc52a52e83cda504f552e37
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191302
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-06-24 17:31:12 +00:00
Martin Kustermann e674aa456f [vm/compiler] Make deopt env mandatory for FGC metadata emitting methods.
Slightly related to https://github.com/dart-lang/sdk/issues/45213

TEST=Existing test suite.

Change-Id: I63572d4fda838984ebb6010ef39c2cf3bd2b2958
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200643
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-05-20 11:20:52 +00:00
Martin Kustermann 535b53659b [vm/compiler] Remove dangerous FlowGraphCompiler::GenerateRuntimeCall
Doing any runtime call inside an `<XXX>Instr::EmitNativeCode()` is dangerous
because doing so almost always would require adjusting the lazy-deopt
environment to ensure the continuation in unoptimized code would have
the right stack state when returning from a runtime call.

=> Going to runtime should almost always happen via a stub call.

To discourage using runtime calls inside `EmitNativeCode()` functions we
remove the `FlowGraphCompiler::GenerateRuntimeCall()` helper method.

The remaining runtime calls used in `EmitNativeCode()`s fall into three
categories:

  * StackOverFlowInstr: In this particular case the deopt environment
    wouldn't need to be modified.
  * leaf runtime calls: Those do not need any metadata (neither deopt
    nor stackmaps) - since leaf runtime entries cannot safepoint
  * unopt-only runtime calls: Those do not need any metadata (neither
    deopt nor stackmaps) - since all slots in unoptimized frames are
    GC-able and unoptimized frames cannot be lazy-deoptimized.

We add assertions for the latter to cases with a comment to make it
clear.

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

TEST=Only adds assertions.

Change-Id: Idb8badfbe65fff55585959338129405c71908d25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199042
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-05-12 09:14:50 +00:00
Ryan Macnak a6ffc74a4a [vm] Switch most Instances whose layout is determined in C++ to compressed pointers.
Instances whose layout must agree with a layout determined by Dart code are not switched: Array, GrowableObjectArray, Closure, LinkedHashMap.

TEST=ci
Change-Id: I19baf6473a29dd14f84aa1e087eee16b0e6e9d77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193442
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2021-04-05 17:43:16 +00:00
Martin Kustermann dec7b4f5b6 [vm/compiler] Avoid pruning deopt environments during SSA construction
Generally speaking, the optimizing compiler should be able to use
(deopt-id, deopt-environ) of any IR instruction and use it as an eager
deopt target (e.g. optimizing compiler might insert TestCidsInstr
with eager (deopt-id, deopt-environ) from AssertAssignable).

Currently we prune the environment eagerly during SSA construction for
some instructions This pruning breaks the above mechanism, since the
deopt-environ isn't usable as eager deopt target. (It is effectively
changing the environment on the IR instruction to be a lazy-deopt
environment).

This CL makes the [Environment] represent both the eager deopt target as
well as the lazy deopt target. It distinguishes the two by remembering
how many slots the eager deopt target needs to be pruned to come to the
lazy deopt target. The SSA construction will populate this information.

Effectively we move the deopt env pruning from SSA construction to the
place when we need it (e.g. inlining, emitting after-call metadata).

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

TEST=Refactoring of existing code.

Change-Id: I6c2a117b33f35764e556372484e4beaa294b708d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192141
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-03-23 12:22:16 +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
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
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
Martin Kustermann 0f76981bb1 [vm/concurrency] Change references to class_table/object_store/heap from Isolate to IsolateGroup
As part of making the compiler and other subsystems independent
of `Isolate` we have to move various state from `Isolate` to
`IsolateGroup`.

The class_table and object_store were already moved to `IsolateGroup`.

This CL only replaces usages of `Isolate::{object_store,class_table}`
with the equivalent in `IsolateGroup`.

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

TEST=Pure refactoring - relying on existing test coverage.

Change-Id: I34a0682d715b054d6c5faff077a513980f59a348
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177126
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-01-06 15:22:11 +00:00