public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV
@ 2004-04-18  9:29 thhal at mailblocks dot com
  2004-04-18  9:32 ` [Bug libgcj/15001] " thhal at mailblocks dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: thhal at mailblocks dot com @ 2004-04-18  9:29 UTC (permalink / raw)
  To: java-prs

When using JNI to call an interpreted method who's jmethodID stems from an
interface, the program receives a SIGSEGV. The signal handler in turn, goes into
an endless unwind loop and the program appears to be hung.

The sample program uses JNI to instantiate the "jvm", obtains the interface and
implementation class, instantiates the latter and tries to call a method on it.
First it uses a jmethodID obtained directly from the implementation class. That
succeeds. Then, it uses the jmethodID it gets when obtaining the same method
from the implemented interface. That fails.

I know that sending a compressed tar file is against your policy, but you do
need the .class files in order to reproduce this bug.

-- 
           Summary: Using JNI with interpreter and interface methods yields
                    SIGSEGV
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: thhal at mailblocks dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
  GCC host triplet: i86-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
@ 2004-04-18  9:32 ` thhal at mailblocks dot com
  2004-04-18 17:43 ` tromey at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: thhal at mailblocks dot com @ 2004-04-18  9:32 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From thhal at mailblocks dot com  2004-04-18 09:31 -------
Created an attachment (id=6109)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6109&action=view)
Sample code


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
  2004-04-18  9:32 ` [Bug libgcj/15001] " thhal at mailblocks dot com
@ 2004-04-18 17:43 ` tromey at gcc dot gnu dot org
  2004-04-18 17:47 ` [Bug libgcj/15001] [3.4 only] " pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tromey at gcc dot gnu dot org @ 2004-04-18 17:43 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From tromey at gcc dot gnu dot org  2004-04-18 17:43 -------
I suspect this bug was fixed by this:

2004-04-14  Andrew Haley  <aph@redhat.com>
            Bryce McKinlay  <mckinlay@redhat.com>

	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Use
	_Jv_LookupInterfaceMethodIdx for calls to interfaces.
	* include/jvm.h (_Jv_CallAnyMethodA): Add new `iface' arg.

	* testsuite/libjava.lang/InvokeInterface.java: New file.
	* testsuite/libjava.lang/InvokeInterface.out: New file.


This is only on cvs head, not in 3.4.
I've set the target milestone to 3.4.1 to indicate that we should
back-port this fix once 3.4.0 ships.



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.4.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] [3.4 only] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
  2004-04-18  9:32 ` [Bug libgcj/15001] " thhal at mailblocks dot com
  2004-04-18 17:43 ` tromey at gcc dot gnu dot org
@ 2004-04-18 17:47 ` pinskia at gcc dot gnu dot org
  2004-04-19  2:59 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-18 17:47 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Using JNI with interpreter  |[3.4 only] Using JNI with
                   |and interface methods yields|interpreter and interface
                   |SIGSEGV                     |methods yields SIGSEGV


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] [3.4 only] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (2 preceding siblings ...)
  2004-04-18 17:47 ` [Bug libgcj/15001] [3.4 only] " pinskia at gcc dot gnu dot org
@ 2004-04-19  2:59 ` pinskia at gcc dot gnu dot org
  2004-05-25 22:11 ` [Bug libgcj/15001] " mckinlay at redhat dot com
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-19  2:59 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-19 02:59 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-19 02:59:26
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (3 preceding siblings ...)
  2004-04-19  2:59 ` pinskia at gcc dot gnu dot org
@ 2004-05-25 22:11 ` mckinlay at redhat dot com
  2004-06-06  3:50 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mckinlay at redhat dot com @ 2004-05-25 22:11 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-05-25 22:09 -------
Actually this isn't restricted to 3.4, the problem occurs on mainline as well.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.4 only] Using JNI with   |Using JNI with interpreter
                   |interpreter and interface   |and interface methods yields
                   |methods yields SIGSEGV      |SIGSEGV


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (4 preceding siblings ...)
  2004-05-25 22:11 ` [Bug libgcj/15001] " mckinlay at redhat dot com
@ 2004-06-06  3:50 ` mmitchel at gcc dot gnu dot org
  2004-08-19 20:48 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-06-06  3:50 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-06-05 20:34 -------
Postponed until 3.4.2, unless someone fixes it sooner...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.1                       |3.4.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (5 preceding siblings ...)
  2004-06-06  3:50 ` mmitchel at gcc dot gnu dot org
@ 2004-08-19 20:48 ` mmitchel at gcc dot gnu dot org
  2004-09-09 16:03 ` mckinlay at redhat dot com
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-19 20:48 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-19 20:48 -------
Postponed until GCC 3.4.3.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.2                       |3.4.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (6 preceding siblings ...)
  2004-08-19 20:48 ` mmitchel at gcc dot gnu dot org
@ 2004-09-09 16:03 ` mckinlay at redhat dot com
  2004-09-21 18:20 ` tromey at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mckinlay at redhat dot com @ 2004-09-09 16:03 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-09-09 16:03 -------
I'll look into the status of this for the 3.4 branch. AFAIK, Interface calls via
JNI are still broken even on mainline. This patch only fixes it for reflection.
Perhaps we should put the old, non-index based code back in for the 3.4 branch,
and come up with a real fix for mainline.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (7 preceding siblings ...)
  2004-09-09 16:03 ` mckinlay at redhat dot com
@ 2004-09-21 18:20 ` tromey at gcc dot gnu dot org
  2004-11-01  0:44 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: tromey at gcc dot gnu dot org @ 2004-09-21 18:20 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From tromey at gcc dot gnu dot org  2004-09-21 18:19 -------
I looked at this a little, and wrote a test case
that can be checked in whenever we're ready.

This code is sort of a mess.  A jmethodID doesn't
have a pointer back to its declaring class, so
we don't have an easy way to tell whether or not
it came from an interface.

We could search the "receiver" object's class hierarchy
for the concrete method and use that, but this is
inefficient.

One question I have is why method->index is not -1 for
a method declared in an interface.  Perhaps declaring that
this must be -1 for such methods is the simplest fix.
Currently this is supposed to contain the dispatch index,
but I don't see that we ever use that.

Another approach would be to add a new flag to method->accflags
indicating that it is an interface method.  This is a hack, but
would work.  It would require going over bits of the runtime to
ensure that we mask this bit out as appropriate, e.g. when adding
Miranda methods to the concrete class hierarchy.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (8 preceding siblings ...)
  2004-09-21 18:20 ` tromey at gcc dot gnu dot org
@ 2004-11-01  0:44 ` mmitchel at gcc dot gnu dot org
  2004-12-10  5:47 ` mckinlay at redhat dot com
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-01  0:44 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-11-01 00:44 -------
Postponed until GCC 3.4.4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.3                       |3.4.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (9 preceding siblings ...)
  2004-11-01  0:44 ` mmitchel at gcc dot gnu dot org
@ 2004-12-10  5:47 ` mckinlay at redhat dot com
  2004-12-17 15:14 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mckinlay at redhat dot com @ 2004-12-10  5:47 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-12-10 05:47 -------
meth->index for an interface method should contain the IDT dispatch index for
that method, which allows us to use fast interface dispatch
(_Jv_LookupInterfaceMethodIdx) for Method.invoke() calls. Unfortunately, this
index is useless without also knowing which interface the method belongs to, and
as Tom points out, we do not currently have a way to get from a JNI jMethodID to
the interface, hence this PR.

Perhaps a special flag for interface methods would be the best fix in the short
term, until we can somehow fix JNI to give us a class/interface from a jMethodID.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (10 preceding siblings ...)
  2004-12-10  5:47 ` mckinlay at redhat dot com
@ 2004-12-17 15:14 ` cvs-commit at gcc dot gnu dot org
  2004-12-21  0:49 ` [Bug libgcj/15001] [3.4 only] " cvs-commit at gcc dot gnu dot org
  2005-01-18 20:37 ` tromey at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-17 15:14 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-17 15:13 -------
Subject: Bug 15001

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aph@gcc.gnu.org	2004-12-17 15:13:44

Modified files:
	libjava        : ChangeLog 
	libjava/java/lang/reflect: natMethod.cc 

Log message:
	2004-12-10  Andrew Haley  <aph@redhat.com>
	
	PR java/15001
	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Look up
	abstract methods by name.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3261&r2=1.3262
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/reflect/natMethod.cc.diff?cvsroot=gcc&r1=1.42&r2=1.43



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] [3.4 only] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (11 preceding siblings ...)
  2004-12-17 15:14 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-21  0:49 ` cvs-commit at gcc dot gnu dot org
  2005-01-18 20:37 ` tromey at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-21  0:49 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-21 00:49 -------
Subject: Bug 15001

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tromey@gcc.gnu.org	2004-12-21 00:49:46

Modified files:
	libjava        : ChangeLog 
Added files:
	libjava/testsuite/libjava.jni: iface.c iface.java iface.out 

Log message:
	PR java/15001
	* testsuite/libjava.jni/iface.c: New file.
	* testsuite/libjava.jni/iface.out: New file.
	* testsuite/libjava.jni/iface.java: New file.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3263&r2=1.3264
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.jni/iface.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.jni/iface.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.jni/iface.out.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

* [Bug libgcj/15001] [3.4 only] Using JNI with interpreter and interface methods yields SIGSEGV
  2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
                   ` (12 preceding siblings ...)
  2004-12-21  0:49 ` [Bug libgcj/15001] [3.4 only] " cvs-commit at gcc dot gnu dot org
@ 2005-01-18 20:37 ` tromey at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-01-18 20:37 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From tromey at gcc dot gnu dot org  2005-01-18 20:37 -------
Fix checked in.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15001


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

end of thread, other threads:[~2005-01-18 20:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-18  9:29 [Bug libgcj/15001] New: Using JNI with interpreter and interface methods yields SIGSEGV thhal at mailblocks dot com
2004-04-18  9:32 ` [Bug libgcj/15001] " thhal at mailblocks dot com
2004-04-18 17:43 ` tromey at gcc dot gnu dot org
2004-04-18 17:47 ` [Bug libgcj/15001] [3.4 only] " pinskia at gcc dot gnu dot org
2004-04-19  2:59 ` pinskia at gcc dot gnu dot org
2004-05-25 22:11 ` [Bug libgcj/15001] " mckinlay at redhat dot com
2004-06-06  3:50 ` mmitchel at gcc dot gnu dot org
2004-08-19 20:48 ` mmitchel at gcc dot gnu dot org
2004-09-09 16:03 ` mckinlay at redhat dot com
2004-09-21 18:20 ` tromey at gcc dot gnu dot org
2004-11-01  0:44 ` mmitchel at gcc dot gnu dot org
2004-12-10  5:47 ` mckinlay at redhat dot com
2004-12-17 15:14 ` cvs-commit at gcc dot gnu dot org
2004-12-21  0:49 ` [Bug libgcj/15001] [3.4 only] " cvs-commit at gcc dot gnu dot org
2005-01-18 20:37 ` tromey at gcc dot gnu dot org

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