[m-rev.] Java back-end milestone

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Dec 3 02:44:01 AEDT 2003


On 02-Dec-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> On Tue, Dec 02, 2003 at 08:59:37PM +1100, Fergus Henderson wrote:
> > Index: compiler/mlds_to_java.m
> > +%	RTTI: currently we generate RTTI data which compiles,
> > +%		but which is not actually usable.  The class
> > +%		hierarchy of the RTTI classes in java/runtime/*.java
> > +%		needs quite a bit of work.  It is implemented in a way
> > +%		that mirrors what we do for C, but in C we rely on being
> > +%		able to coerce between different types that have the same
> > +%		initial fields (e.g. FA_TypeInfo_Struct and TypeInfo_Struct),
> > +%		and that doesn't work in Java.
> 
> Shouldn't the RTTI for java be very similar to what is done for the .NET
> backend?  After all both backends have similar problems.

Ideally yes, but for historical reasons this is currently not the case.

The RTTI for the .NET back-end uses a low-level data representation, IIUC,
but in the long run it would be nicer to use a high-level data
representation.  For the Java back-end, we have gone straight to
a high-level data representation for both RTTI and ordinary data types.

AFAIK the .NET back-end also mirrors what we do for C, in that the layouts
of the RTTI data types match the layouts used for C.  But the .NET back-end
does so using a low-level representation (i.e. object[]) rather than
named types.  This means that the coercions mentioned above don't cause
any trouble.

> I did a lot of work on implementing a lot of the RTTI in Mercury (see
> rtti_implementation.m).  All that it should require is that one
> implements the foreign_proc functions which are used to access various
> fields in the RTTI structures.

Firstly, the documentation in rtti_implementation.m says

	% This module is not complete, currently only enough functionality is
	% present to implement type_info comparisons and unifications (which
	% is enough to get univ working).

If that is not correct, could you please update it?

Secondly, there are 50 different procedures defined in C# in
rtti_implementation.m.  That's quite a lot.  So implementing all of
those in Java would be quite a bit of work, even if it wasn't for the
issue of low-level vs high-level data.

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