[m-rev.] for review: [CTGC] user annotated sharing

Nancy Nancy.Mazur at cs.kuleuven.ac.be
Mon Jul 3 19:40:46 AEST 2006


>> The thing is, I feel a little insecure with all the renaming in the
>> different stages...
>>
>> * when parsing, the sharing information is in terms of the vars and
>> typevars that are part of the same foreign_proc declaration.
> 
> Yes.
> 
>> * this is renamed when adding the pragma to the HLDS, so that everything
>> becomes in terms of the vars/typevars used in the pred_info for that
>> foreign_proc...
> 
> No, at least for the vars.  They can't be renamed because they might be used
> within the foreign code.  To add a foreign clause for a predicate we insert
> a some extra unifications between the head of the predicate and the
> foreign_proc goal.  (For details see clauses_info_add_pragma_foreign_proc
> in add_pragma.m.)

Ok.

> As for the type variables, I haven't checked but I can't think why they
> would need to be renamed.

Well, I do...
The types are declared in the :- pred declaration of the given procedure.
The sharing information is declared in the foreign_proc declaration of 
the procedure, which includes repeating the type declaration of the 
procedure because these types might be needed for declaring sharing.
As the foreign_proc declaration will probably include some other 
variables as well (the arguments of the procedure), the id of the type 
variables might be different here in the proc-declaration, from their id 
in the pred-declaration.

I mean, the type variable "T" in a pred declaration might correspond to 
var(1), while that same type variable in the proc declaration might 
correspond to var(5)... Which is why renaming is needed.

So at the end: headvar-renaming is not necessary, but type renaming is, 
I think...

>> * during the actual sharing analysis, we need to handle foreign_proc
>> goals... and I have the feeling that the sharing recorded in its
>> attributes will definitely be in terms of the arguments of that
>> foreign_proc. But I am really unsure of this... okay, I could do
>> renaming anyway, but it would be good to know how things work there..
> 
> See above - as I understand it no renaming should be necessary (in fact
> it would probably be incorrect) provided that the sharing analysis handles
> foreign_proc goals correctly.

OK.

Thanks for all the reviewing...

Nancy
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list