[PPL-devel] Re: Raising Prolog exceptions from C code (2nd attempt)

Daniel Diaz Daniel.Diaz at univ-paris1.fr
Tue Jun 11 21:29:15 CEST 2002


Hi everybody,

Fergus is right, GNU Prolog uses ebp to map a WAM register in a physical
register (to increase efficiency). Since ebp serves as frame pointer,
the code using WAM internals should be compiled with
-fomit-frame-pointer. Other code CAN use ebp (since ebp is
saved/restored in called functions). But a foreign code needs to be
compiled withth -fomit-frame-pointer (and also -O2 or -O3).

Obviously this can be a problem for people using a precompiled version +
foreign code. However, it is not really difficult to compile a
customized version of GNU Prolog, in our case:

./configure --disable-ebp
make
make install

This is really not difficult (specially for people writing foreing
code).

I could also proposes 2 precompiled versions (one with ebp and another
one without ebp) but it is a bit heavy for me to always ensure both are
well produced. Finally I could only produce binaires with
--disable-ebp...



Fergus Henderson wrote:
> 
> On 11-Jun-2002, Manuel Carro <boris at aaron.ls.fi.upm.es> wrote:
> > Roberto Bagnara writes:
> >
> > >> Right.  However, I believe here the point is another one: do GNU and
> > >> Ciao Prolog require all foreign code they interoperate with to be compiled
> > >> with -fomit-frame-pointer for proper operation?  And: to interoperate
> > >> with foreign code compiled without -fomit-frame-pointer, is it necessary
> > >> to recompile GNU and Ciao Prolog without -fomit-frame-pointer?
> > >>
> > >> For GNU Prolog, the experiments conducted by Daniele and myself would
> > >> seem to indicate two positive answers.  Should that be confirmed, it would
> > >> constitute a serious drawback of GNU Prolog, since proper behavior should
> > >> not depend on how foreign code is compiled, provided the calling
> > >> conventions
> > >> of the platform at hand are respected (and compiling with or without
> > >> -fomit-frame-pointer has no influence, AFAICT, on the calling conventions
> > >> used in the platforms we are talking about).
> >
> >     It is possible that omiting the frame pointer (whose exact effect
> > on the assembler output I really do not know) somehow affects the
> > proper behavior of {long,set}jump.  Note that this behavior is anyway
> > not documented in the GCC manual --- maybe this kind of conduct is
> > part of the lore in the C compiler arena.
> 
> Omitting the frame pointer should not have any effect on the behaviour
> of setjmp() and longjmp().  If it does, then that is a bug in GCC,
> which should be reported.  But would be surprised by the existence of
> such a bug, since I have for quite some time been using setjmp() and
> longjmp() with GCC in code compiled with `-fomit-frame-pointer',
> without any problems.
> 
> The problem is more likely related to GNU Prolog's use of registers, IMHO.
> 
> --
> Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
> The University of Melbourne         |  of excellence is a lethal habit"
> WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
> 
> _______________________________________________
> Users-prolog mailing list
> Users-prolog at gnu.org
> http://mail.gnu.org/mailman/listinfo/users-prolog



More information about the PPL-devel mailing list