[m-dev.] for review: Infrastructure for Java Backend

Julien Fischer juliensf at students.cs.mu.oz.au
Thu Jan 25 14:29:49 AEDT 2001


On Tue, 23 Jan 2001, Fergus Henderson wrote:

> On 23-Jan-2001, Julien Fischer <juliensf at students.cs.mu.oz.au> wrote:
> > 
> >  
> > -%-----------------------------------------------------------------------------%
> > +	% Succeeds iff this definition is a function definition which
> > +	% defines a special_pred
> > +:- pred defn_is_special_pred(mlds__defn).
> > +:- mode defn_is_special_pred(in) is semidet.
> 
> What should this do for continuation functions which form part of the
> definition of special_pred?  This can occur e.g. for types with 
> user-defined equality functions, if the user-defined equality function
> calls nondeterministic procedures.
> Should defn_is_special_pred succeed for those?

It should succeed for anything that is a special pred. (See below)  

> > +defn_is_special_pred(Defn) :-
> > +	Defn  = mlds__defn(Name, _Context, _Flags, _Body),
> > +	Name  = function(Label, _ProcID, _MaybeSeqNum, _PredID),
> > +	Label = special_pred(_, _, _, _).
> 
> This ignores _MaybeSeqNum -- is that the right thing to do?
Probably, it seems to be working thus far. 


> > +	% Succeeds iff this definition is a data definition which
> > +	% defines RTTI 
> > +:- pred defn_is_rtti(mlds__defn).
> > +:- mode defn_is_rtti(in) is semidet.
> ...
> > +defn_is_rtti(Defn) :-
> > +	Defn = mlds__defn(_Name, _Context, _Flags, Body),
> > +	Body = mlds__data(Type, _),
> > +	Type = mlds__rtti_type(_).
> 
> What is that needed for?

Both these predicates are used by the Java backend for MLDS->MLDS 
transformations.  They are in ml_util.m rather mlds_to_java.m, because
the code that does the transformations is probably going to be moved
from there (Tyson said something about using it in the IL backend).

defn_is_special_pred should succeed for all special predicates, I was
actually leaving it up to the code that does the MLDS->MLDS
transformations to decide what, if anything, to do with them.

At the moment defn_is_rtti just filter out RTTI defnitions from
the Java output.  I think the RTTI definitions need to transformed
a bit to set up the "function pointers" we use.  At least this is the
plan.  (Actually, it could probably be done at the code generation level, 
but seeing as the MLDS defnitions have to be transformed anyway, we might
as well transform them a bit more).

Julien



--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list