Commit Graph

30 Commits

Author SHA1 Message Date
Zachary Anderson aedf5127bd [vm] Enable bump allocation scope for kernel loader
This shifts the bump allocation scope up to the Dart_ API
implementation so that an IsolateReloadContext won't try
to enter one. It also disables reload during the scope.

Change-Id: I3ca52f35c3a43f58e447e88b4fa91a84d3eacdd9
Reviewed-on: https://dart-review.googlesource.com/77522
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-10-03 17:54:43 +00:00
Ryan Macnak 0804245caa [vm] Make filtering in Heap::RecordAfterGC consistent with ServiceEvent::ServiceEvent.
Bug: https://github.com/dart-lang/sdk/issues/34640
Change-Id: Ie9771efe7af221c00d89f7f476d7faef76fc108f
Reviewed-on: https://dart-review.googlesource.com/77640
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-10-02 19:08:30 +00:00
Zach Anderson e98d5d8cc1 [vm] Wait for marker task to finish in BumpAllocateScope
Change-Id: I5a3761a120c4e99d2d62853670ba09d21f270564
Reviewed-on: https://dart-review.googlesource.com/77465
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-10-01 19:33:26 +00:00
Zach Anderson 1dfdcf3593 [vm] Add bump allocation scope
Use it in the kernel loader along with a
NoHeapGrowthControlScope.

Change-Id: I32e8c59298cbc5d022bc7965052d10af838b6b23
Reviewed-on: https://dart-review.googlesource.com/77024
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-10-01 17:19:01 +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
Ryan Macnak e811b29788 [vm, gc] Restore growth policy when concurrent marking is not enabled.
Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: If1ebe2f0375d1519214990c0d07937b87e326205
Reviewed-on: https://dart-review.googlesource.com/76782
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-09-27 21:28:19 +00:00
Ben Konyi 3c4c62d79a Reland "[VM] Dart_Initialize no longer crashes after Dart_Cleanup"
This is a reland of 519ee905f9

Original change's description:
> [VM] Dart_Initialize no longer crashes after Dart_Cleanup
> 
> Change-Id: I3cfdab9553aad045f024b6f9aec0b40b08234007
> Reviewed-on: https://dart-review.googlesource.com/75786
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

Change-Id: Icdd901bf1ab0b675cc5f1497061a2b7b8a05d956
Reviewed-on: https://dart-review.googlesource.com/76561
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-09-26 17:54:45 +00:00
Ben Konyi b6284b41e3 Revert "[VM] Dart_Initialize no longer crashes after Dart_Cleanup"
This reverts commit 519ee905f9.

Reason for revert: Seeing multiple crashes on Windows

Original change's description:
> [VM] Dart_Initialize no longer crashes after Dart_Cleanup
> 
> Change-Id: I3cfdab9553aad045f024b6f9aec0b40b08234007
> Reviewed-on: https://dart-review.googlesource.com/75786
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,zra@google.com

Change-Id: I33ad79dbc3fcf44f93612ff63bd2d8431f6067c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/76342
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-09-25 02:17:37 +00:00
Ben Konyi 519ee905f9 [VM] Dart_Initialize no longer crashes after Dart_Cleanup
Change-Id: I3cfdab9553aad045f024b6f9aec0b40b08234007
Reviewed-on: https://dart-review.googlesource.com/75786
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2018-09-25 01:20:24 +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
Vyacheslav Egorov 229d793602 [vm/compiler] Support materializing unboxed variables when entering catch.
Previously we tried to rely on the assumption that all variables would be
boxed - so the machinery for setting correct catch-entry state only
supported tagged values and constants. However this both leads to worse code
and is not entirely correct assumption.

This also:

- renames various confusingly named classes: we move away from talking
about "catch entry state" to "catch entry moves" - because we only
record a subset of moves that needs to be performed and that does
not describe the whole state;
- refactors a bunch of associated code to be more readable and maintainable;
- adds documentation about catch implementation in optimized code
to runtime/docs/compiler;

Fixes https://github.com/flutter/flutter/issues/21685.

Change-Id: I03ae361a1bb7710acbd9f661ae014e663a163c59
Reviewed-on: https://dart-review.googlesource.com/74860
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-14 17:39:12 +00:00
Ryan Macnak 1d4c316d55 [vm, gc] Don't eagerly evacuate new space on old allocation failure, take 2.
Large allocations and direct old space allocations are not signals that the current new space objects will be long lived.

Still perform a scavenge to handle (dead new -> dead old) references even when new space allocation is low, but a non-evacuating scavenge.

Change-Id: I4008fb163c4536abfc7ba42410ec57917a69786a
Reviewed-on: https://dart-review.googlesource.com/72340
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-09-04 22:51:07 +00:00
Ryan Macnak b090682ad9 [vm, gc] Fix scavenge speed estimate.
UsedBefore was often bogus because it was saved before coordinating Thread and Scavenger's bump pointers. It remains incorrect for --verbose-gc. Fixing that requires fairly disruptive changes to the placement of safepoint operation scopes to allow safe access to the bump pointers in Heap::RecordBeforeGC.

Change-Id: Ia7abfe0c89c4c6d92ca6c086b2a093e793c71c87
Reviewed-on: https://dart-review.googlesource.com/72071
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-08-30 21:16:34 +00:00
Ryan Macnak 14bdc51ff5 [vm, gc] Update the growth policy after reading a snapshot.
The initial growth limit is a constant value (based on --old_gen_growth_rate, 35MB). When reading a snapshot that produces a heap larger than this limit (e.g., dart2js), the first old space GC will happen soon after and fail to free much memory because objects from the snapshot have a very high survivorship rate. When reading a snapshot that produces a heap much smaller than this limit (e.g., AOT Flutter), it takes a long time to hit the first old space GC.

Also fix more missing safepoint transitions exposed by the change in GC timing.

Change-Id: I19c36e49cd8b886bd8c4652e6cfcdfb01a0d33fd
Reviewed-on: https://dart-review.googlesource.com/71621
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-08-30 00:47:34 +00:00
Ryan Macnak d8cfe19916 Revert "[vm, gc] Don't eagerly evacuate new space on old allocation failure."
This reverts commit 2891a57322.

Reason for revert: greatly increases memory usage in language_2/closure_cycles_test

Original change's description:
> [vm, gc] Don't eagerly evacuate new space on old allocation failure.
> 
> Large allocations and direct old space allocations are not signals that the current new space objects will be long lived.
> 
> Change-Id: Id271623b84795eafa81f1b08f9511b53fb354276
> Reviewed-on: https://dart-review.googlesource.com/70541
> Reviewed-by: Zach Anderson <zra@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

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

Change-Id: If65600a0846d5c6f746b765bf24148880376e365
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/72080
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-08-30 00:20:17 +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
Ryan Macnak 2891a57322 [vm, gc] Don't eagerly evacuate new space on old allocation failure.
Large allocations and direct old space allocations are not signals that the current new space objects will be long lived.

Change-Id: Id271623b84795eafa81f1b08f9511b53fb354276
Reviewed-on: https://dart-review.googlesource.com/70541
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-08-29 21:11:30 +00:00
Ryan Macnak e38e5aae46 [vm, gc] Force inline ScavengePointer into its sole caller.
Improves x64 SplayHarder by +20%, dart2js-compile geomean +2.28%.

Change-Id: Id6892e52378cb7ebc050615db6552d650ecaa82d
Reviewed-on: https://dart-review.googlesource.com/71887
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-08-29 17:19:36 +00:00
Ryan Macnak 14db718ed5 [vm] Add missing safepoint transitions.
Mostly tests; 1 non-test bug in propagating an error through Dart_SetReturnValue.

This is progress towards asserting thread->excution_state() == kThreadInVM in Object::Allocate.

Change-Id: I6a59549868ab317b3c0d32aa42f3661289cbf456
Reviewed-on: https://dart-review.googlesource.com/71720
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-08-28 16:40:17 +00:00
Ryan Macnak bfd86e5b22 [vm, gc] Make bypass_safepoints on helper threads sticky.
Allows concurrent marking and sweeping to continue during safepoints. However, the sweeper still cannot make much progress during a scavenge due to the scavenger holding the freelist lock.

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: I84f3f48feb81e8eeb67c418e918a6e12aa3178c9
Reviewed-on: https://dart-review.googlesource.com/70900
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-08-21 20:12:23 +00:00
Samir Jindel d8a4a3896a [vm] Multiple entrypoints: backend/assembler support.
Test Plan:

Will be tested by following revisions which introduce optimizations that invoke the
new entrypoint.

Change-Id: I56d714bceb92c44a13c46d52457154b82577aa8c
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/67345
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-08-16 17:15:32 +00:00
Ryan Macnak b268f203eb [vm, gc] More aggressively consider idle compactions.
Bug: https://github.com/flutter/flutter/issues/20245
Change-Id: Ie993f4bbac6435b2305e46cfbe0e95115e8554f8
Reviewed-on: https://dart-review.googlesource.com/69060
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-08-11 00:55:58 +00:00
Ryan Macnak bd45ec0c4b [vm, gc] Refactor PageSpace::CollectGarbage to ensure the safepoint and task count remain well-scoped even with early exits.
Landing this separately makes it easier to see the changes for concurrent marking.

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: I8e2e2ca0cddbaba079cf54b6e8cff65c42e21684
Reviewed-on: https://dart-review.googlesource.com/68980
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-08-08 22:59:08 +00:00
Ryan Macnak a2b052939e [vm] Add timeline events for GC phases.
Change-Id: I1c4b58f848d590b5dce751167a7bbb23db2cb26b
Reviewed-on: https://dart-review.googlesource.com/66862
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-08-08 17:27:29 +00:00
Ryan Macnak 9b5a4241de [vm, gc] Don't rebuild the remembered set during marking.
Instead, only filter dead objects from the remembered set at the end of marking.

Allows scavenges to occur during concurrent marking, and avoids changing the mutator to handle a race with the concurrent marker for the remembered bit.

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: I116d7acc8fb57b8c3088febe6c196030a40fb319
Reviewed-on: https://dart-review.googlesource.com/67841
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-08-08 01:03:42 +00:00
Ryan Macnak ac69a3041a [vm, gc] Rename store_buffer.h as pointer_block.h as it also defines the mark stack blocks.
Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: I85ce8c639bbbfc9167c7c5462ff8756a81ecf3d3
Reviewed-on: https://dart-review.googlesource.com/68841
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-08-07 23:49:14 +00:00
Ryan Macnak c439ebead0 [vm, gc] Update old allocation stats when scanning instead of pushing.
Avoids the incremental barrier needing to deal with allocation stats, and avoids a repeated size calculation.

Bug: https://github.com/dart-lang/sdk/issues/34002
Change-Id: I9104ffca30174a3e659c93d20b4888678e8e759a
Reviewed-on: https://dart-review.googlesource.com/68221
Reviewed-by: Zach Anderson <zra@google.com>
2018-08-07 17:49:03 +00:00
Ryan Macnak 98a2e90d4f [vm] Combine internal and external allocation into one allocation limit.
Makes things a bit simpler and avoids the situation where a low external survival rate would trigger excessive GCs because the external allocation threshold would remain low.

Bug: https://github.com/dart-lang/sdk/issues/33637
Bug: https://github.com/flutter/flutter/issues/18519
Change-Id: I53b38bd41e6232eaab848c81b2a79f7ec73fab54
Reviewed-on: https://dart-review.googlesource.com/63503
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-07-03 17:17:33 +00:00
Ryan Macnak 71e8b418bf [vm] Account for external promotions; include external allocations in idle GC trigger.
A new-space collection during AllocateExternal may promote enough external allocations to warrant an old-space collection.

Bug: https://github.com/dart-lang/sdk/issues/33314
Change-Id: Ie7855e506869535435dc76b61ad30e5f42eda4a2
Reviewed-on: https://dart-review.googlesource.com/63449
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-07-02 20:37:35 +00:00
Ryan Macnak 8da46d35f5 [vm] Move heap-related code to its own subdirectory (cf. compiler).
Remove some dead includes.

Change-Id: I31f3e739e5ee46dcbba5d6a2f091491b46402943
Reviewed-on: https://dart-review.googlesource.com/60146
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-20 00:39:49 +00:00