Previously, GC would only be triggered by external allocations on
reaching a limit indicated by a flag. This limit was too large
and not set thoughtfully by anyone.
This CL triggers GC when external allocations in old gen grow
larger than some limit based on results of previous GC, similar
to how Dart heap growth triggers GC. GC is triggered for new gen
when external allocations reach 4x the current new gen
capacity.
FL-61
Change-Id: I1d4da467bc2aab64058f25296aefdd73eebc38e6
Reviewed-on: https://dart-review.googlesource.com/58100
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
This allows running the sliding compactor for AOT and App-JIT.
The loaders on Mac and Linux do not respect alignments greater than the virtual page size, and we must use the system loader on iOS to get the executable image page. In the future, we might try to organize instructions for AOT/App-JIT off of an image page.
dart2js hello compaction time (without marking):
30249 us -> 31351 us (+3.6%) N=10
Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: I6e9ffd04df30ef0a09f1b123ae0c148f11448627
Reviewed-on: https://dart-review.googlesource.com/19140
Reviewed-by: Erik Corry <erikcorry@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
With the current block size, this reduces space for forwarding information from two words per moved object to two words per (kObjectAlignment * kBitsPerWord) bytes of heap (1.6% on 64-bit, 3.1% on 32-bit).
dart2js compiling dart2js:
Compactor/Sweeper Runtime Max RSS
Sliding (binary search table) 105 s 1.085 GB
Sliding (bitvector) 57.8 s 998.566 MB
Evacuating 66.2 s 1.714 GB
Concurrent sweep 53.8 s 1.183 GB
Blocking sweep 55.0 s 1.181 GB
Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: Ia6eec4f0162c3959154c5155df24cc06694ecac7
Reviewed-on: https://dart-review.googlesource.com/17721
Reviewed-by: Erik Corry <erikcorry@google.com>
Improves the space overhead of compaction from O(size of live objects) to O(number of live objects).
Future work includes:
- a smaller, faster representation the forwarding table via a bitmap of used allocation units
- sorting class sizes off-heap to allow sliding classes
- running forwarding in parallel
Removes unnecessary sweep from evacuating compactor.
Change-Id: If0991bfb75573201c6e8feed142ca0cc69fccab4
Bug: https://github.com/dart-lang/sdk/issues/30978
Reviewed-on: https://dart-review.googlesource.com/15988
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
The compactor copies all live objects in old space to fresh pages, places forwarding pointers in the old objects, forwards all the pointers, then frees the old pages. This has a high space overhead. It is not meant for use in production, but meant to test that the VM is properly set up to handle old-space objects moving.
Large page objects and instruction objects are not moved.
Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: Ia42683fd5e27a33702aa5e83bece803a8b005a4b
Reviewed-on: https://dart-review.googlesource.com/13624
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
Estimate the speed of mark-sweep (or just marking if concurrent sweep is enabled) and use it to decide if a mark-sweep would complete within an idle period.
Start considering idle mark-sweeps when old-space has grown half way to the size that will trigger a blocking GC.
Change-Id: Id03e443365c2f965b41cbc1b7787916edbe7f48f
Reviewed-on: https://dart-review.googlesource.com/3423
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This CL assigns names to vmos formatted as "isolate space type" where
isolate is the name of the isolate, space is "oldspace" or "newspace",
and type is "code" or "data".
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2929203002 .
The Scavenge (young-gen) GCs on the main thread have to wait for other
threads to check in at a safe point. We were seeing big waits here, often
20ms, occasionally up to 180ms where the main thread is idling, waiting
for the optimizing compiler. By adding more safe points the wait is
reduced and is now rarely over 10ms, often under 1ms.
This also changes the --verbose-gc output to be better aligned with the
column headings, and to add the time needed to get to
the safe point to the output, eg:
[ GC(784211551): Scavenge(new space), 18, 2.209, 76.009, 32768, 0, 32768, 32768, 0, 0, 144912, 154425, 152064, 154880, 0, 0, 46.984, 2.752, 7.407, 18.657, 0.033, 5421, 0, 0, 0, ]
^^^^^^ Scavenge time ^^^^^^ safe point time.
R=vegorov@google.com
BUG=
Review-Url: https://codereview.chromium.org/2771013002 .
heap contains verification under it. This flag is turned on automatically
when verify_before_gc, verify_after_gc or verify_on_transition is
specified. This should speed up the debug builds on the bot.
A dart2js build line for instance goes from 2357.526 seconds
to 184.22 seconds
2. Verify heap on shutdown only under the flag verify_on_transition.
R=fschneider@google.com
Review-Url: https://codereview.chromium.org/2626343002 .
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER
This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.
R=asiva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/2450713004 .
- fixed an inadvertant flip in the safepoint check in this cl
https://github.com/dart-lang/sdk/commit/e72c1fb47
- return (IsMutatorThread() ||
- (isolate_ != NULL && !isolate_->thread_registry()->AtSafepoint()));
+ return (IsMutatorThread() || IsAtSafepoint());
- increase the scope of CanCollectGarbage in Heap::AllocateOld to also
account for the tasks lock as checking for tasks inside a safepoint
scope can lead to deadlocks
- fix an aggressive assertion in compiler for expected errors being only
LanguageErrors to allowing UnhandledExceptions (OOM, stack overflows etc.)
- fix an aggressive assert in exception handler (handler pc can be 0 even in the mutator thread.
- workaround issue 27413 in PageSpace::CanIncreaseCapacityInWords
BUG=27380
R=fschneider@google.com
Review URL: https://codereview.chromium.org/2363823002 .
-Pre-mark instructions when writing the snapshot.
-Write the megamorphic miss function to the snapshot.
-Add missing ExceptionHandlers for megamorphic miss code.
-Add missing C++ entry points.
-Relocate Function and Code entry_points_ when reading precompiled snapshot.
-Don't try to load a script again when running from a precompiled snapshot.
R=asiva@google.com
Review URL: https://codereview.chromium.org//1336763002 .
Make context allocation stub shared between isolates.
The fast-path used in optimized code still has isolate-specific
addresses inlined for performance reasons.
Common functions are moved into class_table.h/.cc.
This is a preparation for adding an isolate-independent version of the
allocation code and allocation tracking code.
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//1241863002 .
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 .