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

Issue 9531001: Implement weak references sets and provide an embedding API. (Closed)

Created:
8 years, 9 months ago by cshapiro
Modified:
8 years, 9 months ago
Reviewers:
siva, Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Implement weak references sets and provide an embedding API. Weak reference sets are similar to "populations" or "weak pairs". Like these structures, objects in a key set preserve members of an associated value set. Unlike these structures, a weak reference set is not a general associative container. Weak reference sets exist for the duration of a garbage collection. Weak reference sets are proceesed iteratively allowing values of one weak reference to be keys of a other weak reference sets. The garbage collector will process weak reference sets iteratively, revisiting all unmarked weak reference sets if any one weak reference set is marked. This process repeates until a fixed-point is reached. Committed: https://code.google.com/p/dart/source/detail?r=4917

Patch Set 1 #

Patch Set 2 : minor changes to prepare for review #

Total comments: 22

Patch Set 3 : address review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+459 lines, -4 lines) Patch
M runtime/include/dart_api.h View 1 1 chunk +22 lines, -0 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 2 1 chunk +33 lines, -0 lines 0 comments Download
M runtime/vm/dart_api_impl_test.cc View 1 2 1 chunk +275 lines, -0 lines 0 comments Download
M runtime/vm/dart_api_state.h View 1 2 4 chunks +64 lines, -2 lines 0 comments Download
M runtime/vm/gc_marker.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/gc_marker.cc View 1 2 4 chunks +64 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
cshapiro
8 years, 9 months ago (2012-02-29 02:09:04 UTC) #1
siva
LGTM with some comments. http://codereview.chromium.org/9531001/diff/2001/runtime/vm/dart_api_impl_test.cc File runtime/vm/dart_api_impl_test.cc (right): http://codereview.chromium.org/9531001/diff/2001/runtime/vm/dart_api_impl_test.cc#newcode1539 runtime/vm/dart_api_impl_test.cc:1539: EXPECT(Dart_IsNull(weak4)); weak3 and weak4 were ...
8 years, 9 months ago (2012-03-02 18:30:33 UTC) #2
cshapiro
http://codereview.chromium.org/9531001/diff/2001/runtime/vm/dart_api_impl_test.cc File runtime/vm/dart_api_impl_test.cc (right): http://codereview.chromium.org/9531001/diff/2001/runtime/vm/dart_api_impl_test.cc#newcode1539 runtime/vm/dart_api_impl_test.cc:1539: EXPECT(Dart_IsNull(weak4)); Yes, weak3 and weak4 were null before the ...
8 years, 9 months ago (2012-03-03 00:03:23 UTC) #3
Ivan Posva
8 years, 9 months ago (2012-03-05 19:04:41 UTC) #4
http://codereview.chromium.org/9531001/diff/2001/runtime/vm/gc_marker.cc
File runtime/vm/gc_marker.cc (right):

http://codereview.chromium.org/9531001/diff/2001/runtime/vm/gc_marker.cc#newc...
runtime/vm/gc_marker.cc:243: for (;;) {
while (true) {

http://codereview.chromium.org/9531001/diff/2001/runtime/vm/gc_marker.cc#newc...
runtime/vm/gc_marker.cc:247: break;
On 2012/03/03 00:03:23, cshapiro wrote:
> Probably not as that would cause a space leak.  The "queue" variable is a copy
> of the delay queue head.  After setting the delay queue head in the ApiState
to
> NULL on 245 we may have delayed a weak reference set in an intervening
iteration
> of the for loop. As such, state->delayed_weak_references() may not be NULL. 
The
> cleanup loop below is required to delete these objects.

I am not quite sure I follow your argument here. If you break out of the loop at
243 here, then the result of the check on 280 is guaranteed to be false as you
just set the delayed weak references to null at 245.

Powered by Google App Engine
This is Rietveld 408576698