Use NULL instead of END_X_QUEUE closures?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Use NULL instead of END_X_QUEUE closures?

Ömer Sinan Ağacan
Currently we sometimes use special closures to mark end of lists of different
objects. Some examples:

- END_TSO_QUEUE
- END_STM_WATCH_QUEUE
- END_STM_CHUNK_LIST

But we also use NULL for the same thing, e.g. in weak pointer lists
(old_weak_ptr_list, weak_ptr_list).

I'm wondering why we need special marker objects (which are actual closures
with info tables) instead of using NULL consistently. Current approach causes a
minor problem when working on the RTS because every time I traverse a list I
need to remember how the list is terminated (e.g. NULL when traversing weak
pointer lists, END_TSO_QUEUE when traversing TSO lists).

Ömer
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Use NULL instead of END_X_QUEUE closures?

Ryan Yates
Hi Ömer,

These are pointed to by objects traversed by GC.  They have info tables like any other heap object that GC can understand.  I think this is a much simpler invariant to hold then to have some heap objects point to NULL.

Ryan 

On Mon, May 7, 2018 at 3:34 PM, Ömer Sinan Ağacan <[hidden email]> wrote:
Currently we sometimes use special closures to mark end of lists of different
objects. Some examples:

- END_TSO_QUEUE
- END_STM_WATCH_QUEUE
- END_STM_CHUNK_LIST

But we also use NULL for the same thing, e.g. in weak pointer lists
(old_weak_ptr_list, weak_ptr_list).

I'm wondering why we need special marker objects (which are actual closures
with info tables) instead of using NULL consistently. Current approach causes a
minor problem when working on the RTS because every time I traverse a list I
need to remember how the list is terminated (e.g. NULL when traversing weak
pointer lists, END_TSO_QUEUE when traversing TSO lists).

Ömer
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs