This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: interface dispatch


Godmar Back <gback@cs.utah.edu> writes:

> public class I {
> 	interface A {}
> 	interface B {
> 		boolean equals(Object _);
> 	}
> 	void f(A x) {
> 		x.equals(null);	// compile this into invokevirtual
> 	}
> 	void g(B x) {
> 		x.equals(null);	// compile this into invokeinterface
> 	}
> }

Techically, you're right, according to the JLS revision.  But this is
not very interesting.  I can see no way that it matters either way,
except for reflection.  Thus when an a method in Object is called, we
can implement it as if it were invokeinterface or invokevirtual; there
is no semantic difference. Since invokevirtual is faster, a compiler
(gcj or jit) should do that.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]