[Gc] Re: Patch for native support of long weakrefs

Zach Saw zach.saw at gmail.com
Thu Nov 15 14:45:45 PST 2012


Hi Ivan,

To kill 2 birds with one stone - make the code simpler and be ready do add
> long refs:
>
> GC_move_disappearing_link code at present:
> LOCK
> ...
> if (..) {UNLOCK; return}
> ...
> if (..) {UNLOCK; return}
> ...
> if (..) {UNLOCK; return}
> ...
> UNLOCK
>
> I suggest:
> GC_move_disappearing_link_inner: no LOCK/UNLOCK
>
> GC_move_disappearing_link:
> int res;
> DCL_LOCK_STATE;
> // check args
> LOCK
> res = GC_move_disappearing_link_inner
> UNLOCK
> return res;
>
> I have done the above with a little addition (to avoid code duplication
when we add long-weakref support):

GC_move_disappearing_link:
// check args
return GC_move_disappearing_link_inner;

GC_move_disappearing_link_inner:
int result;
// check args
LOCK
result = GC_move_disappearing_link_locked;
UNLOCK
return result;


> As I said I doubt about GC_unregister_disappearing_link_inner - ok let's
> put all code back to it.
>
>
> Done.

Please review:
https://github.com/zachsaw/bdwgc/compare/54e6788...7183c8d

Zach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20121116/379525b2/attachment.htm


More information about the Gc mailing list