Ryan Macnak
9e5dbadc73
[vm] Use consistent signatures for native call wrappers and native function symbolizers.
...
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: I0d52d935c15f4d01d56e5e99bc4b83b31678a6ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146940
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Martin Kustermann <kustermann@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2020-05-07 16:16:08 +00:00
Ryan Macnak
6fe15f6df9
[vm] Represent tagged pointers as C++ value types instead of C++ pointer types.
...
This works around bugs in UndefinedBehaviorSanitizer and Clang.
Bug: b/28638298
Change-Id: I6be595f9664516019d28017d24559583a1ae3a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144354
Commit-Queue: Ryan Macnak <rmacnak@google.com >
Reviewed-by: Vyacheslav Egorov <vegorov@google.com >
2020-04-25 05:21:27 +00:00
Aart Bik
7e99f49629
[vm/compiler] general rbit utilities
...
Rationale:
Useful to implement the simulator, but also useful
in the future when compiler wants to constant fold
operations related to bit reversal.
https://github.com/dart-lang/sdk/issues/38346
Change-Id: I2f09ba6b1897202b5c07a2cff771afd7bbc99495
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119703
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Ryan Macnak <rmacnak@google.com >
Commit-Queue: Aart Bik <ajcbik@google.com >
2019-10-02 20:37:10 +00:00
Aart Bik
2c3f0fc359
[vm/assembler] Add rbit to ARM32
...
Rationale:
We are adding library support for bit operations:
lowZeroBitCount/highZeroBitCount/nonZeroBitCount
The rbit on AM32 will enable very efficient direct
native implementations of these operations in the
DartVM codegen.
https://github.com/dart-lang/sdk/issues/38346
Change-Id: Icedf4af301b5c8011922fccb1530a9c28e5c0964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119600
Reviewed-by: Ryan Macnak <rmacnak@google.com >
Commit-Queue: Aart Bik <ajcbik@google.com >
2019-10-02 17:34:10 +00:00
Daco Harkes
544371c7f2
[vm] Refactor constants to be available in namespaces dart and dart::host
...
Refactoring motivation: go/dart-simulated-ffi
Change-Id: I219aba2793cfb7d7ea5ecc0a2ab93276c6cbf1e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97325
Reviewed-by: Samir Jindel <sjindel@google.com >
2019-04-08 09:45:27 +00:00
Ryan Macnak
30896b87f1
[vm] Fix crash when enum initialization hits a stack overflow.
...
Give the compiler more headroom.
Have the simulators and interpreters distinguish between the true stack limit and the limit for trigger an overflow exception.
Bug: https://github.com/dart-lang/sdk/issues/35224
Bug: https://github.com/flutter/flutter/issues/25041
Change-Id: I048d73b649b4ce1f3d9b5a33d898ee9cfe54f6ca
Reviewed-on: https://dart-review.googlesource.com/c/86821
Reviewed-by: Aart Bik <ajcbik@google.com >
Reviewed-by: Régis Crelier <regis@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
2018-12-10 23:40:21 +00:00
Ben Konyi
07852532e3
[ VM ] Additional cleanup in Dart_Initialize and Dart_Cleanup
...
Change-Id: I6dc02b3d9de16cc176eb97613bc0c7f0bb9b16eb
Reviewed-on: https://dart-review.googlesource.com/77013
Commit-Queue: Ben Konyi <bkonyi@google.com >
Commit-Queue: Ryan Macnak <rmacnak@google.com >
Reviewed-by: Ryan Macnak <rmacnak@google.com >
Auto-Submit: Ben Konyi <bkonyi@google.com >
2018-09-28 23:18:59 +00:00
Régis Crelier
14f3982a1f
[VM runtime] Remove broken LongJumpScope::IsSafeToJump().
...
Over the years, this debug-only code evolved to check that the current stack
pointer is below the last exit frame, which is obviously always the case.
Change-Id: I9b5e1a5462df5b3392b4541e40a9c57d33d25055
Reviewed-on: https://dart-review.googlesource.com/70960
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Ryan Macnak <rmacnak@google.com >
Commit-Queue: Régis Crelier <regis@google.com >
2018-08-21 19:29:09 +00:00
Vyacheslav Egorov
226c715542
[vm] Optimize ARM simulator by forcing inlining of hot functions.
...
Also move InstructionDecode hot path into InstructionDecodeImpl.
This patch improves time to run SIMARM tests by 25-35% and improves
time spent in simulator when running gen_snapshot on Flutter by a
similar amount.
Functions to force inline were selected by looking at the VTune
profile of gen_snapshot generating script snapshot of the Flutter
Gallery on Windows.
Bug: https://github.com/dart-lang/sdk/issues/31684
Change-Id: Ifbfeaae252dfafb3b86b4f1eb7ca40f42bc3a252
Reviewed-on: https://dart-review.googlesource.com/31920
Reviewed-by: Martin Kustermann <kustermann@google.com >
Commit-Queue: Vyacheslav Egorov <vegorov@google.com >
2018-01-02 13:29:03 +00:00
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
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
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
Ivan Posva
8f1506e817
- Determine whether the simulator is being used in globals.h
...
- Make sure to switch on HOST_ARCH_ and on USING_SIMULATOR
where appropriate.
- Avoid allocating in new generation when running in the VM isolate.
BUG=
R=srdjan@google.com
Review URL: https://codereview.chromium.org//1156053006
2015-05-29 14:35:29 -07: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
b7120c779c
Fix carry out calculation in ARM simulator.
...
Add a regression test.
Simplify overflow calculation in ARM simulator.
R=zra@google.com
Review URL: https://codereview.chromium.org//623823003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40918 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-06 07:12:15 +00:00
zra@google.com
dba0530c27
Adds back arm ldrex strex.
...
R=iposva@google.com
Review URL: https://codereview.chromium.org//616223005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40865 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-02 02:41:08 +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
b39bcf7bf6
Allows unboxed doubles to be disabled.
...
This helps to support ARMv5TE. Also adds asserts to
ensure that neon and vfp instructions are not generated
when those features are disabled on ARM.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//292433008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36262 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-16 17:17:52 +00:00
srdjan@google.com
d78737298c
Last cleanup int -> intptr_t. Also removed a hack (boolean is not an integer).
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//26345002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28372 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-08 18:54:00 +00:00
asiva@google.com
b4d9e0d620
Auto create ApiLocalScope before calling native functions, this ensures that
...
native functions do not have to call Dart_EnterScope/Dart_ExitScope
when they callback into the VM.
Remove Dart_EnterScope/Dart_ExitScope calls around native functions in 'bin'
directory.
R=regis@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//22303002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25827 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-06 19:27:48 +00:00
zra@google.com
4b97f8c18c
Adds reciprocal squre root SIMD instructions for ARM.
...
R=regis@google.com
Review URL: https://codereview.chromium.org//19875002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25291 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-22 18:19:44 +00:00
zra@google.com
f219f81b14
Begins implementation of ARM neon instructions.
...
Just adds the vadd instruction, but also changes the
arm assembler to expose the Q registers rather than the
D registers. Q0 = D1:D0 = S3:S2:S1:S0. This is similar
to how ia32 and x64 use only the xmm registers for
floating point.
R=regis@google.com
Review URL: https://codereview.chromium.org//18684008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24982 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-12 23:22:50 +00:00
zra@google.com
364c5406b8
Fixes floating point bug in ARM simulator.
...
Adjusts status files to match.
R=regis@google.com
Review URL: https://codereview.chromium.org//17742003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24473 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-26 15:48:22 +00:00