Commit Graph

55 Commits

Author SHA1 Message Date
Alexander Aprelev 59b8a9c4bb [vm] Free readonly header bit so it can be used for other uses.
This is reland of https://dart-review.googlesource.com/c/sdk/+/97340 rebased on top of removal of GraphMarked bit, which was not compatible with this ReadOnly->InVMIsolateHeap change(due to how write-pages are not covered by Contains check)

Change-Id: I34c6421afb4baeafa5a449787020dab9fa800d05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97545
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-03-22 23:46:51 +00:00
Alexander Aprelev 7e170b351d [vm] Add whitespace before parenthesis.
Follow-up to https://dart-review.googlesource.com/c/sdk/+/97560.

Change-Id: I83cc296238f33ec1c58994393c1b416976ff383a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97564
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-03-22 15:08:04 +00:00
Alexander Aprelev 2631fdf8cf [vm] Reclaim GraphMarked bit.
Use ObjectIdTable for object graph walk instead of tagging object by header bit.

Change-Id: I1e7f2e733253e714c680b7d459a4c4e1711448e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97560
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-03-22 14:47:05 +00:00
Alexander Aprelev 34af8b95e5 Revert "[vm] Free readonly header bit so it can be used for other uses."
This reverts commit 59931e3340 as it
breaks jitk and optcounter bots.

Change-Id: If87ce52ac3d4015608436bfd7ee661ea1414dc7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97480
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-03-21 06:23:50 +00:00
Alexander Aprelev 59931e3340 [vm] Free readonly header bit so it can be used for other uses.
Rely on vm_isolate()->heap()->Contains() instead of header bit check.

Change-Id: Ibf66b9910aea5003dd3dee539704deeb72c61ada
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97340
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-21 00:02:56 +00:00
Régis Crelier a39833d957 Reland "Reland "[VM runtime] Dual mapping of executable pages.""
This is a reland of 6da340bf76

Original change's description:
> Reland "[VM runtime] Dual mapping of executable pages."
> 
> This is a reland of 44186dfdcd
> 
> Original change's description:
> > [VM runtime] Dual mapping of executable pages.
> > 
> > Change-Id: Iaad78d324e25462ce951f4df26974a6a368c50b7
> > Reviewed-on: https://dart-review.googlesource.com/c/93377
> > Commit-Queue: Régis Crelier <regis@google.com>
> > Reviewed-by: Ryan Macnak <rmacnak@google.com>
> 
> Change-Id: I7a0caa078950637d9fe831732577fd2467061099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95263
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: I3a01f0e67d733c5db41618f691431e72c1e1cb2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96422
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-03-12 20:45:45 +00:00
Vyacheslav Egorov 9ff0a654ca Revert "Reland "[VM runtime] Dual mapping of executable pages.""
This reverts commit 6da340bf76.

Reason for revert: almost all benchmarks are now failing on Golem linux-x64 target. Flutter Golem build is broken 

Original change's description:
> Reland "[VM runtime] Dual mapping of executable pages."
> 
> This is a reland of 44186dfdcd
> 
> Original change's description:
> > [VM runtime] Dual mapping of executable pages.
> > 
> > Change-Id: Iaad78d324e25462ce951f4df26974a6a368c50b7
> > Reviewed-on: https://dart-review.googlesource.com/c/93377
> > Commit-Queue: Régis Crelier <regis@google.com>
> > Reviewed-by: Ryan Macnak <rmacnak@google.com>
> 
> Change-Id: I7a0caa078950637d9fe831732577fd2467061099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95263
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I3342de2584537269ffe9a53946bef27cb25a69fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96161
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2019-03-09 14:15:39 +00:00
Régis Crelier 6da340bf76 Reland "[VM runtime] Dual mapping of executable pages."
This is a reland of 44186dfdcd

Original change's description:
> [VM runtime] Dual mapping of executable pages.
> 
> Change-Id: Iaad78d324e25462ce951f4df26974a6a368c50b7
> Reviewed-on: https://dart-review.googlesource.com/c/93377
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: I7a0caa078950637d9fe831732577fd2467061099
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95263
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-08 18:33:02 +00:00
Ryan Macnak 980e5c7b57 [vm] Mark VM isolate objects at heap finalization instead of allocation.
Avoids unnecessary branching in allocation.

Also, rename the VMHeap bit to ReadOnly to reflect its current usage.

Change-Id: Ic6060eec263cef0a3fc92f253dff976cea45bdb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95063
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-03-07 00:20:30 +00:00
Régis Crelier 0491d5cde7 Revert "[VM runtime] Dual mapping of executable pages."
This reverts commit 44186dfdcd.

Reason for revert: not working on vm-kernel-precomp-android-release-arm

Original change's description:
> [VM runtime] Dual mapping of executable pages.
> 
> Change-Id: Iaad78d324e25462ce951f4df26974a6a368c50b7
> Reviewed-on: https://dart-review.googlesource.com/c/93377
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I793ceee6252111eafbcbfe6e28268f4f6f2d7215
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/94989
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-03-01 22:55:14 +00:00
Régis Crelier 44186dfdcd [VM runtime] Dual mapping of executable pages.
Change-Id: Iaad78d324e25462ce951f4df26974a6a368c50b7
Reviewed-on: https://dart-review.googlesource.com/c/93377
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-01 22:19:31 +00:00
Ryan Macnak 128139be71 [vm] Rename RawObject::Size to RawObject::HeapSize.
To avoid confusion between the heap size (includes header and rounding up) and number-of-elements size or payload size.

Change-Id: I714c4e8cec92d7ef963de39474d2a1bb23e5b4a3
Reviewed-on: https://dart-review.googlesource.com/c/92400
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-02-08 18:48:46 +00:00
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