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

Issue 9398014: Ignore deleted handles when processing weak roots. (Closed)

Created:
8 years, 10 months ago by cshapiro
Modified:
8 years, 10 months ago
Reviewers:
siva
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Ignore deleted handles when processing weak roots. Previously, deleted weak persistent handles in live handle blocks were always assumed live. With this change, dead handles are always ignored. When a handle is deleted NULL is stored into the raw object member. This looks like a Smi encoded 0. As the handle blocks do not otherwise encode which elements are live in an allocated block, the garbage collector now uses this signal to distinguish live handles from deleted handles. BUG=1640 Committed: https://code.google.com/p/dart/source/detail?r=4291

Patch Set 1 #

Total comments: 1

Patch Set 2 : final revision #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -3 lines) Patch
M runtime/vm/dart_api_impl_test.cc View 1 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/vm/dart_api_state.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M runtime/vm/gc_marker.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/scavenger.cc View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
cshapiro
8 years, 10 months ago (2012-02-15 01:01:15 UTC) #1
siva
LGTM https://chromiumcodereview.appspot.com/9398014/diff/1/runtime/vm/gc_marker.cc File runtime/vm/gc_marker.cc (right): https://chromiumcodereview.appspot.com/9398014/diff/1/runtime/vm/gc_marker.cc#newcode201 runtime/vm/gc_marker.cc:201: // Deleted handles are identified by a Smi ...
8 years, 10 months ago (2012-02-15 01:45:07 UTC) #2
cshapiro
I figured out why I chose to stuff a Smi in the raw_ slot. Consider ...
8 years, 10 months ago (2012-02-15 03:18:47 UTC) #3
cshapiro
It is trivial... After a weak persistent handle is freed, the callback pointer is used ...
8 years, 10 months ago (2012-02-15 07:35:30 UTC) #4
siva
> There is a subtle advantage to the Smi hack. If we reduce strong persistent ...
8 years, 10 months ago (2012-02-15 18:49:25 UTC) #5
cshapiro
8 years, 10 months ago (2012-02-15 20:55:48 UTC) #6
> It seems tacky to assume that a C pointer will look like a Smi because all C
> pointers are aligned. I would prefer not to make that assumption. Threading
the
> free list through the peer field seems safer. I see that we are already
> overloading the raw_ field with a C pointer in the case of persistent handles.
> We should at least add an assertion in SetNext that 'free_list' is aligned.

The half-step of storing NULL into the raw object field is safe in this regard
as 0 is quite conveniently aligned.  But, we will have the same problem that the
regular persistent handle has if we re-use the raw field.

> I am fine with using the Smi hack to squash this bug now and then revisiting
> this in a follow up change.

Sounds good.

Powered by Google App Engine
This is Rietveld 408576698