[m-dev.] Update library pragma C code

Peter Schachte pets at students.cs.mu.OZ.AU
Sat Aug 1 00:03:41 AEST 1998


On Fri, 31 Jul 1998, Thomas Charles CONWAY wrote:

> 	Convert
> 		:- pagma(c_code, ...
> 	to 
> 		:- pagma c_code(...
> 	
> 	and introduce will_not_call_mercury in places where it is implicit
> 	(this is in preparation for changing the default to may_call_mercury).

Interesting.  I was just thinking that it would be good if the compiler
could determine which predicates might do trailing, so that the
extra overhead in choicepoint handling in tr grades could be avoided (at
least sometimes).  The problem is that all trailing ultimately happens in C
code, and there's no mechanism for telling the Mercury system whether or
not a bit of C code might do trailing or not.  As far as I can see, there's
no way to convince the C compiler to tell us, so if we want to (ever be able
to) do this sort of optimization, there will have to be a way for users to
declare this.

The reason I mention this now is that I was thinking that the current
may_call_mercury/will_not_call_mercury labeling is really a bit too limited,
and while you're monkeying with this stuff anyway would be a good time to
generalize it a bit more.  I think it would be better if that sort of info
were given as a list of "tags", so that the set of possible tags could be
expanded with the evolution of Mercury.  I'd like to propose the addition of
may_trail/will_not_trail as the first extension.


-Peter Schachte               | Any movement in history which attempts to
mailto:pets at cs.mu.OZ.AU       | perpetuate itself, becomes reactionary.
http://www.cs.mu.oz.au/~pets/ |     -- Josip Broz Tito 
PGP: finger pets at 128.250.37.3 | 




More information about the developers mailing list