Commit Graph

35 Commits

Author SHA1 Message Date
Vyacheslav Egorov a2acd59d73 [vm/ffi] Fix LR clobber in JumpToFrame stub on ARM
Both ARM and ARM64 variants did not account for the
fact that TransitionNativeToGenerated will clobber
LR on slow path.

TEST=tests/ffi/regress_jump_to_frame_test.dart

Cq-Include-Trybots: luci.dart.try:vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try
Change-Id: I40d48b720b2a7f31ff20903a887295ab2034662c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173962
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-27 09:11:49 +00:00
Tess Strickland e7a2fbe692 [vm/compiler] Unify TTS implementations across architectures.
The only architecture-specific part of type testing stubs (TTS) is which
registers get saved/restored across SubtypeTestCache stub calls in the
slow TTS implementation, which is now a register mask constant in the
TypeTestABI struct.

This CL also:

* Creates a single definition of OperandSize in assembler_base.h. Moves
  OperandSize into the compiler namespace.  assembler_base.h. Renames
  constants common to all architectures to neutral names (e.g., kWord =>
  kFourBytes), since "word" has different meanings across architectures.

* Creates a new JumpDistance enum for kNearJump/kFarJump in
  AssemblerBase and replace existing bool uses with the constants.

* Adds JumpDistance arguments to some of the generalized Assembler
  methods so they aren't forced to use far jumps on IA32/X64. These
  added JumpDistance arguments are ignored on ARM architectures.

* Adds a new generalized Assembler::LoadIndexedPayload method for
  loading indexed objects out of post-header variable-length payloads.

* Moved the OperandSize argument for LoadForOffset and similar methods
  on 32-bit ARM from being the first argument to being the second to
  last argument just to match other architectures, and to allow it to
  have a default value of kFourBytes.

TEST=Run on trybots of all architectures.

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-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
Change-Id: Ia930613e96db4d1ab324c5a355dca8994d2a77f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172160
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-17 15:09:47 +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
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
Liam Appelbe d49bf6f25a [vm] Remove misleading usings.
Patchset 1 contains just the usings I deleted (<100 lines). All the
other diffs in the rest of the CL are just fixing all the places that
were broken by this.

Bug: https://github.com/dart-lang/sdk/issues/36839
Change-Id: I3bb4fa62ab4363ded81fd7c2815b857f91886dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108502
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-07-10 22:20:10 +00:00
Liam Appelbe e4196ce8c6 [vm] Namespace constants like offsets and sizeofs to use runtime_api.h
Second sub-CL of https://dart-review.googlesource.com/c/sdk/+/100644
The first was here https://dart-review.googlesource.com/c/sdk/+/103487

Now that offsets_extractor is checked in, and we have a big header full
of hard coded constants, the next step is to make sure everything is
using those constants. This is essentially everything in the original
CL, except the new simarm_x64 architecture.

Bug: https://github.com/dart-lang/sdk/issues/36839
Change-Id: I236e4f30aa1df6d92209891c983b792d1835b608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104286
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-06-10 02:55:25 +00:00
Ben Konyi fea5413d5a [ VM ] Fix hang of Flutter engine tests caused by global RuntimeEntry objects being destroyed when exit() is called when the VM hasn't finished shutting down.
This is due to how Windows destroys objects as destroyed objects have
their vtables reset to the vtable of the base class. If this happens
when an isolate hasn't finished shutting down and a virtual function
which is overriding a pure virtual function from the base class is
called, _purecall() is invoked and attempts to call exit() again which
leads to a deadlock.

See issue #35855 for more details.

Change-Id: I93a0e00549e7ee87a717a6cde01bf0848050384d
Reviewed-on: https://dart-review.googlesource.com/c/92000
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-02-06 22:37:24 +00:00
Martin Kustermann 3c662736d9 [VM] Ensure PP is restored when returning from runtime calls in bare instructions mode.
Now that we have a moving GC it's no longer sufficient to rely on callee-saving
behavior of PP.

This change also ensures that all calls go through RuntimeEntry::Call() .

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

Change-Id: I159986dc18a9b201175fd4a7064a24a1533790ef
Reviewed-on: https://dart-review.googlesource.com/c/88711
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-01-09 08:34:55 +00:00
Ryan Macnak e2f99e4cee [vm] Update the profiler to account for the interpreter.
Also, remove paranoid checks from ProfilerDartStackWalker by
 - setting the VM tag to Dart only after initializing the exit slot
 - setting the VM tag to Runtime for leaf runtime function
 - bailing out when in the prologue of the invocation stub's callee

Change-Id: Ifd1caee2203f8863b17fc7d0072de32290fd0e60
Reviewed-on: https://dart-review.googlesource.com/c/84140
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-13 20:33:48 +00:00
Vyacheslav Egorov 8a179fb953 [VM, Compiler] Move compiler to a separate folder.
New folder structure (nested under vm/):

- compiler/
-   jit/         - JIT specific code
-   aot/         - AOT specific code
-   backend/     - all middle-end and back-end code (IL, flow graph)
-   assembler/   - assemblers and disassemblers
-   frontend/    - front ends (AST -> IL, Kernel -> IL)

compiler/README.md would be the documentation root for the compiler
pipeline

Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I2dfd9688793bff737f7632ddc77fca766875ce36
Reviewed-on: https://dart-review.googlesource.com/2940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-09-04 15:15:18 +00:00
Aske Simon Christensen 8cb752f73b Revised "Eliminate dependencies on assemblers and code stubs in precompiled runtime."
Explicitly clear unbox_numeric_fields flag in PRODUCT builds. Fixes code bloat introduced by previous CL. New changes in Patch Set 2.

BUG= https://github.com/dart-lang/sdk/issues/30045
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/3006923002 .
2017-09-04 13:13:26 +02:00
Ryan Macnak 9ce7fb5929 Revert "Reapply "Eliminate dependencies on assemblers and code stubs in precompiled runtime.""
This reverts commit 8ee4436355.

This change caused a 63% increase in AOT snapshot size of Flutter Gallery.

Issue #30472

Review-Url: https://codereview.chromium.org/2997993002 .
2017-08-17 13:33:37 -07:00
Aske Simon Christensen 8ee4436355 Reapply "Eliminate dependencies on assemblers and code stubs in precompiled runtime."
Also exclude references to disassembler in precompiled mode.

New edits are in patch set #2.

BUG= https://github.com/dart-lang/sdk/issues/30045
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2994863002 .
2017-08-12 02:15:23 +02:00
Ryan Macnak 3afd223f90 [gardening] Revert "Eliminate dependencies on assemblers and code stubs in precompiled runtime."
This reverts commit 46c53882cc.

This changes introduced link errors on Windows.

Review-Url: https://codereview.chromium.org/3001463002 .
2017-08-09 15:49:51 -07:00
Aske Simon Christensen 46c53882cc Eliminate dependencies on assemblers and code stubs in precompiled runtime.
Guard all excluded code behind conditional compilation.

Removed precompiled runtime flag. Only preprocessor flag remains.

BUG= https://github.com/dart-lang/sdk/issues/30045
R=rmacnak@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2976723003 .
2017-08-09 22:21:34 +02:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Ryan Macnak e386db978e Invoke CallToRuntime via Thread instead of ObjectPools.
Most functions use CallToRuntime for the stack overflow check.

precompiled dart2js arm 20388895 -> 20308640 (-0.39%)

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1778103003 .
2016-03-11 10:03:12 -08:00
Ryan Macnak dd7250323d Re-assign registers on ARM so PP and CODE_REG are below R7 (FP on iOS).
Also update descriptions of register availability in instrinsics.

1) Mechanical replacement in *arm.* files except the simulator and constants_arm.h (with sed).

R5 -> R9
R6 -> R8
R8 -> R10
R9 -> R5
R10 -> R6

2) Change register aliases.

CTX = R10 -> CTX = R6
PP = R9 -> PP = R5
ICREG = R5 -> ICREG = R9
CODE_REG = R10 -> CODE_REG = R6
THR = R8 -> THR = R10

3) Fixup users of ldrd/strd to have valid register pairs.

bigint_lsh
bigint_absadd
bigint_abssub
bigint_sqradd
TYPED_ARRAY_ALLOCATION
InlineArrayAllocation
AllocateArrayStub
AllocateContextStub

4) Fix PushList in MegamorphicMissStub to keep runtime call arguments in the right order.

BUG=http://dartbug.com/24683
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1419223003 .
2015-10-26 11:05:32 -07:00
Ryan Macnak 9d8dcd1288 Load runtime entries from the Thread instead of the ObjectPool.
Removes the need to relocate their ObjectPool entries when loading a precompiled snapshot.

Saves about ~2kB of ObjectPool in hello_world at the cost of ~400B/Thread (64-bit).

R=fschneider@google.com

Review URL: https://codereview.chromium.org//1315893004 .
2015-09-02 14:58:26 -07:00
Florian Schneider 7e082c1082 VM: Use constant pool also for leaf runtime calls on x64, arm, arm64 and mips.
Remove unused branch/call macro instructions from the assembler.

Setup a frame and pool pointer when invoking leaf runtime functions (in the
deoptimzation stub and store-buffer update stub).

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1314883002 .
2015-08-28 10:46:02 +02:00
Florian Schneider 63a8e5227d VM: More abstract interface for generating stub calls.
This makes the code in the code generator independent from how stubs
are actually called (i.e. directly embedding the target address, or
indirectly by loading the target address from the code object).

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1270803003 .
2015-08-05 10:18:35 +02:00
Florian Schneider 8d38a58c18 Make array allocation stub shared between isolates.
This allows to make the last explicitly named stubs shared between isolates.

When sharing code stubs, we can't do patching at their entry anymore.
Therefore, I had to remove patching support of the array allocation stub.
Is this a functionality we want to keep?

The change is mostly performance-neutral because optimized code has an inlined fast
path for array allocation and only uses the stub for the slow-case.

The only isolate-specific stubs left are object allocation stubs which are
associated with their Class are per-isolate.

Since this CL removes any isolate-specific stubs from StubCode, it becomes AllStatic.

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1247783002 .
2015-07-23 12:56:16 +02:00
Florian Schneider 957af25419 Use object pool for runtime calls.
Also, set up a stub frame with object pool loaded in all stubs on those
platforms.  This is a preparation step to making code relocatable.

ia32 is not affected because there is no object pool.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1189573004.
2015-06-17 10:37:52 +02:00
fschneider@google.com 1dc4e979d9 Remove isolate pointer from context objects.
By moving all stubs that do runtime calls into the isolate
we don't need to cache the current isolate in each context
object.

This saves space on each context at the cost of duplicating stubs
in each isolate. Most stubs are already isolate-specific and the total number
 of stubs is small enough for this to be a good trade-off.

R=vegorov@google.com

Review URL: https://codereview.chromium.org//668193002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41279 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-24 12:19:20 +00:00
rmacnak@google.com fbe77f8ab4 Specialize breakpoint stubs by set of live registers of the stubs they are intercepting.
Trades space in the constant pool for space at call sites.

R=fschneider@google.com

Review URL: https://codereview.chromium.org//339183010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38205 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 19:38:11 +00:00
rmacnak@google.com 5afea71262 Setup R10/EDX to be valid Oops before stub calls so when the debug stub saves them to the stack the GC doesn't try to deference out of the heap.
BUG=http://dartbug.com/19331
R=asiva@google.com, iposva@google.com

Review URL: https://codereview.chromium.org//335443002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37297 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-12 23:50:48 +00:00
iposva@google.com d36cd610cb - Use isolate where it is appropriate.
- Do not emit an name for ExternalLabel.

R=johnmccutchan@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//306483005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36662 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 10:15:50 +00:00
regis@google.com 8171570100 Fix the previously ineffective assert checking the number of arguments passed to
a runtime entry in the VM.

R=asiva@google.com

Review URL: https://codereview.chromium.org//23672011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26826 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 23:07:14 +00:00
regis@google.com 8f62a87598 Switch code generation on ARM from softfp ABI to hardfp ABI.
Support leaf float runtime calls in ARM simulator.
Enable previously failing tests.

R=zra@google.com

Review URL: https://codereview.chromium.org//16638012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23868 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-11 16:47:01 +00:00
regis@google.com 7766ac76d4 Implement leaf runtime call stub on ARM and corresponding call redirection
in ARM simulator.
Implement jump patching on ARM.
Add missing ICache flush calls.
Review URL: https://codereview.chromium.org//12439005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19724 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-08 21:16:46 +00:00
regis@google.com b95087eb73 Implement native call stub on ARM and native call redirection in ARM simulator.
Pass PatchStaticCall test.
Review URL: https://codereview.chromium.org//12629004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19704 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-08 18:22:14 +00:00
regis@google.com a879bba2ff Second codegen test passing on ARM (simulated).
This required support on ARM for:
- compilation of static calls
- patching of static calls
- stub to call into runtime
- redirection support for calls from simulator to host runtime
- stack frame iteration
Review URL: https://codereview.chromium.org//12381034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19405 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-04 18:08:38 +00:00
asiva@google.com 3107319e40 Simplify representation of stack frames. Remove the special types DartFrame/StubFrame and instead use StackFrame with methods IsDartFrame and IsStubFrame for frames representing Dart or Stub Code. This eliminates all the complexity that was added to ensure that we always see only one stub frame before hitting a dart frame during iteration.
Fixes bug 6380625 which was another case when we had two stub frames before hitting the dart frame.
Review URL: https://chromiumcodereview.appspot.com//10173008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6920 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-25 01:15:28 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00