Commit graph

25 commits

Author SHA1 Message Date
Ryan Macnak 991da7169a [vm, service] Fix data races between sample collection and sample processing.
Bug: https://github.com/dart-lang/sdk/issues/39611
Bug: https://github.com/dart-lang/sdk/issues/30309
Change-Id: I79daec2183be40aa07d652b149d182316df8458c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139025
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-03-11 22:03:50 +00:00
Ryan Macnak fa6a1684ef [vm] Introduce a separate VMTag for the interpreter.
Makes time spent in interpreted versus compiled Dart code visible in Observatory's pie chart. Will allow the profiler to know whether to start a stack walk from the machine code FP or the interpreter's FP.

Remove dead Dart 1 frontend tags. Add tag for loading bytecode.

Change-Id: I2c5a580e1581f8ccd5a93bb293899c81f900ef13
Reviewed-on: https://dart-review.googlesource.com/c/83564
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-09 01:58:54 +00: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
Ryan Macnak 877284947b Rename TARGET_OS_* to HOST_OS_*.
Like HOST_ARCH_*, HOST_OS_* describes the OS the VM is running on, which may be different from the OS the VM is generating code for during AOT compilation.

Currently we conflate the two when emitting AOT as assembly, and we get away with it because Flutter only uses assembly for targeting iOS and one can only target iOS from a Mac, but we expect to use assembly for Android as well so native tools can unwind Dart frames.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2750843003 .
2017-03-15 13:11:05 -07:00
John McCutchan 95a8166523 Disable the profiler when a debugger is attached
Fixes #28702

BUG=
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2682343002 .
2017-02-09 10:11:52 -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
Vyacheslav Egorov b089d4f004 Work around a kernel bug on Android.
Kernel does not clear If-Then execution state bits when entering ARM signal handler which violates requirements imposed by ARM architecture reference. Some CPUs look at these bits even while in ARM mode which causes them
to skip some instructions in the prologue of the signal handler.

To work around the issue we insert enough NOPs in the prologue to ensure that no actual instructions are skipped and then branch to the actual signal handler.

For the kernel patch that fixes the issue see: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6ecf830e5029598732e04067e325d946097519cb

This causes sporadic crashes with SIGILL on some testing devices (e.g. Nexus 7).

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org/1940883002 .
2016-05-02 19:12:48 +02:00
John McCutchan e2e7af1229 Remove more feature in product mode
- Remove Timeline.
- Remove more vmservice code.
- Remove AST printing.
- Remove IL printing.
- Remove profiler.
- Remove thread interrupter.
- Remove disassembler.
- Remove Library::CheckFunctionFingerprints.

- Update test status files for product mode.

Size of dart_bootstrap before: 5287631
Size of dart_bootstrap after: 5112783

Reduction in size: 174848 bytes.

Total reduction in size (382734 + 174848): 557582 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1678203002 .
2016-02-09 08:45:32 -08:00
Siva Annamalai 9e19d236ca - Add an OSThread structure which is the generic TLS structure for all C++
fields in a thread (i.e fields that are not Dart VM related)
- Split the Thread structure to be a pure Dart per thread structure and add
  a pointer to os_thread which points to the OSThread structure
- Change Schedule/UnSchedule to set the Dart Thread structure as the TLS of
  the thread when it is inside the Dart world and reset the TLS back to the
  OSThread strcuture when is exits the Dart World.
- Moved the stack_base and few stack size related functions to OSThread from Isolate

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

Review URL: https://codereview.chromium.org/1439483003 .
2015-11-19 13:45:10 -08:00
John McCutchan ceb12c4f69 Switch profiler from isolates to threads
- API breakage: Dart_IsolateBlocked, Dart_IsolateUnblocked -> Dart_ThreadDisableProfiling, Dart_ThreadEnableProfiling.
- Remove IsolateProfilerData.
- Move thread at blocking call count from isolate to thread.
- Always interrupt threads unless they are blocked.
- We can no longer count "idle" ticks.
- Only record sample if thread is the current mutator of an isolate.
- Refactor ThreadInterrupterCallback to ensure that Thread* is valid.

Threads are only ever sent signals if ThreadInterruptsEnabled is true. Which is controlled by two functions:

void DisableThreadInterrupts();
void EnableThreadInterrupts();

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

Review URL: https://codereview.chromium.org/1423473004 .
2015-11-04 07:59:16 -08:00
William Hesse cc4a5d2e7c Revert "Switch profiler from isolates to threads"
Reverts commit 6365c27f81 and
commit 8b9ed6cfb3.

They are causing flaky timeouts (hangs) on all vm cc tests on all Windows vm bots.

R=mit@google.com

Review URL: https://codereview.chromium.org/1425093006 .
2015-11-03 10:42:55 +01:00
John McCutchan 6365c27f81 Switch profiler from isolates to threads
- API breakage: Dart_IsolateBlocked, Dart_IsolateUnblocked -> Dart_ThreadDisableProfiling, Dart_ThreadEnableProfiling.
- Remove IsolateProfilerData.
- Move thread at blocking call count from isolate to thread.
- Always interrupt threads unless they are blocked.
- We can no longer count "idle" ticks.
- Only record sample if thread is the current mutator of an isolate.
- Refactor ThreadInterrupterCallback to ensure that Thread* is valid.

Threads are only ever sent signals if ThreadInterruptsEnabled is true. Which is controlled by two functions:

void DisableThreadInterrupts();
void EnableThreadInterrupts();

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

Review URL: https://codereview.chromium.org/1412733008 .
2015-11-02 12:47:52 -08:00
John McCutchan 664742f016 Completely remove InterruptableThreadState
- InterruptableThreadState is gone.
- Moved InterruptableThreadState fields directly into Thread.
- Iterate over all threads in an isolate when profiling.
- Still only sample the mutator thread.

Fix ThreadRegistry leak

- When deleting a Thread, iterate over all isolates and remove it from the isolate's thread registry.

R=iposva@google.com

Review URL: https://codereview.chromium.org//1293253005 .
2015-08-20 14:38:38 -07:00
Daniel Andersson c756f9dade Fix android DEBUG build.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1285993002 .
2015-08-11 16:07:57 -07:00
Daniel Andersson 124edc0e79 Correct thread state update order (fixes Windows crashes).
Also add a corresponding ASSERT for non-Windows.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1276753003 .
2015-08-07 13:16:39 -07:00
johnmccutchan@google.com afe774a4c4 Remove profiler signal handler on shutdown
BUG=https://github.com/domokit/mojo/issues/79
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44943 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-07 18:33:01 +00:00
johnmccutchan@google.com f2333f63a5 Add Function based profile tree
Profiler improvements:
- Track Functions in profile and build Function based trie
- Associate code objects with functions
- Created cpu_profile.dart library
- Major speed improvements for disassembly view
- Fix truncation of disassembly comments
- Ability to get code object ticks from disassembly view
- Inlining mini-map in disassembly view.
- Remove a bunch of unused data from profile service response
- In some cases a caller PC that is better than the PC marker is inserted into the stack trace
- Inlined functions are expanded
- Ability to clear profile
- New flag '--keep_code' which keeps deoptimized code around for use by the profiler.

General fixes:
- Fix caching in service library
- Remove pubspec.yaml before running pub get

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44067 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 18:48:55 +00:00
koda@google.com c7e9e048ed Rename Thread -> OSThread.
It's a collection of static utility methods for primitive operations on OS threads.

Make room in the namespace for upcoming class that will represent all the complex state of a VM thread.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42895 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 02:30:07 +00:00
zra@google.com 816bf5af2e Fixes for the profiler on arm64.
On arm64, in Dart code, R18(SP) is the stack pointer.
In C++ code, R31(CSP) is the stack pointer.
The profiler must choose the right one when performing
its bounds checks.

This change also fixes a bug in the InvokeDartCode stub
on arm64 so that CSP is set to the Isolate's stack
limit immediately, rather than a bit later. When it was
set a bit later, if a profiler interrupt came in in the
interim, the stack would be smashed.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40502 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-19 16:25:16 +00:00
iposva@google.com 14ecdbd66a - Separate the thread implementation used in bin/ and vm/
to allow us to make VM specific changes.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39172 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 23:19:53 +00:00
zra@google.com 37baacb116 Small fixes for Android.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35342 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-23 23:20:24 +00:00
johnmccutchan@google.com 86c55f4fde Keep list of existing isolates.
List is only updated when isolates are created / destroyed.
ThreadInterrupter now walks list of isolates.
Scheduling an isolate for interrupts is now lockless.
Setting a current isolate is now lockless.
Working on Linux, Mac, and Windows.
Assert that the isolate isn't on two threads at once.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32439 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-07 17:43:21 +00:00
johnmccutchan@google.com cd10e1cc75 Remove reference to ucontext_t until other Signal related functions on Android are implemented.
Review URL: https://codereview.chromium.org//103403007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31173 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-16 20:54:19 +00:00
johnmccutchan@google.com dafc13d57f Add missing include file for Android build
Review URL: https://codereview.chromium.org//116013003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31171 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-16 19:54:46 +00:00
johnmccutchan@google.com 919dc2d6eb * Introduce ThreadInterrupter which calls a TLS set callback when thread is interrupted.
* Threads can only register and unregister themselves with ThreadInterrupter.
* Profiler is no longer involved in interrupting threads. It's just a callback and the buffer.
* Profiler operates lock free using an atomic operation to reserve sample in sample buffer.
* Linux, Mac, and Windows done.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31170 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-16 18:52:15 +00:00