public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [gomp4.1] make libgomp's splay tree implementation key agnostic
Date: Thu, 15 Oct 2015 14:56:00 -0000	[thread overview]
Message-ID: <561FBE84.4020601@redhat.com> (raw)
In-Reply-To: <20151015075612.GC478@tucnak.redhat.com>

On 10/15/2015 12:56 AM, Jakub Jelinek wrote:
> On Sun, Oct 11, 2015 at 12:47:19PM -0700, Aldy Hernandez wrote:
>> I'm investigating balanced binary tree options for the multiple priorities
>> variant of the task scheduler.  In looking at the splay tree adaption in
>> libgomp, I noticed that it requires preexisting typedefs and other
>> definitions before including splay-tree.h.  This makes it impossible to
>> reuse for another key within the library because splay-tree.c must know
>> about the node contents, and other files throughout libgomp all share the
>> aforementioned typedefs (because they all include libgomp.h).
>>
>> I also can't use libiberty's version because there are name conflicts with
>> libgomp's adaptation.
>>
>> I see no reason why the splay tree implementation itself (splay-tree.c)
>> needs to know about the content of the nodes.  With a little rearranging of
>> the data structures and some casts, we can reuse the splay trees at will.
>>
>> With the following patch we achieve the above, with the only penalty of an
>> indirection for a compare callback.
>>
>> Tested with make check-target-libgomp on x86-64 Linux.
>
> What about the following patch instead?
> Untested, other than compile time testing.

I would ideally like to look at sp->root from within header files 
(priority_queue.h) to quickly determine if we have an empty queue, and 
the contents of the splay tree are not available in the header file 
(task.c, or priority_queue.c as you describe).  I'd hate to have to call 
a splay-tree.c function to do so.

I could do pointer magic from the header file (yuck).

I could take sp == NULL to mean empty, but then we need to allocate the 
splay tree which is silly cause it's just one pointer.

Up to you, it's your baby. ;-)

Aldy

      reply	other threads:[~2015-10-15 14:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-11 19:47 Aldy Hernandez
2015-10-15  7:56 ` Jakub Jelinek
2015-10-15 14:56   ` Aldy Hernandez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561FBE84.4020601@redhat.com \
    --to=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).