Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1096)

Issue 507025: Force mark sweep if size of map space is to big to allow forward pointers enc... (Closed)

Created:
11 years ago by antonm
Modified:
9 years, 4 months ago
CC:
v8-dev
Visibility:
Public.

Description

Force mark sweep instead of compcation if size of map space is too big to allow forward pointers encoding. Committed: http://code.google.com/p/v8/source/detail?r=3497

Patch Set 1 #

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -12 lines) Patch
M src/flag-definitions.h View 1 chunk +3 lines, -0 lines 0 comments Download
M src/heap.h View 1 1 chunk +0 lines, -5 lines 0 comments Download
M src/heap.cc View 1 1 chunk +4 lines, -1 line 0 comments Download
M src/mark-compact.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download
M src/spaces.h View 1 3 chunks +14 lines, -5 lines 0 comments Download
M src/spaces.cc View 1 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 4 (0 generated)
antonm
11 years ago (2009-12-16 18:43:20 UTC) #1
Søren Thygesen Gjesse
LGTM - even though this is a somewhat scary path... Maybe we should consider putting ...
11 years ago (2009-12-17 14:35:02 UTC) #2
Søren Thygesen Gjesse
On 2009/12/17 14:35:02, Søren Gjesse wrote: > LGTM > > - even though this is ...
11 years ago (2009-12-17 14:48:12 UTC) #3
antonm
11 years ago (2009-12-17 22:18:16 UTC) #4
Thanks a lot for comments, Søren.

On 2009/12/17 14:48:12, Søren Gjesse wrote:
> On 2009/12/17 14:35:02, Søren Gjesse wrote:
> > LGTM
> > 
> > - even though this is a somewhat scary path...

Agree.

> > 
> > Maybe we should consider putting this behind a flag but have it default to
> true.
> > This makes it easy to turn it off for testing.

Flag added.  Besides that I had to drop unit tests as they now (with bigger map
space) take almost eternity to finish (due to forced GC when we allocated too
much).  I did however run them artificially reducing the number of bits in map
index encoding.

> > The problematic part is that we will never compact the heap again nor free
any
> > pages after map space has out-grown the size where map pointers cannot be
> > encoded.
> > 
> > We should consider adding compacting of map space (in a new CL) if the
number
> of
> > live maps after a mark-sweep is below the threshold. Kevin has a idea of how
> to
> > do this:

Sure.

> > 1. Move maps into the first pages of the map space leaving a forwarding
> pointer
> > in the moved maps. This can be done using one pointer starting at the
> beginning
> > of map space and another pointer starting at the end. Sweeping backwards is
> > possible as we know exactly the what is in map space, however the linked
list
> of
> > pages adds some complications.
> > 
> > 2. Sweep the heap to make map pointers pointing to a forwarded map point to
> the
> > new location.
> > 
> > 3. Free all the unused pages of map space.
> 
> After talking to Kevin again the backwards scan is not required. The number of
> live maps gives the number of pages of map pages required to hold all live
maps.
> Skip past these to find the first page from which to start relocating maps.
This
> page and the rest of the pages in teh map space will be free after the map
> compaction.

Am I missing something or we could do almost a normal compact, almost as we
actually can compact across pages when compacting maps only?

It might be precisely what you and Kevin are suggesting, so let's me reformulate
how I see it:

After forced mark sweep if number of live maps dropped below some threshold we
do:

1) create backpointers once again (or probably not restore them);
2) compact using a normal bump allocation maps starting from the first page of
map space and writing forwarding address as a normal address (setting some low
bits, e.g. mark bit to be able to iterate live maps later) into a map field;
3) iterate through all the objects in the heap and for all the object adjust map
pointer and for maps prototype field as well (maybe transitions, but not sure,
hopefully backpointers should be enough) + restore meta_map;
4) move live maps to their forwarding allocations;
5) restore transitions;
6) release tail pages.

Does that sound correct?

Anyway, I'd love to implement this map compaction.

Powered by Google App Engine
This is Rietveld 408576698