Commit Graph

71 Commits

Author SHA1 Message Date
Ryan Macnak 466385ceb6 [vm, gc] Require a safepoint for heap iteration.
Assert a safepoint operation can only be started from a thread in the VM state. Fix several unit tests missing a native-to-vm transition.

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

Review-Url: https://codereview.chromium.org/2995543004 .
2017-08-07 17:51:25 -07: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
Erik Corry 029b1cb948 Spelling fixes e to i.
R=kevmoo@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957593002 .
2017-06-24 13:41:39 +02:00
Ben Konyi c0511ad2ef Reimplemented zone memory tracking to avoid race conditions that were causing crashes in the previous implementation and made some minor name changes.
BUG=
R=asiva@google.com, johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2762323002 .
2017-03-23 09:03:08 -07:00
Ben Konyi 6e02846b6d Temporarily disabling JSON generation for Zone statistics to resolve flakiness in tests until a better implementation is written. Issue #28885 (https://github.com/dart-lang/sdk/issues/28885).
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2728743003 .
2017-03-03 10:43:11 -08:00
Ben Konyi f2fd150ea0 Added new type of unit test, RAW_UNIT_TEST_CASE, which is used for tests that can be flaky if run while the VM is alive. Tests created using the RAW_UNIT_TEST_CASE macro will run after the VM has shutdown to avoid having any worker threads contaminating the test results.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2666133002 .
2017-01-31 15:16:38 -08:00
Ben Konyi de72bf4991 Moved isolate high watermark calculations into the Observatory client.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2656723002 .
2017-01-25 15:03:42 -08:00
Ryan Macnak b46af1e75f Refactor snapshots pieces to include a section for loading instructions into the heap of a regular isolate.
Progress toward allowing each isolate to load a different snapshot.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2622053002 .
2017-01-23 10:25:02 -08:00
Ryan Macnak 26a364f998 Support spawnUri in app snapshots.
- Don't mark core_isolate_snapshot_buffer as a const pointer.
 - Update app snapshots without code to not rewrite the VM isolate snapshot, as already done by app snapshots with code.

Fixes #28368

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2637193002 .
2017-01-17 15:59:41 -08:00
Ryan Macnak 12a3699301 Revert "Support spawnUri in app snapshots."
Failures on IA32.

This reverts commit c6ecfe1746.

Review-Url: https://codereview.chromium.org/2631893002 .
2017-01-13 15:52:36 -08:00
Ryan Macnak c6ecfe1746 Support spawnUri in app snapshots.
Don't mark core_isolate_snapshot_buffer as a const pointer.

Fixes #28368

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2623423007 .
2017-01-13 15:18:27 -08:00
Ryan Macnak f89056f6cd Revert "Support spawnUri in app snapshots."
This reverts commit 593d4504b0.
This reverts commit 113aa64b98.
This reverts commit 422afa2ead.

Review-Url: https://codereview.chromium.org/2633543003 .
2017-01-13 11:02:44 -08:00
Ryan Macnak 593d4504b0 Support spawnUri in app snapshots.
Fixes #28368

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2628283002 .
2017-01-13 10:37:51 -08:00
Ben Konyi 4024151adb Added isolate + thread high watermark tracking to Observatory
This is a fixed version of c84f30741c90d040254767ff769a40d2cba3fb1a that
resolves issues with comparing uint and intptr_t.

Original Commit Message:
Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track of using a high watermark for both the threads and the isolates. Isolate high watermark information is updated when a thread exits the isolate. The isolate high watermark consists of the sum of all thread high watermarks (including the high watermark of the exiting thread). High watermark information for both threads and isolates is now visible in the isolate view in the Observatory.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2610253002 .
2017-01-05 14:24:53 -08:00
Ben Konyi ffda801791 Revert "Added isolate + thread high watermark tracking to Observatory"
This reverts commit c84f30741c90d040254767ff769a40d2cba3fb1a.

TBR=johnmccutchan@google.com

BUG=

Review-Url: https://codereview.chromium.org/2617513004 .
2017-01-04 15:21:35 -08:00
Ben Konyi b3c55f972f Added isolate + thread high watermark tracking to Observatory
Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track of using a high watermark for both the threads and the isolates. Isolate high watermark information is updated when a thread exits the isolate. The isolate high watermark consists of the sum of all thread high watermarks (including the high watermark of the exiting thread). High watermark information for both threads and isolates is now visible in the isolate view in the Observatory.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2609253002 .
2017-01-04 15:08:02 -08:00
Ben Konyi e28b3e3c60 Revert "Added isolate + thread high watermark tracking to Observatory"
This reverts commit 0a1a534fd9.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2605933003 .
2016-12-28 16:49:47 -08:00
Ben Konyi 0a1a534fd9 Added isolate + thread high watermark tracking to Observatory
Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track of using a high watermark for both the threads and the isolates. Isolate high watermark information is updated when a thread exits the isolate. The isolate high watermark consists of the sum of all thread high watermarks (including the high watermark of the exiting thread). High watermark information for both threads and isolates is now visible in the isolate view in the Observatory.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2608463002 .
2016-12-28 14:59:22 -08:00
Ryan Macnak 8c6dca095c Update GC stats, ThreadPool, Timer and ScopedTimer to use monotonic time.
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2582543003 .
2016-12-15 15:25:02 -08:00
Ben Konyi a3ec04eb99 Fixed bad calculations for determining total allocated size of a zone.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2570763002 .
2016-12-12 17:48:59 -08:00
Ben Konyi 9f8a85c19b Added task kind field to thread JSON output.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2565253004 .
2016-12-12 17:08:45 -08:00
Ben Konyi 0d16859d87 Updated SimpleManyTasksWithZones test to not use PrintJSONForVM
Fixed test to not use PrintJSONForVM to get isolate information since it only returns @Isolates. Also removed some unnecessary comments and checks for isolate ids.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2567153002 .
2016-12-12 13:35:43 -08:00
Ben Konyi fa25fdd72d Fixed tests breaking build.
Merge branch 'master' of github.com:dart-lang/sdk into fix

Updated format string to reflect actual type.

BUG=

Review-Url: https://codereview.chromium.org/2562243003 .
2016-12-12 11:36:55 -08:00
Ben Konyi 35a49bc1ff Created methods to surface zone memory information for each isolate and thread in JSON.
BUG=
R=asiva@google.com, johnmccutchan@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2554983002 .
2016-12-12 09:56:49 -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
Siva Annamalai 56fba25f0f Allow for recursive invocation of SafepointOperationScopes.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2126413002 .
2016-07-07 15:27:49 -07:00
Zach Anderson 5f59a954f8 Uses an open thread handle as the ThreadJoinId on Windows.
Also:
- Reaps exited threads in the thread pool before putting
a thread on the idle list so that a new arriving task
isn't blocked on a supposedly idle thread in the middle
of a join.
- Stops trying to join eventhandler threads on
Windows. Now that we're using the correct exit() call,
we probably don't have to worry about exit code pollution,
so joining the threads is unnecessary.

related #26400

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

Review URL: https://codereview.chromium.org/1978153002 .
2016-05-17 13:18:13 -07:00
John McCutchan 41d9f2d107 Add Thread TaskKind
BUG=
R=asiva@google.com, turnidge@google.com

Review URL: https://codereview.chromium.org/1814243002 .
2016-03-21 09:41:47 -07:00
Siva Annamalai b6d01a8947 Fix thread test.
Review URL: https://codereview.chromium.org/1754833002 .
2016-03-01 13:26:30 -08:00
Siva Annamalai e83151cc77 - Add assertions in MutexLocker/MonitorLocker to ensure that the code enclosed
in these blocks will not have a safepoint operation
- changed boxed_field_list_monitor_ to boxed_field_list_mutex_ as we only
  need a mutex for guarding access to boxed_field_list_ as changed the
  lock to use SafepointMutexLocker as the list addition code could potentially
  allocate and result in GC (safepoint operation)
- Added a SafepointMonitorLocker as we have a function Isolate::VisitIsolates
  which could potentially have safepoints in the enclosed block.
- Make the lock around MegamorphicCacheTable::Lookup a SafepointMutexLocker
  as the look up code seems to be allocating memory while the lock is held.
- Changed the ThreadPool and MessageHandler code to account for the new
  MonitorLocker usage standard
- Fixed PortMap::PrintPortsForMessageHandler to use SafepointMutexLocker as
  the code it encloses calls into Dart
- Removed profiler_ field in class Profiler as it doesn't seem to be used.

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

Review URL: https://codereview.chromium.org/1748953003 .
2016-03-01 12:33:50 -08:00
Siva Annamalai e72c1fb47d Implement safepointing of threads :
- uses thread execution status transition to track when a thread is in a safepoint or needs to block for a safepoint
 - introduces a monitor per Thread object
 - uses a per thread safepoint handshake between the thread requesting a safepoint and the requested thread.

The ThreadRegistry class now contains only the thread list for an isolate and the functionality of scheduling a thread onto an Isolate and unscheduling it from teh isolate. We could fold this functionality into the Isolate class in a different CL.

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

Review URL: https://codereview.chromium.org/1541073002 .
2016-02-01 10:57:34 -08:00
Ivan Posva 16640fd804 - Remove redundant (and wrong) flushing of store buffers in unit test.
BUG=

Review URL: https://codereview.chromium.org/1527143006 .
2015-12-17 20:20:08 -08:00
Ivan Posva e47ac24c79 - Make sure to prepare all threads for GC.
BUG=
R=asiva@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org/1533023002 .
2015-12-17 19:59:13 -08:00
Siva Annamalai 4992bc72a0 Remove support for object grouping during Garbage Collection
- remove support for prolog weak persistent handles
- remove support for construction of weak reference sets

R=iposva@google.com

Review URL: https://codereview.chromium.org/1459173004 .
2015-11-20 12:36:16 -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 b83e5a718e Fix ThreadIterator_AddFindRemove test
- A pointer test was unsafe because the allocator could recycle the address for a new thread.

Fixes #24692

R=asiva@google.com

Review URL: https://codereview.chromium.org/1425463004 .
2015-10-26 11:07:16 -07:00
John McCutchan 1ec9d78b89 Call known TLS destructors on Windows
Partially fixes #23474 by freeing the MonitorWaitData and Thread objects on Windows when a thread exits.

Machinery to run a function at thread exit on Windows taken from Chromium's base.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1391013006 .
2015-10-14 07:59:33 -07:00
John McCutchan 4dff3efe94 Attempt to fix ThreadIterator_AddFindRemove flake
- Add ThreadInList helper for tests.
- Attempt 10 times with a 10 millisecond delay for the spawned thread to be removed from the list.
- Simplify ThreadIteratorTestMain

Review URL: https://codereview.chromium.org/1397173004 .
2015-10-13 15:09:19 -07:00
John McCutchan d565c5361e Fix race in thread iterator test
- Explicitly join the spawned thread to ensure the destructors have run.
- This will fail on Windows bots (I'd like to see this before updating the status file).

Review URL: https://codereview.chromium.org/1407573002 .
2015-10-13 12:56:41 -07:00
John McCutchan 321d64a849 Add ThreadIterator for iterating over all Threads
- Register all Threads in a central list.
- Introduce ThreadIterator to iterate over threads.

This will be used by the profiler when it switches from iterating over isolates to threads. It will also be used to simplify the timeline backend.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1393423005 .
2015-10-13 09:49:20 -07:00
John McCutchan 98638457ce Remove final users of dart:profiler library
BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org/1394533002 .
2015-10-07 09:27:22 -07:00
Ivan Posva 4bd7cdc75c - Ensure that HandleScope is initialized with a thread. (Remove
deprecated isolate based API.)
- Update all code impacted by this change. E.g. DARTSCOPE
- TEST_CASE now passes the current thread as a parameter to the   unit test.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1310463005 .
2015-09-01 17:18:55 -07:00
Daniel Andersson cab0033667 Add safepointing to the GC
BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1292353004 .
2015-08-25 18:20:27 -07:00
Ivan Posva 41840f3740 - Really delete InterruptableThreadState.
R=koda@google.com

Review URL: https://codereview.chromium.org//1308973003 .
2015-08-21 15:59:34 -07:00
Daniel Andersson 655df891fc Add unit test to ensure that we can execute a full GC on a thread other than the main mutator. (For now, the main mutator waits manually, since the GC does not yet safepoint.)
Adding this unit test ensures that we do not add any new code to the dependencies of the GC that assumes the current thread is the main mutator.

* Equip helper threads with a store buffer automatically, just like for the main thread.
* Share code by refactoring flushing.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1289153002 .
2015-08-18 07:23:17 -07:00
Daniel Andersson 2ae8544e8d Restore frame validation (fixes to CL faaf60801f).
BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1280013004 .
2015-08-12 08:47:54 -07:00
Daniel Andersson faaf60801f Enable iterating over roots from helper threads by moving stack walking.
This will be needed for helper threads to invoke GC.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1282423003 .
2015-08-11 09:41:06 -07:00