Commit graph

33 commits

Author SHA1 Message Date
Alexander Aprelev 1fddb10107 [vm/heap/metrics] Make sure heap-related metric are reported for the isolate group, rather than isolate.
TEST=ci

Change-Id: Ie0514f05c0a024ce37f10d56dd29b3fa921133d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247504
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-08 18:01:02 +00:00
Ryan Macnak fd10f5ab28 [vm, gc] Avoid unnecessary nested GcSafepointOperationScopes.
TEST=ci
Change-Id: Ic12d6d1766cf90808716d301abfa216eb597cb1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241201
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-18 23:14:37 +00:00
Ryan Macnak 81143e16c4 [vm, gc] Don't perform blocking compactions in response to Dart_NotifyLowMemory.
These GCs usually did not free very much memory but did consume a lot of CPU. They would on low-powered, low-memory devices often take ~1s, during which time the OS might decide the OOM signal wasn't working and kill us before the compaction can complete and free pages. Instead, only release pooled memory.

Also use more appropriate GCReasons in calls of CollectMost/AllGarbage.

TEST=ci
Bug: b/216333343
Change-Id: Ia56b9ca409410f17d40508c69fb1bc9df0ce4028
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235300
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-03-08 22:42:46 +00:00
Ryan Macnak fbcacd7c05 Reapply "[vm] Streamline Zones."
Fix imprecision in Zone::SizeInBytes that was finally noticed by vm/cc/AllocateZone because the size of the initial inline buffer changed.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47399
Change-Id: I152d24d03a59b21267a9a24e5d929b51af57af71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215980
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-14 00:10:12 +00:00
Ryan Macnak 472e2bce17 Revert "[vm] Streamline Zones."
This reverts commit b5922e6db4.

Reason for revert: vm/cc/AllocateZone fails on Mac

Original change's description:
> [vm] Streamline Zones.
>
>  - Don't put a HANDLESCOPE right after a StackZone, as there's no state worth restoring
>  - Remove remaining zone bookkeeping dead since e3a9d70591.
>  - Remove unnecessary resetting of handle blocks before zone deletion.
>  - Shrink initial chunk size to make Zone's overall size fit in a faster malloc size class.
>
> TEST=ci
> Change-Id: I920e12f5af93aa71fb876435764c60df485215f9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212261
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: Id23dcebb781791616e48e54d2dcd7e58159178bc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215943
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-06 23:44:33 +00:00
Ryan Macnak b5922e6db4 [vm] Streamline Zones.
- Don't put a HANDLESCOPE right after a StackZone, as there's no state worth restoring
 - Remove remaining zone bookkeeping dead since e3a9d70591.
 - Remove unnecessary resetting of handle blocks before zone deletion.
 - Shrink initial chunk size to make Zone's overall size fit in a faster malloc size class.

TEST=ci
Change-Id: I920e12f5af93aa71fb876435764c60df485215f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212261
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-06 22:22:32 +00:00
Ryan Macnak 04e184d791 [vm, gc] Don't grow new-space in response to idle or low-memory GC.
The vm-service sees alternating bursts of activity and idle periods. Before this change, the vm-service would often quickly reach the maximum new-space size; after it usually stays at the initial size.

TEST=--verbose-gc
Change-Id: I13e80a114e04ae91a837fbe9c8b1967ad5e8c4c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215141
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2021-10-04 19:15:26 +00:00
Ryan Macnak 5da8050f86 [vm, gc] Move GCType and GCReason out of Heap, making them accessible to Scavenger and PageSpace.
Add a GCReason for store buffer overflow instead of using a separate print.

This is a pure refactoring that doesn't change GC policy.

TEST=ci
Change-Id: Idcd95b0701a36f45ebaa02db2c2fac9a9081d7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215102
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-10-04 18:57:19 +00:00
Martin Kustermann 0f76981bb1 [vm/concurrency] Change references to class_table/object_store/heap from Isolate to IsolateGroup
As part of making the compiler and other subsystems independent
of `Isolate` we have to move various state from `Isolate` to
`IsolateGroup`.

The class_table and object_store were already moved to `IsolateGroup`.

This CL only replaces usages of `Isolate::{object_store,class_table}`
with the equivalent in `IsolateGroup`.

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

TEST=Pure refactoring - relying on existing test coverage.

Change-Id: I34a0682d715b054d6c5faff077a513980f59a348
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177126
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-01-06 15:22:11 +00:00
Clement Skau 7a978c3a35 [API] Adds Dart_SetGCEventCallback for GC events in PRODUCT
Bug: https://github.com/dart-lang/sdk/issues/43106
Change-Id: Ied2201464eca387e0bc58ab54404041f7649e870
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160063
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-08-31 12:14:38 +00:00
Martin Kustermann 518f097266 [vm] Make metrics API expose correct heap metrics in PRODUCT mode
See b/152430908

Change-Id: I89524489ec9868bf5fa40559292e4f82b352cfe3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147362
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-09 08:27:48 +00:00
Martin Kustermann 5fba90b2f8 [vm/metrics] Ensure the metrics exposed by VM also include on-the-fly metrics
The lower-case "value()" metrics getter can only be used to obtain
metrics which are explicitly set by the VM.

The metrics we expose also include ones which are computed on-the-fly.
Those have to be accessed via "Value()".

Change-Id: I283c3c7c660d47c383b880b4bff6357a4dba9c01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123252
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-10-28 19:58:53 +00:00
Ben Konyi bdc91968a2 [ VM / Service ] Updated JSONWriter::PrintValue(double) to use double_conversion instead of Printf.
Fixes #31737

Change-Id: If70b7b6bdd1e977bda310a2b0566dcd48c6b3c6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101101
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-03 18:07:27 +00:00
Ryan Macnak 7514ce941e [vm] Assert handles are only allocated when the thread is preventing safepoints.
Threads in the native or blocked states don't prevent safepoints, so they may run concurrently with a safepoint operation like GC. It is not safe for handles to be allocated while the GC is visiting them, so these threads must not allocate handles. Assert only threads in the VM or generated states, which prevent safepoints until they check in, may allocate handles. (Generated code does not allocate handles, but leaf runtime entries remain in the generated state.)

Bug: https://github.com/dart-lang/sdk/issues/34883
Change-Id: I1a211778f7ef96b53a2405f0ee9dde7871b122b6
Reviewed-on: https://dart-review.googlesource.com/c/81540
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-31 19:51:52 +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
Siva Chandra 6214cedaf5 Create isolate from the platform kernel when running VM tests under dartk.
This is take 2 with appropriate status files updates or fixes to the
tests.

This reverts commit 4925ed38ac.

Change-Id: I133b9ae307f0feed1b72ec5a0131facdc51ad4e9
Reviewed-on: https://dart-review.googlesource.com/41600
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-02-20 22:08:25 +00: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
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
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
John McCutchan d295b9c311 Remove many features when building product mode
Move all JSON printing code from object.cc to object_service.cc.

Not compiled in:

- Service protocol
- Debugger
- Debugger API
- JSONStream
- ObjectIdRing
- Profiler service
- Object JSON printing

Size of dart_bootstrap before: 5670365 bytes
Size of dart_bootstrap after: 5287631 bytes

Reduction in size: 382734 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1660063002 .
2016-02-05 09:55:51 -08: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
Florian Schneider e1468b54a3 Fix use-after-free from my previous CL.
The destructor of Metric must be invoked on a running isolate (i.e.
before shutting down the isolate.)

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1263323003 .
2015-08-03 17:34:31 +02:00
Florian Schneider ef7a55281f VM: Load allocation-top and -end via Thread.
Cache a pointer to the isolate's Heap in the Thread object
and use it in generated code for allocation.

Change generated allocation code to load allocation-top and
end via THR (THR->heap.top). This is slightly slower than
embedding the address, but faster than loading it
via the Isolate (THR->isolate->heap.top)

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1263513002 .
2015-08-03 16:26:23 +02:00
Natalie Weizenbaum 90410aabbb Fix some failing VM tests.
Review URL: https://codereview.chromium.org//1254723013 .
2015-07-27 17:48:31 -07:00
Ivan Posva f5e3f94019 Fix http://dartbug.com/23578:
- Complete revamp of isolate-specific flags.
- Associate flags with the isolate on creation.
- Dart_CreateIsolate and associate callback do take an
  extra flags argument.
- Make sure to clear IC data array when clearing code.

BUG=23578

Review URL: https://codereview.chromium.org//1162033005
2015-06-07 17:57:34 +02:00
John McCutchan b7534facef Include 'fixedId' key when printing service ids
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1157173005
2015-05-26 16:56:31 -07:00
johnmccutchan@google.com 1426cfc03b Port metrics to RPC
R=turnidge@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43486 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 21:27:49 +00:00
johnmccutchan@google.com 3299ed4a81 - Add VMMetric and some sample metrics
- Per isolate:

* heap.old.used
* heap.old.capacity
* heap.old.external
* heap.new.used
* heap.new.capacity
* heap.new.external

- VM:

* vm.isolate.count

- New metrics service namespace: /metrics/vm/...

R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39305 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-15 17:35:00 +00:00