On Sat, 2 Jun 2012 11:47:51 -0700
Brett Foster <fost...@edgeandvertex.org> wrote:

> On Sat, Jun 2, 2012 at 11:31 AM, Basile Starynkevitch
> <bas...@starynkevitch.net> wrote:
> > In the MELT meta-plugin (recall that MELT is a high-level domain specific 
> > language to
> > extend GCC, see http://gcc-melt.org/ for more) we extensively use 
> > associative hash-tables
> > for that. MELT offers homogeneous hash-tables, e.g. hash-table associating 
> > tree (i.e.
> > non-null tree pointers) to arbitrary non-null MELT values (e.g. MELT 
> > closures, or MELT
> > lists, or MELT objects, etc etc), or hash-table associating (non null) 
> > gimple to non
> > null MELT values.
> >
> > So you can have e.g. an hash-table associating each tree (every tree is in 
> > GCC a non-null
> > pointer to a structure) with data associated to it. Once it has some data 
> > you know that
> > this tree has been visited.
> 
> I'll poke around the MELT source code -
> 
> In Melt, where in source code may I have a look to see how trees and
> mapped to the hash table? Are you able to summarize the basics? I.e.
> the hash for a specific node tree is derived from what data? Pointer
> address?

MELT has a generic pointer (using the pointer address as hash function) to MELT 
value hash
table. In its file melt-runtime.c which you can browse at
http://gcc.gnu.org/viewcvs/branches/melt-branch/gcc/melt-runtime.c
you can find near lines 3795-4020 functions like meltgc_raw_new_mappointers
meltgc_raw_put_mappointers melt_raw_get_mappointers ...

There are used from inline functions in gcc/melt-runtime.h &
gcc/melt/generated/meltrunsup.h ; allocated size of hash tables is a prime 
number...

Feel free to ask more questions about that. (notice that MELT has a low-traffic 
dedicated
list gcc-m...@googlegroups.com etc..)

Feel also free to download & try MELT!

Cheers

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Reply via email to