public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: quick little CNI question
  2000-04-01  0:00 ` Anthony Green
  2000-04-01  0:00   ` Tom Tromey
@ 2000-04-01  0:00   ` Bryce McKinlay
  1 sibling, 0 replies; 6+ messages in thread
From: Bryce McKinlay @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Anthony Green; +Cc: java-discuss

Anthony Green wrote:

> > Any updates on the progress of this (not in a hurry, just curious)?
>
> Bryce McKinlay has done the interface changes.  We're just waiting
> for FSF paperwork to go through before the changes go in (actually,
> Bryce, was there something else.... maybe to do with the interpreter?)

Yeah, I still need to sit down and figure out how the interpreter will work with
the new interface code. One option is to retain the existing
_Jv_LookupInterfaceMethod implementation in parallel - this would mean that the
interpreter would still work without significant changes, and might also be
useful as an interim solution to calling interfaces from CNI (as Tom suggests)

The other (more complex but faster) option would be to have the interpreter
behave more like a JIT, looking up the target method index of each
invokeinterface call as classes are loaded and storing it in memory somewhere.
Apparantly invokeinterface calls have an extra two unused bytes in the bytecode.
hmm... this might be the perfect place to put the index.

regards

  [ bryce ]


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: quick little CNI question
  2000-04-01  0:00 ` Anthony Green
@ 2000-04-01  0:00   ` Tom Tromey
  2000-04-01  0:00   ` Bryce McKinlay
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Anthony Green; +Cc: dalroth, java-discuss

Anthony> (actually, Bryce, was there something else.... maybe to do
Anthony> with the interpreter?)

Yeah.  I had a list of issues on the runtime side.  The interpreter
was the big one as I recall.

Anthony> Once these changes are in I believe we can look at an
Anthony> interface call interface from CNI.

Anthony> That being said, perhaps the newly implemented reflection
Anthony> code will let you call interfaces from C++.  Tom?

It seems like it should work, but I admit I forgot to test it.  Sigh.
I've made a note and I'll write a test case (or a PR, at least) once I
clear my current list (i.e., it will be a while).

If you don't mind having your code potentially break (because you'll
be relying on libgcj internals), you can also follow the code sequence
the compiler uses: call _Jv_LookupInterfaceMethod and treat the result
as a function pointer.

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

* quick little CNI question
@ 2000-04-01  0:00 Bryan Murphy
  2000-04-01  0:00 ` Anthony Green
  0 siblings, 1 reply; 6+ messages in thread
From: Bryan Murphy @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

"CNI does not currently provide any support for interfaces, or calling
methods from an interface pointer. This is partly because we are
planning to re-do how interfaces are implemented in gcj."

If I'm reading that correctly, I can't call interface based functions
from CNI yet.  Any updates on the progress of this (not in a hurry,
just curious)?




__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: quick little CNI question
  2000-04-01  0:00 quick little CNI question Bryan Murphy
@ 2000-04-01  0:00 ` Anthony Green
  2000-04-01  0:00   ` Tom Tromey
  2000-04-01  0:00   ` Bryce McKinlay
  0 siblings, 2 replies; 6+ messages in thread
From: Anthony Green @ 2000-04-01  0:00 UTC (permalink / raw)
  To: dalroth; +Cc: java-discuss

Bryan wrote:
> If I'm reading that correctly, I can't call interface based functions
> from CNI yet.

Right.

> Any updates on the progress of this (not in a hurry, just curious)?

Bryce McKinlay has done the interface changes.  We're just waiting
for FSF paperwork to go through before the changes go in (actually,
Bryce, was there something else.... maybe to do with the interpreter?)

Once these changes are in I believe we can look at an interface call
interface from CNI.

That being said, perhaps the newly implemented reflection code will
let you call interfaces from C++.  Tom?

AG

-- 
Anthony Green                                                        Red Hat
                                                       Sunnyvale, California

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: quick little CNI question
  2000-04-01  0:00 Glenn Chambers
@ 2000-04-01  0:00 ` Per Bothner
  0 siblings, 0 replies; 6+ messages in thread
From: Per Bothner @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

Glenn Chambers <GChambers@provsol.com> writes:

> Has anyone looked at whether the new C++ ABI that is being put together
> will remove the need for any sort of lookup?

It won't require any lookup - but then that has always been the case
for C++.  However, C++ uses (at least used) multiple vtbale pointers
per objects, and "adjustment" of the this pointer.  This violates the
JVM spec.  I believe it is possible for a JVM to work around that,
but it means that the actual data representation differs in
important ways from the JVMs model.  Specifically, you can't use
a simple interpreter without verification.

I mentioned the issue on the gcc mailing list - perhaps C++ could
use teh same data representation as Java in this respect, or at
least people should bear the java needs in mind.  However, I
don't think that is going to happen.  For one thing the expectations
for C++ is different than for Java, so using gcj's constant-time
lookup may not make sense for C++.  In any case, it is not a
critical problem.  We can always (and should someday) fix g++ so
that it knows about Java interfaces (field-less abstract classes that
have the Java property but don't inherit from Object), and can
generate the correct sequence for Java interface calls.  There is
nothing fundamentally difficult with this;  it's just a bit of a
pain, and other things have higher priority.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: quick little CNI question
@ 2000-04-01  0:00 Glenn Chambers
  2000-04-01  0:00 ` Per Bothner
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Chambers @ 2000-04-01  0:00 UTC (permalink / raw)
  To: 'Tom Tromey'; +Cc: java-discuss

> If you don't mind having your code potentially break (because you'll
> be relying on libgcj internals), you can also follow the code sequence
> the compiler uses: call _Jv_LookupInterfaceMethod and treat the result
> as a function pointer.

Has anyone looked at whether the new C++ ABI that is being put together
will remove the need for any sort of lookup?

I seem to recall that one of the recent patches said something about
pure virtual bases not requiring thunks anymore, which IIRC was the
problem with treating

<java>class x extends y implements z { }</java>

as

<c++>class x : public y, public z { }</c++>

(as I understand it, the new C++ ABI would use 
'class x: public y, public virtual z').

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-01  0:00 quick little CNI question Bryan Murphy
2000-04-01  0:00 ` Anthony Green
2000-04-01  0:00   ` Tom Tromey
2000-04-01  0:00   ` Bryce McKinlay
2000-04-01  0:00 Glenn Chambers
2000-04-01  0:00 ` Per Bothner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).