Subject: Re: hash table

From: Zheng Gengbing <[email-masked]>
Date: Wed, 22 May 1996 10:13:20 +0800 (EAT)

On Tue, 21 May 1996, Guansong Zhang wrote:

> On May 21, 10:25am, Zheng Gengbing wrote:
> > Subject: Re: hash table
> > On Mon, 20 May 1996, Guansong Zhang wrote:
> >
> > > On May 20, 11:11am, Zheng Gengbing wrote:
> > > > Subject: Re: Putting our project onto internet
> > > > On Sun, 19 May 1996, Guansong Zhang wrote:
> > > >
> > > > >
> > > > > 1. hash table.
> > > > >
> > > > > At first, compared with constructing AST, hash table is not important,
> but
> > > now
> > > > > it begins to affect the efficency in hpfsc. This not only makes hpfsc
> run
> > > very
> > > > > slow but also will affect any further work on compiler.
> > > > >
> > > > > So hash table should be added. In fact, there is a hash algorithm in
> > > Sage++. I
> > > > > will talk this further if we decide to use the same one.
> > > > >
> > > >
> > > >
> > > >
> > > > 	Since hash table is not saved in dumpdep files , so only after we
> > > > merge hpf2dep and hpfsc can we implement hash table .
> > > >
> > >
> > > Well, that is one way. But we may have alternative. What about the
> following:
> > >
> > > Hash table is just something for quick look up the symbol table. In fact,
> after
> > > readNodes, we can add one more procedure to build all the hash entry for
> the
> > > symbole table. This method is used in Sage++. The following is the code
> from
> > > db.c (unparse contains this part, but don't use them.)
> > >
> > >
> > > ---------------------------------------------------------------
> > >
> > > We can just use the above method, one thing should be emphasized is that
> any
> > > future work have to use the same hash method as this. We can put this
> procedure
> > > into basicop.
> > >
> > > The thing I am not sure about is that what happens if we have two symbol
> entry
> > > with same name. I think look up algorithm may take care of that. Right? If
> > > posible we may add the lookup-hash function also to the basicop.
> > >
> > > Any way, if we use this method, I think we can add hash table right away,
> > > without touching hpf2dep. But we have to change all the lookup functions in
> > > hpfsc.
> > >
> >
> >
> >
> > 	Ok, I have implemented hash table according to this . I add makehash.c
> > in basicop and add HASHMAX macro in defnodes.h and I rewrite the lookup
> > functions in hpfsc .
> > 	Although it reduced some time of compilation , the outcome is still
> > not very ideal. There still need about half a minute to compile rkNAG.f .
>

> Will your move is so fast. Do you think it is a good idea to put the hash
> method and your look up table to basicop? So all the future work can use them?
>

	Anyway hash table is neccessary for a mature compiler .And makehash.c
only contain 3 functions in your last letter . They are the most basic 
functions and it is enough now , 
but if hpf2dep implement hash table also , we will add some more.
hpfsc have a diffrent look up table function from hpf2dep , so I did not
put the function in basciop .

> Waiting for you comments.
> 
> As to the speed of compiling rkNAG.f, I will compare our work with IBM when I
> get the new update. And I think a little slow is acceptable. I think on IBM
> there should be different kind of flag to control how much things were checked.
> while ours will check all of them.
> 
> Guansong
> 

***************************************************************************
*     Zheng Gengbin                 *                                     *
*                                   *                                     *
*  Dept. of Computer Science        *  Phone:  86-10-2585088              *
*         & Technology              *  Email:                             *
*                                   *      [email-masked]   *
*  Peking University P.R.China      *  Mail:                              *
*                                   *      Room 1077 ,Building 47,        *
*                                   *      Peking University, P.R.China   *
***************************************************************************