Commit Graph

50 Commits

Author SHA1 Message Date
Ryan Macnak b85a7fecd0 Reapply "[vm] Prefer stack bounds from the system thread library for overflow checks."
Mark some profiler tests on Windows as failing.

Bug: https://github.com/dart-lang/sdk/issues/31137
Change-Id: I46a5d4838443e5cfdac6043ea8dcfeb3d05d4823
Reviewed-on: https://dart-review.googlesource.com/14920
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-18 21:15:49 +00:00
Dmitry Stefantsov a227b168da Revert "Reapply "[vm] Prefer stack bounds from the system thread library for overflow checks.""
This reverts commit 5a022b9db6.

The reverted CL caused some redness on some vm and vm-precomp bots.

TBR=rmacnak@google.com
Change-Id: I9be670f3c3e341ec6d95082f288bc569834e38c7
Reviewed-on: https://dart-review.googlesource.com/13460
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2017-10-12 07:32:30 +00:00
Ryan Macnak 5a022b9db6 Reapply "[vm] Prefer stack bounds from the system thread library for overflow checks."
Fix accounting of guard pages to move the stack limit up instead of down.

Change-Id: I2f6577a12cf95707c186884f0bd3def03eac12ed
Reviewed-on: https://dart-review.googlesource.com/13381
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-10-12 02:17:11 +00:00
Ryan Macnak 6ecf6dd0a3 Revert "[vm] Prefer stack bounds from the system thread library for overflow checks."
This reverts commit af251ddfec.

Reason for revert: Crashes on Windows.

Original change's description:
> [vm] Prefer stack bounds from the system thread library for overflow checks.
> 
> Before this change, we would assume all stacks have the size the VM specifies for threads it creates, but this won't be accurate for the initial thread or threads created by the embedder.
> 
> Change-Id: I6605a88d6666a6f9d47fbe047d3fdd02aa22c80a
> Reviewed-on: https://dart-review.googlesource.com/10209
> Reviewed-by: Zach Anderson <zra@google.com>

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

Change-Id: I96eaccdc8edf6e3d319827a63d168534bad0518e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/13106
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-11 21:17:28 +00:00
Ryan Macnak af251ddfec [vm] Prefer stack bounds from the system thread library for overflow checks.
Before this change, we would assume all stacks have the size the VM specifies for threads it creates, but this won't be accurate for the initial thread or threads created by the embedder.

Change-Id: I6605a88d6666a6f9d47fbe047d3fdd02aa22c80a
Reviewed-on: https://dart-review.googlesource.com/10209
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-11 19:35:44 +00:00
Alexander Markov 5aead50245 [vm] Implement more efficient CAS in simarm/simarm64 modes, v.2
This CL includes db26c89347 (patch set #1)
with fix (patch set #2):
* Include simulator.h explicitly where it is required as it is no
  longer included implicitly through other header files.

Original review: https://codereview.chromium.org/2995803002/

When running on the simulator for arm/arm64, compare-and-swap operations
used in VM were synchronized with simulator using mutex.
It heavily impacts performance when doing parallel marking due to high
contention (see #30317).
This synchronization was implemented in order to make simulated
LDREX/STREX instructions aware of CAS performed in VM.

This CL drops this synchronization between VM and simulator:
CAS operations in VM become regular, and simulator remembers value loaded
with load-exclusive and performs CAS when doing store-exclusive to catch
any concurrent modifications.

Speeds up gen_snapshot of flutter benchmark complex_layout from 9.2s
to 8.0s on my MacBook.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2999853002 .
2017-08-14 11:10:29 -07:00
Alexander Markov 0ffe7148b8 Revert "[vm] Implement more efficient CAS in simarm/simarm64 modes"
This reverts commit db26c89347.

Review-Url: https://codereview.chromium.org/3000803003 .
2017-08-11 17:51:50 -07:00
Alexander Markov db26c89347 [vm] Implement more efficient CAS in simarm/simarm64 modes
When running on the simulator for arm/arm64, compare-and-swap operations
used in VM were synchronized with simulator using mutex.
It heavily impacts performance when doing parallel marking due to high
contention (see #30317).
This synchronization was implemented in order to make simulated
LDREX/STREX instructions aware of CAS performed in VM.

This CL drops this synchronization between VM and simulator:
CAS operations in VM become regular, and simulator remembers value loaded
with load-exclusive and performs CAS when doing store-exclusive to catch
any concurrent modifications.

Speeds up gen_snapshot of flutter benchmark complex_layout from 9.2s
to 8.0s on my MacBook.

R=asiva@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2995803002 .
2017-08-11 17:36:10 -07:00
Erik Corry 955a4b6e71 VM: Reland Inline instance object hash code into object header on 64bit.
Inline instance object hash code into object header on 64 bit.

64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.

This is both faster and a memory reduction. Eg it makes the
MegaHashCode part of the Megamorphic benchmark 6 times faster.

This is a reland of https://codereview.chromium.org/2954453002/
which fixes an issue that made script snapshots generated on
64 bit platforms incompatible with 32 bit VMs.

BUG=
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2965723002 .
2017-07-03 09:26:46 +02:00
Erik Corry 3c543bb210 Revert "VM: Reland Inline instance object hash code into object header on 64bit."
This reverts commit 8378b8fdbf due to
mysterious crashes on 32 bit ARM with the Flutter Gallery app.

R=aam@google.com
BUG=

Review-Url: https://codereview.chromium.org/2962543002 .
2017-06-26 23:06:09 +02:00
Erik Corry 8378b8fdbf VM: Reland Inline instance object hash code into object header on 64bit.
Inline instance object hash code into object header on 64 bit.

64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.

This is both faster and a memory reduction. Eg it makes the
MegaHashCode part of the Megamorphic benchmark 6 times faster.

This is a reland of https://codereview.chromium.org/2912863006/
It fixes issues with the 32 bit compare-swap instruction on
ARM64 and fixes a fragile tree shaking test that is sensitive
to which private methods are in the core libraries.

R=kustermann@google.com, vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2954453002 .
2017-06-22 14:56:24 +02:00
Erik Corry 847cd093ba Revert "Inline instance object hash code into object header on 64 bit."
This reverts commit ac6310d5f3 because
of test failures on real ARM64 hardware as opposed to the DartVM
simulator.  Original review: https://codereview.chromium.org/2912863006/

R=kustermann@google.com
BUG=

Review-Url: https://codereview.chromium.org/2953753002 .
2017-06-22 10:22:48 +02:00
Erik Corry ac6310d5f3 Inline instance object hash code into object header on 64 bit.
64 bit objects have 32 bits of free space in the header word.
This is used for the hash code in string objects. We take it
for the default hash code on all objects that don't override
the hashCode getter.

This is both faster and a memory reduction.  Eg it shaves about
70% off the running time of this microbenchmark:

List list = [];

class Thing {
  get hashCode => 42;
}

class Thing2 {
  get hashCode => 42;
}

class Thing3 { }
class Thing4 { }

main() {
  int sum = 103;
  for (int i = 0; i < 10000000; i++) {
    list = [];
    list.add("foo");
    list.add(123);
    list.add(1.23);
    list.add(new Object());
    list.add(new Thing());
    list.add(new Thing2());
    list.add(new Thing3());
    list.add(new Thing4());
    for (int j = 0; j < 2; j++) {
      sum ^= biz(list);
    }
  }
  print(sum);
}

int biz(List list) {
  int sum = 103;
  for (var x in list) {
    sum ^= x.hashCode;
  }
  return sum;
}

R=rmacnak@google.com, vegorov@google.com
BUG=

Review-Url: https://codereview.chromium.org/2912863006 .
2017-06-22 09:25:52 +02:00
Todd Turnidge 2d22e85cf0 Revert "Revert "JumpToFrame refactor"" + Fix
This reverts commit 1cdb3d2155.

I have also added in a fix for the lazy-deopt in exception handler case.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2506503002 .
2016-11-21 08:49:18 -08:00
Todd Turnidge 1cdb3d2155 Revert "JumpToFrame refactor"
This reverts commit 5ed13d3298.

BUG=

Review URL: https://codereview.chromium.org/2503623003 .
2016-11-14 15:57:01 -08:00
Todd Turnidge 5ed13d3298 JumpToFrame refactor
- Refactor the JumpToExceptionHandle code so that it is now built from
  two pieces: JumpToFrame and RunExceptionHandler.

- Refactor the Simulator::Longjmp() code so that it is no longer
  exception-specific.  Instead it uses the RunExceptionHandler stub.

This makes it so that the JumpToFrame stub and Simulator::JumpToFrame
have the same semantics.  This will make it easier to land the Rewind
changes I am working on.

There are some oddities for dbc.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2503653002 .
2016-11-14 14:38:21 -08: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
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Ryan Macnak e3420eab29 Revert "Pass new pool pointer to the JumpToException stub instead of reloading in through the frame's Code object."
This reverts commit 3413e052b3.

Review URL: https://codereview.chromium.org/2374173002 .
2016-09-28 13:00:00 -07:00
Ryan Macnak 3413e052b3 Pass new pool pointer to the JumpToException stub instead of reloading in through the frame's Code object.
This is prep work for lazy deopt without code patching.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2376843002 .
2016-09-28 10:15:09 -07:00
Ryan Macnak 59c52a5b64 Partially implement DBC profiler.
- Fix setting exit frame info to indicate when we are executing Dart code.
 - Copy local pc to memory on call and return to make it accessible to the profiler. Since the profiler cannot access the local pc, the profiler is not accurate at the instruction level.
 - Teach the profiler's stack walker that the stack grows up for Dart frames on DBC.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2250823002 .
2016-08-19 16:48:34 -07:00
Vyacheslav Egorov ee0f608ce4 Dart Byte Code interpreter.
This version is Clang/GCC only and does not support Windows because it uses computed goto's.

Only unoptimized mode is supported.

Architecture is described in constants_dbc.h and stack_frame_dbc.h.

R=fschneider@google.com, zra@google.com

Review URL: https://codereview.chromium.org/1858283002 .
2016-04-18 23:02:01 +02:00
Ryan Macnak cb210e3997 Enable concurrent sweep on MIPS and ARM64.
Compare ARM from commit f78517a5ba.

Closes #25651.

R=zra@google.com

Review URL: https://codereview.chromium.org/1722013002 .
2016-02-29 09:23:25 -08:00
Siva Annamalai a7ebeb00fb Add a CompareAndSwapUint32 variant to AtomicOperations so that it is possible to a CAS of a 32 bit value.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1562253002 .
2016-01-06 17:08:31 -08:00
Florian Schneider 28c5ba6bdc VM: Simplify assembler test by removing unused parameter.
No need to pass a Context into assembler tests.

BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1272223002 .
2015-08-06 10:24:14 +02:00
Daniel Andersson 6542a451c3 Refactor Isolate -> Thread in NativeArguments and exception handler jump.
Further reduces the one-to-one assumption about isolates and threads: native entries now ask the thread for its isolate, rather than the other way around.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1156143003
2015-05-26 16:49:51 -07:00
regis@google.com d5bace63ad Support profiling of simulated Dart code on mips, arm, and arm64.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45430 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-27 19:55:53 +00:00
koda@google.com b1634f7c30 Isolate -> Thread for tracking owner of mutex and simulator's exclusive access.
Prepares for multiple threads referencing the same isolate (in particular, the mutator and sweeper).

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44762 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-27 20:33:36 +00:00
regis@google.com d50fe1db24 Make instruction counter in simulators 64-bit (issue 22302).
This requires supporting uint64_t flag values.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43660 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-10 17:41:01 +00:00
regis@google.com fc919001c5 Improve generated MIPS code for conditional expressions and branches by delaying
emission of comparison code.
Improve instruction tracing in all simulators.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42555 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-22 20:50:15 +00:00
regis@google.com 0fb9f43f32 Complete and clean up breakpoint support in all 3 debuggers embedded in MIPS,
ARM, and ARM64 simulators.
Implement the same debugging commands in all 3 simulators: stop_sim_at flag, bt,
p icount, break, del, unstop, etc...

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42216 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-09 19:26:26 +00:00
johnmccutchan@google.com 456bdc4ea3 Enable the profiler on the simulator
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41752 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-14 23:15:00 +00:00
iposva@google.com 55357d2993 - Use the simulator to do atomic operations that could also
be executed in generated code.

R=koda@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41332 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-27 19:21:33 +00:00
regis@google.com 1026872687 Fix 32-bit and 64-bit carry out calculation in arm64 simulator.
Add support for 32-bit and 64-bit addition/subtraction with carry on simarm64.
Add assembler tests.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40989 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-08 07:22:06 +00:00
johnmccutchan@google.com e7ddd5d047 Move some isolate state setup from C++ code to JumpToExceptionHandler stub (take 3).
- CL is the same as take 2, but, I now prohibit the profiler from walking the call stack when the isolate is executing the jump to exception handler.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38300 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-16 18:03:17 +00:00
johnmccutchan@google.com 7366afd86e Revert r38240
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38257 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-15 20:48:20 +00:00
johnmccutchan@google.com efc684e4a8 Move some isolate state setup from C++ code to JumpToExceptionHandler stub
This change means that the isolate's top exit frame info and vm tag will only be updated after setting the frame pointer.

This is step one in a series of changes to allow the profiler to walk the stack when there is no frame pointer.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38240 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-15 16:39:19 +00:00
johnmccutchan@google.com 4d25b35657 Revert r38216
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38218 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 22:31:48 +00:00
johnmccutchan@google.com 8b99428010 Move some isolate state setup from C++ code to JumpToExceptionHandler stub
This change means that the isolate's top exit frame info and vm tag will only be updated after setting the frame pointer.

This is step one in a series of changes to allow the profiler to walk the stack when there is no frame pointer.

R=asiva@google.com, regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38216 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 21:59:49 +00:00
zra@google.com 436a06a381 Fixes to run "Hello, world!" on arm64 hardware.
Primarily, in Dart code, instead of using R31 as our
stack pointer, on entry we copy it into a second
register (R18) and use that as our stack pointer after
moving R31 to the Dart stack limit. On calling back
into C++ from Dart code, R31 is restored, and R18 is
cached in the callee-saved register R26.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36930 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-03 18:38:28 +00:00
zra@google.com 35d53f5a45 Beings adding SIMD support to arm64.
It's still disabled for now, while I continue working.

Also, I tried to use const a bit more consistently in
the arm and arm64 IL.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36465 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-22 00:17:33 +00:00
zra@google.com 5d94e8900f Adds single-precision and SIMD load/store to arm64.
Also adds conversion between double an single-precision floats.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35933 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-08 19:06:04 +00:00
zra@google.com 65946f752c Adds arm64 double arithmetic instructions.
Also adds:
- double comparison instructions,
- conditional increment instruction,
- double <-> int conversion instructions,
- IL instructions that use these,
- NoSuchMethod call stub,
- and bug fixes.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35830 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-06 20:50:44 +00:00
zra@google.com 5be8150a3a Begins work on arm64 floating point instructions.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35661 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-01 21:50:17 +00:00
zra@google.com 7d0b680f95 Adds Simulator Longjmp and enables many tests for arm64.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35603 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-30 23:07:47 +00:00
zra@google.com fde6c7a829 Adds Runtime call stub and Dart entry stub to ARM64.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35190 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-18 23:43:15 +00:00
zra@google.com 25d93a82e2 Adds simulator debugger and Stop to arm64.
Also replaces UNIMPLEMENTED in stubs with Stop so
we can enable generation.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35127 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-16 19:57:52 +00:00
zra@google.com 3a21a88e52 Adds comparisons, labels, branches.
Also adds compare-and-branch, test-and-branch, and
unconditional branch with 26-bit offset instrucitons
to the disassembler and simulator, but not to the
assembler, yet, since they'll require a bit more
work and this CL is getting big.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34993 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-11 20:40:11 +00:00
zra@google.com 5ed6eb4cb4 Adds ldr and str to arm64.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34831 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-08 15:43:16 +00:00
zra@google.com 2fe51715e5 Begins work on ARM64, first assembler test.
Most new code is in constants_arm64.h and
{assembler,disassembler,simulator}_arm64.{h,cc}

The rest of the CL just #def's out tests, modifies status files,
and adds UNIMPLEMENTED functions, etc.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34654 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-02 17:39:32 +00:00