PR 13948 and Miranda Methods
Ranjit Mathew
rmathew@gmail.com
Mon May 3 06:56:00 GMT 2004
Hi,
I was trying my bit to track down the cause
of PR 13948 this weekend and I am a bit confused
by some things. It'll be really nice if someone
can throw some light on these.
The basic support was added by Tom:
http://gcc.gnu.org/ml/java-patches/2003-q3/msg00357.html
which Andrew extended to cover interfaces:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14231#c6
and Bryce enhanced to use proper order of methods:
http://gcc.gnu.org/ml/java-patches/2003-q3/msg00648.html
Here are my questions:
1. In line 2057 of class.c (add_miranda_methods), why do
we start searching from index 1 and not 0? Once again,
my Java language skills are abyssmal so I can only
hazard a guess that interfaces have java.lang.Object
as their superclass - is it so? It seems to be
reinforced by what I actually see when inside a debugger
and by:
http://gcc.gnu.org/ml/gcc-patches/1999-12/msg00539.html
Is that why we ignore index 0?
In general, do we always store the superclass type at
index 0 of a basetypes vector for the Java front end?
2. Miranda methods are needed to work with older buggy VMs
that need an implicit method declaration in an abstract
class for a method from an implemented interface (right?).
AFAICT, Andrew's patch above was needed because GCJ treats
interfaces like abstract classes - but shouldn't it
create problems with other JVMs that don't?
3. Bryce's patch enforces method order by calling
layout_class_methods() for superinterfaces from
within add_miranda_methods().
However, layout_class_methods() calls add_miranda_methods()
anyways - so isn't the call on line 2097 made redundant by his
patch?
4. Line 2076 says:
/* An interface can have <clinit>. */
How? A naive attempt to write one fails as I had thought.
So what gives?
Sorry if these appear extremely "Duh!", but do try to
answer all the same.
Thanks,
Ranjit.
--
Ranjit Mathew Email: rmathew AT gmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.tripod.com/
More information about the Java
mailing list