Commit Graph

43 Commits

Author SHA1 Message Date
Vyacheslav Egorov a9ce969e53 [vm] Decouple growable_array.h and zone.h from thread.h
- Introduce a slimmed down version of thread.h, which just depends on the
Zone and StackResource.
- Introduce a layering check that would prevent the coupling in the future.

This is the first step towards decoupling compiler from runtime.

There are multiple reasons to introduce the decoupling but the main
reason currently is to introduce a controlled surface through which
compiler reaches into runtime to catch any places where runtime word size
might influence the compiler and then enable building compiler that
targets 32-bit runtime but is embedded into a 64-bit runtime.

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

Change-Id: Id63ebbaddca55dd097298e51c90d957a73fa476e
Reviewed-on: https://dart-review.googlesource.com/c/87182
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-11 20:47:10 +00:00
Ryan Macnak c37c7a2a77 [observatory] Include Contexts in user heap snapshots.
Change-Id: If9f29a6ea81ef5cb2bfd73b9dc2a21086fdc3eac
Reviewed-on: https://dart-review.googlesource.com/c/88240
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-03 01:49:05 +00:00
Ryan Macnak 93dcfaa289 [vm, gc] Concurrent marking.
Fall back to parallel marking
 - on IA32 (barrier unimplemented)
 - when write_protect_code is enabled (protection dependency on marking state unimplemented)

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: If093f24e4dc6bf29f407cc45e95bb2274fc53dcf
Reviewed-on: https://dart-review.googlesource.com/71389
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-09-21 21:30:33 +00:00
Ryan Macnak 2cfe3b36ab [vm, gc] Adjust header bits to allow generational and incremental barrier filters to run together in one shift-and-mask.
Claims 3 header bits :(

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: Ia4fcc9f2b38ed5aa98a28823616b7de766cdde2d
Reviewed-on: https://dart-review.googlesource.com/69222
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-08-29 22:17:55 +00:00
Martin Kustermann 35b17f3730 [VM] Consistently use ValidationPolicy in frame iteration APIs
Previously there were places in the code where an API accepted a
`bool validate_frames` and call sites passed an enum value (which
implicitly got converted to a bool).

By changing the APIs to require an enum, the compiler will tell us if a
caller doesn't pass one.

Change-Id: I29fcd0b018e6cdd7e00b5bb03e83b9636d1345d4
Reviewed-on: https://dart-review.googlesource.com/57823
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-06-04 14:46:26 +00:00
Ryan Macnak b7a0458196 [observatory] Add an "ownership" analysis for the heap snapshot.
An object A is said to be owned by object B if all direct references to A come from B. In particular, an object that holds unshared lists and maps will own the heap size of those lists and maps, as well as any unshared elements. We hope a table of owned sizes will be more useful than a table of shallow sizes, since the latter typically says the heap is mostly lists.

R=cbernaschina@google.com

Review-Url: https://codereview.chromium.org/3009743003 .
2017-08-30 09:50:57 -07:00
Régis Crelier b3a7dd6e9d [VM generic function reification] Support generic functions in Invocation class.
Make VM object TypeArguments a Dart instance.
Add a test verifying that noSuchMethod works with generic functions.

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

Review-Url: https://codereview.chromium.org/3007603002 .
2017-08-28 17:00:39 -07:00
Ryan Macnak 48bc6e5d73 Add external sizes to the heap dominator tree.
Fixes #30381

R=cbernaschina@google.com

Review-Url: https://codereview.chromium.org/3008593002 .
2017-08-28 10:54:32 -07:00
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
Diogenes Nunez ced696af69 Calculates retaining paths through user fields and ignores VM objects
before reporting a path that goes through VM objects.

When a user attempts to check the retaining path of an instance of a
class, previously Observatory would report the first path found, even
if the path contains multiple VM objects.

Now, Observatory will attempt to find a path through the user fields and
ignores all VM objects aside from said fields. If that fails, it
defaults to the original algorithm.

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

Review-Url: https://codereview.chromium.org/2990643002 .
2017-07-27 13:24:48 -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
Ryan Macnak 1905d2bbe2 Consider Contexts to be user objects for purposes of Obervatory's dominator analysis.
User data in may be reachable only through a closure's environment, represented as a Context object. Note we still don't consider Functions to be user objects here, and so avoid blaming the size of compiled code against any user object.

R=cbernaschina@google.com

Review-Url: https://codereview.chromium.org/2947673002 .
2017-06-20 16:59:29 -07:00
Ryan Macnak 8b217ec519 Rename references to "external pages" as "image pages" to avoid confusion with the kind of external memory associated with finalizers.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2654183002 .
2017-01-26 09:53:06 -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 11975ab353 ObjectGraph: Establish a HeapIterationScope *before* making the heap writable, least the sweeper interfer.
Fixes #28030

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2566383002 .
2016-12-14 11:27:15 -08:00
Ryan Macnak 0cf02040f8 Add a version of heap snapshots that use only fields and stack frames as roots and only include instances.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2502283003 .
2016-11-28 16:00:06 -08:00
Ryan Macnak f5b1f158c0 Exclude all references into the VM isolate in heap snapshots.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2501343004 .
2016-11-15 11:03:25 -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
Carlo Bernaschina a58c34254d Compacting _GetRetainingPath result avoiding some internal structures.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2231313002 .
2016-08-12 13:42:04 -07:00
Srdjan Mitrovic 40d8eee81e Remove unnecessary isolate argument from some visitors
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1838373002 .
2016-03-29 14:47:51 -07:00
Ryan Macnak 6eaa45058c Perform a full GC by default when requesting a heap snapshot.
Prevents the snapshot from include objects that are only weakly
reachable.

BUG=http://dartbug.com/25994
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1811713002 .
2016-03-17 11:11:38 -07: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
Ryan Macnak 75cd019a9c Add RPC and UI for reachable size of an object / all instances of a class.
BUG=http://dartbug.com/24945
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1453983002 .
2015-11-20 10:02:16 -08:00
Srdjan Mitrovic b9426418d8 Get rid of deprecated methods accessing mutator_thread_ instead of current thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1410643008 .
2015-10-20 10:26:08 -07:00
Srdjan Mitrovic 53e814f0dd Move reusable handles from isolate to thread.
BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org/1394673002 .
2015-10-09 10:10:34 -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
Ryan Macnak 8c98455ab5 Retaining path improvements.
- Don't answer retaining paths that go through ICData.
 - Associate edge labels with the referer instead of the referent.
 - Give edge labels for VM classes (offsets only).
 - Make is possible to distinguish closures and functions from their refs.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1246073005 .
2015-07-28 15:56:10 -07:00
Daniel Andersson fc8286ae71 Migrate NoSafepointScope to Thread, so that helper threads can successfully call Heap::Allocate (but only for old space).
Safepointing is not yet implemented, so helper threads can only allocate when growth control is off and no Dart code is running. But extend unit test to ensure this code path remains exercised as more functionality is added.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1250463004 .
2015-07-22 15:09:54 -07:00
Daniel Andersson 3fc6fce1c0 Safer interface for heap iteration.
Address issue 21620, by sharing code to wait for concurrent sweeper to finish, and freeing the caller from this responsibility. The new public interface is Heap::Iterate*, and the old Heap::Visit* are made private, for GC use only.

(Eventually, we'll want to support iterating over the heap while concurrent GC runs, but that will have to wait until all header accesss is synchronized.)

BUG=21620
R=asiva@google.com

Review URL: https://codereview.chromium.org//1212943010 .
2015-07-07 17:20:20 -07:00
Daniel Andersson 3ce2b95070 Make ObjectGraph wait for concurrent sweeper before using mark bits
Attempt to extend test coverage by triggering a full GC in test. (Manual inspection did show the "Wait" being executed.)

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

Review URL: https://codereview.chromium.org//1179973005.
2015-06-17 14:22:51 -07:00
Daniel Andersson 1009d587de Assert no allocation during heap iteration; fix unsafe iteration in ObjectGraph.
BUG=https://github.com/dart-lang/sdk/issues/21620
R=asiva@google.com

Review URL: https://codereview.chromium.org//1181943002.
2015-06-12 10:44:06 -07:00
Ryan Macnak bad1ccb2f7 Heap snapshot visualizations:
- Dominator tree with retained sizes
- Merge nodes by class

- Split snapshot into chunks so the browser's websockets implementation can handle them.
- Use TypedData indexed by node ids instead of lists of objects and a higher time complexity but more memory efficient algorithm to find the dominator tree (reduces memory usage to ~2X the size of the heap being analyzed from >10X).

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

Review URL: https://codereview.chromium.org//1124153006
2015-05-26 14:46:28 -07:00
iposva@google.com 2028a4ee7e - Avoid inconsistency of for example IterateObjects vs VisitObjects.
The majority of the sites uses VisitXYZ.
- Removed IterateNew* and IterateOld* as they are not needed any longer.

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45221 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-16 23:16:25 +00:00
koda@google.com e3a345a84b Rename NoGCScope -> NoSafepointScope.
The old name makes less sense in the context of concurrent GC (and multiple threads in general).

Document the intended semantics of this (DEBUG-only) guard scope.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44616 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-20 22:08:25 +00:00
koda@google.com 85907b42ae Make helper functions static to avoid accidental collision and potentially aid optimization.
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42650 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-07 01:02:40 +00:00
koda@google.com 96576ad59e vmservice: basic object graph serialization.
Sends a service event with binary data encoding the basic shape of the object graph; for each object, its:
* size
* class id
* neighbors (excluding smis and nulls)

This is a minimal implementation to make the first unit test pass (TDD).

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42070 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-02 19:33:09 +00:00
rmacnak@google.com bd4263bff2 Incoming references service request and UI.
Misses references from stack frames and embedder handles.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39534 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-25 22:31:45 +00:00
koda@google.com 655b16b2d6 Include parent field/list index in retaining path.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37956 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-02 20:37:56 +00:00
koda@google.com 61bde80790 Retaining path in Observatory.
Add retaining_path instance command to VM service, exposed in the Observatory
with a [find] eval-link in instance view. By default shows up to 10 elements,
possibly followed by [find more] which doubles the number of elements shown.

Change RetainingPath to include the object itself.

Always include an id in Object::PrintJSONImpl, to avoid instance-ref crashing on
internal objects.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36516 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-22 17:31:47 +00:00
koda@google.com b9c9bb5dfe ObjectGraph::RetainingPath
Adds a utility method to find a retaining path and unit test.
Next step is to expose it via VM service and Observatory.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36381 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-20 20:38:02 +00:00
koda@google.com 65635f2516 Make ObjectGraph a StackResource.
R=iposva@google.com
TBR=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35775 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-05 22:20:09 +00:00
koda@google.com 1c3a41ad13 Retained size for instance in Observatory.
Add objects/$id/retained message that uses ObjectGraph to compute retained size for an instance.
In the instance view, the user can request the size to be calculated.

R=turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35757 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-05 19:41:12 +00:00
koda@google.com f9b6613cf4 Object graph visitor: general depth-first search.
Features:
 * Performs a pre-order, depth-first search.
 * Allows the visitor to direct whether to
   proceed, backtrack, or abort.
 * Provides a complete chain of parents to the root.
   (unlike the GC marking stack).

The plan is to use this in the observatory, e.g.:
 * inspect a path from the isolate roots to a particular object, or
 * determine how much memory is kept alive by some particular object or class of objects.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35711 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-02 21:38:30 +00:00