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

Nancy Nancy.Mazur at cs.kuleuven.ac.be
Thu Jun 29 21:41:58 AEST 2006


Hi Julien,

> It isn't clear to me how this is supposed to work (but see comments about
> reference manual below.)
> 
...

> The new foreign_proc attributes need to be documented in the reference
> manual - for the time being the documentation should be commented out
> but it should still be added now.

I've added some documentation in the reference manual. Cf. attachment.
Does it make it all a little more clear?

> Also, you will (most probably) need to update the predicate replace_in_item/9
> in compiler/equiv_type.m, so that equivalence types in the sharing information
> are expanded, i.e. that predicate needs to be modified to handle
> foreign_procs.  I guess the smart recompilation system may also need to be
> changed for this - have a look at the type item_type in
> compiler/recompilation.m.

Okay, I'm having a look at it...

>> +    % Type to represent the sharing information that is manually added
>> +    % to procedures writtin in foreign code.
> 
> s/writtin/written/
> 
> (although "implemented as foreign_procs." would be be better.)

ok

>> +:- func add_foreign_code_sharing(module_info, proc_info, pred_proc_id,
>> +    pragma_foreign_proc_attributes, prog_context, sharing_as) = sharing_as.
> 
> That function would be more accurately named add_foreign_proc_sharing.
> 

ok

>> +:- pred sharing_as_from_user_annotated_sharing(
>> +    pragma_foreign_proc_attributes::in, sharing_as::out) is semidet.
>> +
>> +sharing_as_from_user_annotated_sharing(Attributes, UserSharingAs) :-
>> +    UserSharing = user_annotated_sharing(Attributes),
>> +    UserSharing = user_sharing(SharingDomain, _MaybeTypes),
>> +    % Accept only the value "bottom" and "real" for the structure sharing.
>> +    % If the user has annotated the sharing with unknown sharing, we might
>> +    % try to predict bottom anyway.
>> +    some [!SharingAs] (
>> +        (
>> +            SharingDomain = structure_sharing_bottom,
>> +            !:SharingAs = sharing_as_bottom
>> +        ;
>> +            SharingDomain = structure_sharing_real(_SharingPairs),
>> +            !:SharingAs = from_structure_sharing_domain(SharingDomain)
>> +
>> +            % XXX
>> +            % I have the feeling that renaming should not be needed at this
>> +            % place anymore, assuming that every foreign_proc call is
> 
> That sentence is incomplete.

It was saying:

% I have the feeling that renaming should not be needed at this
% place anymore, assuming that every foreign_proc call is
% correctly handled at the add_pragma stage?

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.
* 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...
* 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..

Nancy




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: refman.DIFF
Type: text/x-patch
Size: 4294 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20060629/8dcd05dc/attachment.bin>


More information about the reviews mailing list