Commit Graph

106 Commits

Author SHA1 Message Date
koda@google.com 04dcd31790 Consistent treatment of allocation failures in old space.
On OS page allocation failure, try GC, and throw OOM.
This will be exercised more often now that there is no default hard limit.

(However, writing a reliable unit test for this path is tricky.)

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43122 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 21:29:16 +00:00
koda@google.com 8b6d5b1ada Remove default heap size limit and add separate limit for externals.
Review URL: https://codereview.chromium.org//864843002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43111 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 16:32:20 +00:00
koda@google.com d4481420e0 Copy-on-write class table for concurrent reading.
Make ClassTable::At thread safe by keeping old copies of the class table.
They can be safely deallocated during the stop-the-world phase of GC.

This avoids making a copy for every sweeper task, and is the first step towards removing the fake Isolate workaround.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43048 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-21 18:13:12 +00:00
koda@google.com c7e9e048ed Rename Thread -> OSThread.
It's a collection of static utility methods for primitive operations on OS threads.

Make room in the namespace for upcoming class that will represent all the complex state of a VM thread.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42895 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 02:30:07 +00:00
johnmccutchan@google.com 81ce3ffef4 Speedup profile generation for stress test benchmark by 176x
Processed 779753 frames
CodeTables: live=9604 dead=5345 tag=51

FixTopFrame took 158092 millis.
CodeRegionTableBuilder took 13616 millis.
CodeRegionExclusiveTrieBuilder took 283 millis.
CodeRegionTableCallersBuilder took 57 millis.
CodeTableStream took 5637 millis.

~176 seconds

--- Fix PageSpace::FindObject to fast path executable pages

Processed 648584 frames
CodeTables: live=9398 dead=4655 tag=45

FixTopFrame took 68401 millis.
CodeRegionTableBuilder took 6401 millis.
CodeRegionExclusiveTrieBuilder took 222 millis.
CodeRegionTableCallersBuilder took 45 millis.
CodeTableStream took 267 millis.

~74 seconds

--- Fix PageSpace::Contains to fast path executable pages

Processed 690756 frames
CodeTables: live=9329 dead=5310 tag=49

FixTopFrame took 234 millis.
CodeRegionTableBuilder took 173 millis.
CodeRegionExclusiveTrieBuilder took 265 millis.
CodeRegionTableCallersBuilder took 60 millis.
CodeTableStream took 331 millis.

~1 second

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42672 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-07 21:39:49 +00:00
koda@google.com 0b85873fc8 Deletion barrier preparation: validate overwritten references.
With the upcoming deletion barrier, every update of a pointer field must know whether the previous value was a valid pointer.

Currently, we always use StorePointer/StoreSmi, both for initialization and updates.

Initialization, and thus the potential for overwriting garbage values, appears in three places:
1. Object::Allocate/Foo::New.
2. Creating isolate from full snapshot.
3. Allocation in generated code.

Case 1 already null-initializes all underlying memory.
Case 2 is addressed by this CL by exploiting that:
i) fresh pages are zero-filled by OS, and
ii) freelist headers use only even values.
Case 3 is remains a TODO for future CLs.

(An alternative solution for case 2 would have been to add an init_foo method for every set_foo called.)

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42584 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-02 18:16:13 +00:00
koda@google.com 9f5fb9d017 Check for OOM in HeapPage::Allocate.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42419 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 01:42:44 +00:00
koda@google.com cf45ba7af3 Concurrent sweep on x64.
Analogous to the ia32 change: https://codereview.chromium.org/624473003/

Update header word atomically in generated code.
Also convert unused LockCmpxchgl to LockCmpxchgq.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41756 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-15 01:29:49 +00:00
koda@google.com 8479136580 Support verified heap pointer writes on ia32.
With --verified_mem, use VerifiedMemory to duplicate all pointer writes in the heap, and verify that no unaccounted writes occurred.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41700 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-12 23:47:42 +00:00
koda@google.com f78517a5ba Atomic update of header word on ARM.
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41360 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-28 15:50:44 +00:00
koda@google.com 516a33a0cc Avoid races in capacity accounting.
Use pages_lock_ to sync access to usage_.capacity_in_words.
Also remove ASSERT no longer valid with concurrent sweep.

This does not resolve the more general issue of the growth policy not being perpared for concurrent sweeping.

BUG=21363
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41251 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-22 20:41:44 +00:00
iposva@google.com 3feded1f47 - Rename flags to reflect the generation impacted.
R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41202 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-20 15:26:04 +00:00
iposva@google.com 1cae9b9c40 - Fine grain locking of free list when sweeping concurrently.
Review URL: https://codereview.chromium.org//649743002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41049 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-10 19:44:41 +00:00
koda@google.com 2965f45064 Simplify VirtualMemory by removing unused ReserveAligned method.
Also add the ability to truncate without actually unmapping.
Note: We never create holes in the underlying reservation.

This CL is in preparation for using a thin wrapper around VirtualMemory to verify our upcoming concurrent write barrier.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41017 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-09 15:59:28 +00:00
koda@google.com 3e73a6bcbf Enable concurrent sweep for ia32.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40947 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-06 23:25:39 +00:00
koda@google.com 3291f76135 Avoid verifying heap while sweeper is running.
Verifier cannot handle a combination of dead+unswept objects and dead+swept objects.
* Verify before marking, before sweeping, and after a non-concurrent sweep.
* Disable pre/post-scavenge verification when concurrently sweeping.
* On shutdown, wait until concurrent GC tasks finish before verifying.

R=iposva@google.com
TBR=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40946 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-06 23:20:23 +00:00
koda@google.com 627e89639c Check mark bit when verifying heap.
Verify expected state of mark bit, depending on:
- pre vs. post-GC
- VM vs. regular isolate
- concurrent vs. regular sweep

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40943 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-06 19:24:45 +00:00
iposva@google.com 22e023caf8 - Revert concurrent sweep.
Review URL: https://codereview.chromium.org//619873007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40863 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-02 00:09:35 +00:00
iposva@google.com 27ba8bd48a - Reenable concurrent sweep on ia32.
R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40857 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-01 21:42:39 +00:00
koda@google.com e1e6e676ff Lazy walkability of old-space bump allocation block.
Do not write a freelist-element header into remainder on every allocation.

Add ExclusivePageIterator that locks and ensures walkability, and reduces code duplication.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40505 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-19 17:25:13 +00:00
koda@google.com cdafe57cac During promotion, use bump allocation whenever there are no small blocks available.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39893 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-05 01:07:57 +00:00
koda@google.com a82cf5960a Add lost usage update to TryAllocateInternal.
BUG=dart:20056
R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39785 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-02 23:36:31 +00:00
koda@google.com 0844cbcfbe Proof-of-concept pretenuring of some strings:
- Add bump-pointer allocated block in page space.
- Pretenure num.toString whenever >98% of strings are being promoted.
- Fix deadlock in freelist printing.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39688 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-29 03:54:12 +00:00
iposva@google.com 9d8b4d9d65 - Disable concurrent sweep.
Review URL: https://codereview.chromium.org//501113003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39625 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 22:38:46 +00:00
iposva@google.com ebb9c61da5 - Introduce a synchronous GC before throwing OOM.
R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39618 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 20:36:59 +00:00
iposva@google.com 8130a3b120 - Disable concurrent GC.
Review URL: https://codereview.chromium.org//508133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39594 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 14:19:41 +00:00
iposva@google.com 2ee3263277 - Add and enable concurrent sweeper.
- Keep separate lists for normal sized executable and data pages.

R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39593 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-27 13:37:55 +00:00
turnidge@google.com 4d5f3ba638 vmservice protocol cleanup
user_name -> name
name -> vmName

Also, vmName is now only provided when it differs from name.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39525 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-25 18:53:43 +00:00
iposva@google.com 03e8b14ed9 - Address review comments from https://codereview.chromium.org/474913004/
- Clearly mark overrides of ThreadPool::Task::Run as virtual.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39418 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-20 18:37:29 +00:00
iposva@google.com 131a381020 - Stop-the-world sweep uses pre-locked free list access.
Review URL: https://codereview.chromium.org//488943002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39399 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-20 07:11:17 +00:00
iposva@google.com 4835041da9 - Account for number of pending tasks in old-space collections.
- Protect access to the free lists.
- MutexLocker/MonitorLocker do not need to be StackResources.

R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39396 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-20 03:54:14 +00:00
koda@google.com 6c4eff32c9 If a large object is truncated, also truncate the page.
If GC sweeper finds a truncated large object, the page is shrunk to fit.

Allows reclaiming memory when a large string is externalized.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37842 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-30 22:59:07 +00:00
johnmccutchan@google.com 4ef2564f30 Avoid infinities in vm:service because they are not supported by JSON.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37757 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 20:18:59 +00:00
johnmccutchan@google.com 5fab97a6e7 Display average time between collections
BUG=
R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37749 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 19:53:29 +00:00
koda@google.com b23b4ddd52 Verify that GC can handle trailing fillers in large pages.
Assert that filler objects created by String::MakeExternal and Array::MakeArray in large pages are never marked.

Add unit test that exercises the verification code.

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37577 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-22 00:49:41 +00:00
iposva@google.com 3878793b10 - Reduce the number of Isolate::Current() calls.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36564 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-23 12:07:33 +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
koda@google.com 5b439c3868 De-duplicate code by adding size-independent iteration.
This is also in preparation for potentially having more than two classes of page.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35693 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-02 16:27:32 +00:00
koda@google.com 2373b673b3 Add Heap::isolate_ to simplify code.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35434 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-25 17:49:27 +00:00
iposva@google.com 69fcc15576 - Account for live size in marker.
R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35413 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 23:20:48 +00:00
koda@google.com 12fd7df2bc Use history to estimate what fraction of allocation will be garbage => grow more when less garbage was collected.
Change semantics of heap_growth_rate flag to mean *maximum* number of pages we grow.

Allow more initial growth before first mark-sweep => many small programs will avoid mark-sweep.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35410 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 22:30:20 +00:00
koda@google.com 8b204e9ac0 RingBuffer<T, N> utility with unit test; use for GC history.
Prompted by index-out-of-bounds error in old code (bug 18375).

BUG=dart:18375
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35384 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 17:07:51 +00:00
koda@google.com 36d2d507f8 Limit shrinkage: allow growth by at least half the pages freed by GC.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35145 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-17 17:06:44 +00:00
koda@google.com f7ba0c9191 Fix used vs. capacity growth computation mismatch.
Free space was not being taking into consideration,
effectively growing more when more garbage was collected.

This change makes the growth uniform. (In the future,
we probably want to grow more when less was collected.)

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34909 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-10 00:24:23 +00:00
koda@google.com 6721f81926 Reset growth control state after isolate initialization.
(a) When enabling the growth control, e.g. after isolate
initialization, the current usage should be the new basis for
growth control. This is consistent with the behavior before
r34747.

(b) Advise GC only when the number of allowed pages has been
(strictly) exceeded, rather than met. This is consistent with
the behavior before r34747.

Part (a) fixes the Havlak performance regression (3%).

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34793 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-07 18:40:45 +00:00
koda@google.com 5e4d540c27 Corrected resubmssion of r34736.
Fix: Division by page size in NeedsGarbageCollection.
Original description:

Generalize the interface of page space controller.

Gather used/capacity/external into SpaceUsage object,
and use it for testing whether GC is needed before or
after an allocation.

This refactor does not affect policy, but prepares for:
1. Replacing promotion failure check/tracking.
2. Better growth control for external allocation.

TBR=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34747 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-04 21:04:48 +00:00
koda@google.com 09b1d66049 Revert r34736 due to slowdown.
TBR=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34741 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-04 18:39:10 +00:00
koda@google.com 00445b37ea Generalize the interface of page space controller.
Gather used/capacity/external into SpaceUsage object,
and use it for testing whether GC is needed before or
after an allocation.

This refactor does not affect policy, but prepares for:
1. Replacing promotion failure check/tracking.
2. Better growth control for external allocation.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34736 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-04 17:46:15 +00:00
koda@google.com 9a8671276b Add class and address information to heap map; display on hover.
Display a string like "String @ 0xe97c3328" while hovering over the map.

Also add page separators (black).

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34195 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-20 18:56:45 +00:00
koda@google.com 0088b5e3d6 Fix arm/mac builds: cast enum.
TBR=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33609 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-12 20:54:27 +00:00