public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/18278] JNI functions cannot return a weak reference
[not found] <bug-18278-9563@http.gcc.gnu.org/bugzilla/>
@ 2005-11-28 20:06 ` tromey at gcc dot gnu dot org
2005-11-29 18:35 ` tromey at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-11-28 20:06 UTC (permalink / raw)
To: java-prs
------- Comment #7 from tromey at gcc dot gnu dot org 2005-11-28 20:06 -------
I'm handling this
--
tromey at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |tromey at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-06-04 16:42:21 |2005-11-28 20:06:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
[not found] <bug-18278-9563@http.gcc.gnu.org/bugzilla/>
2005-11-28 20:06 ` [Bug java/18278] JNI functions cannot return a weak reference tromey at gcc dot gnu dot org
@ 2005-11-29 18:35 ` tromey at gcc dot gnu dot org
2005-11-29 18:58 ` tromey at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-11-29 18:35 UTC (permalink / raw)
To: java-prs
------- Comment #8 from tromey at gcc dot gnu dot org 2005-11-29 18:35 -------
Subject: Bug 18278
Author: tromey
Date: Tue Nov 29 18:34:58 2005
New Revision: 107676
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107676
Log:
gcc/java:
PR java/18278:
* expr.c (build_jni_stub): Unwrap the return value.
* java-tree.h (soft_unwrapjni_node): New define.
(enum java_tree_index): Added JTI_SOFT_UNWRAPJNI_NODE.
* decl.c (java_init_decl_processing): Initialize
soft_unwrapjni_node.
libjava:
PR java/18278:
* testsuite/libjava.jni/pr18278.out: New file.
* testsuite/libjava.jni/pr18278.c: New file.
* testsuite/libjava.jni/pr18278.java: New file.
* include/jvm.h (_Jv_UnwrapJNIweakReference): Declare.
* jni.cc (_Jv_UnwrapJNIweakReference): New function.
(call): Unwrap return value if needed.
Added:
trunk/libjava/testsuite/libjava.jni/pr18278.c
trunk/libjava/testsuite/libjava.jni/pr18278.java
trunk/libjava/testsuite/libjava.jni/pr18278.out
Modified:
trunk/gcc/java/ChangeLog
trunk/gcc/java/decl.c
trunk/gcc/java/expr.c
trunk/gcc/java/java-tree.h
trunk/libjava/ChangeLog
trunk/libjava/include/jvm.h
trunk/libjava/jni.cc
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
[not found] <bug-18278-9563@http.gcc.gnu.org/bugzilla/>
2005-11-28 20:06 ` [Bug java/18278] JNI functions cannot return a weak reference tromey at gcc dot gnu dot org
2005-11-29 18:35 ` tromey at gcc dot gnu dot org
@ 2005-11-29 18:58 ` tromey at gcc dot gnu dot org
2005-11-29 21:14 ` tromey at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-11-29 18:58 UTC (permalink / raw)
To: java-prs
------- Comment #9 from tromey at gcc dot gnu dot org 2005-11-29 18:58 -------
Subject: Bug 18278
Author: tromey
Date: Tue Nov 29 18:58:23 2005
New Revision: 107677
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107677
Log:
gcc/java:
PR java/18278:
* expr.c (build_jni_stub): Unwrap the return value.
* java-tree.h (soft_unwrapjni_node): New define.
(enum java_tree_index): Added JTI_SOFT_UNWRAPJNI_NODE.
* decl.c (java_init_decl_processing): Initialize
soft_unwrapjni_node.
libjava:
PR java/18278:
* testsuite/libjava.jni/pr18278.out: New file.
* testsuite/libjava.jni/pr18278.c: New file.
* testsuite/libjava.jni/pr18278.java: New file.
* include/jvm.h (_Jv_UnwrapJNIweakReference): Declare.
* jni.cc (_Jv_UnwrapJNIweakReference): New function.
(call): Unwrap return value if needed.
Added:
branches/gcc-4_1-branch/libjava/testsuite/libjava.jni/pr18278.c
branches/gcc-4_1-branch/libjava/testsuite/libjava.jni/pr18278.java
branches/gcc-4_1-branch/libjava/testsuite/libjava.jni/pr18278.out
Modified:
branches/gcc-4_1-branch/gcc/java/ChangeLog
branches/gcc-4_1-branch/gcc/java/decl.c
branches/gcc-4_1-branch/gcc/java/expr.c
branches/gcc-4_1-branch/gcc/java/java-tree.h
branches/gcc-4_1-branch/libjava/ChangeLog
branches/gcc-4_1-branch/libjava/include/jvm.h
branches/gcc-4_1-branch/libjava/jni.cc
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
[not found] <bug-18278-9563@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2005-11-29 18:58 ` tromey at gcc dot gnu dot org
@ 2005-11-29 21:14 ` tromey at gcc dot gnu dot org
2005-12-06 2:14 ` tromey at gcc dot gnu dot org
2005-12-06 2:39 ` tromey at gcc dot gnu dot org
5 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-11-29 21:14 UTC (permalink / raw)
To: java-prs
------- Comment #10 from tromey at gcc dot gnu dot org 2005-11-29 21:14 -------
Fix checked in.
--
tromey at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
[not found] <bug-18278-9563@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2005-11-29 21:14 ` tromey at gcc dot gnu dot org
@ 2005-12-06 2:14 ` tromey at gcc dot gnu dot org
2005-12-06 2:39 ` tromey at gcc dot gnu dot org
5 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-12-06 2:14 UTC (permalink / raw)
To: java-prs
------- Comment #11 from tromey at gcc dot gnu dot org 2005-12-06 02:13 -------
Subject: Bug 18278
Author: tromey
Date: Tue Dec 6 02:13:54 2005
New Revision: 108096
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108096
Log:
gcc/java
PR java/18278:
* expr.c (build_jni_stub): Unwrap the return value.
* java-tree.h (soft_unwrapjni_node): New define.
(enum java_tree_index): Added JTI_SOFT_UNWRAPJNI_NODE.
* decl.c (java_init_decl_processing): Initialize
soft_unwrapjni_node.
libjava:
PR java/18278:
* testsuite/libjava.jni/pr18278.out: New file.
* testsuite/libjava.jni/pr18278.c: New file.
* testsuite/libjava.jni/pr18278.java: New file.
* include/jvm.h (_Jv_UnwrapJNIweakReference): Declare.
* jni.cc (_Jv_UnwrapJNIweakReference): New function.
(call): Unwrap return value if needed.
Added:
branches/gcc-4_0-branch/libjava/testsuite/libjava.jni/pr18278.c
branches/gcc-4_0-branch/libjava/testsuite/libjava.jni/pr18278.java
branches/gcc-4_0-branch/libjava/testsuite/libjava.jni/pr18278.out
Modified:
branches/gcc-4_0-branch/gcc/java/ChangeLog
branches/gcc-4_0-branch/gcc/java/decl.c
branches/gcc-4_0-branch/gcc/java/expr.c
branches/gcc-4_0-branch/gcc/java/java-tree.h
branches/gcc-4_0-branch/libjava/ChangeLog
branches/gcc-4_0-branch/libjava/include/jvm.h
branches/gcc-4_0-branch/libjava/jni.cc
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
[not found] <bug-18278-9563@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2005-12-06 2:14 ` tromey at gcc dot gnu dot org
@ 2005-12-06 2:39 ` tromey at gcc dot gnu dot org
5 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-12-06 2:39 UTC (permalink / raw)
To: java-prs
--
tromey at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.1.0 |4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
2004-11-02 18:53 [Bug java/18278] New: " laurent at bearteam dot org
` (4 preceding siblings ...)
2004-12-01 21:41 ` tromey at gcc dot gnu dot org
@ 2004-12-02 13:37 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-02 13:37 UTC (permalink / raw)
To: java-prs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-02 13:36 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-12-02 13:36:47
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
2004-11-02 18:53 [Bug java/18278] New: " laurent at bearteam dot org
` (3 preceding siblings ...)
2004-11-02 20:38 ` laurent at bearteam dot org
@ 2004-12-01 21:41 ` tromey at gcc dot gnu dot org
2004-12-02 13:37 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2004-12-01 21:41 UTC (permalink / raw)
To: java-prs
------- Additional Comments From tromey at gcc dot gnu dot org 2004-12-01 21:40 -------
How curious. Apparently the JDK unwraps the return result of
a JNI method that returns a JNI weak reference.
I think it is too late to implement this for GCC 4.0 (unless the
commit rules change again). Here is how it could be fixed:
* Write a new _Jv_UnwrapJNIWeakReference function in jni.cc that is
extern "C". (This can be copied from the existing 'unwrap'
template function.)
* Make a built-in declaration for this in gcj
* Change expr.c:build_jni_stub to call this function when the return
type is not a primitive type. (there is already a comment explaining
where some unwrapping could be done)
* Also modify jni.cc:_Jv_JNIMethod::call() to do this transformation
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
2004-11-02 18:53 [Bug java/18278] New: " laurent at bearteam dot org
` (2 preceding siblings ...)
2004-11-02 20:34 ` laurent at bearteam dot org
@ 2004-11-02 20:38 ` laurent at bearteam dot org
2004-12-01 21:41 ` tromey at gcc dot gnu dot org
2004-12-02 13:37 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 12+ messages in thread
From: laurent at bearteam dot org @ 2004-11-02 20:38 UTC (permalink / raw)
To: java-prs
------- Additional Comments From laurent at bearteam dot org 2004-11-02 20:38 -------
Created an attachment (id=7461)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7461&action=view)
Sample java code
Here's how I compiled to whole thing:
cc -c weakref.c -o weakref.o
cc -shared -Xlinker --no-undefined weakref.o -o libweakref.so
gcj -o JNIWeakRef --main=JNIWeakRef -L . -l weakref -fjni JNIWeakRef.java
And then run with like this:
laurent@stan:~/tmp/gc$ LD_LIBRARY_PATH=. ./JNIWeakRef
Exception in thread "main" java.lang.ClassCastException:
gnu.gcj.runtime.JNIWeakRef cannot be cast to JNIWeakRef
at _Jv_CheckCast (/usr/lib/libgcj.so.6.0.0)
at JNIWeakRef.main(java.lang.String[]) (Unknown Source)
Sun's JVM (1.4.2) has no problem with it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
2004-11-02 18:53 [Bug java/18278] New: " laurent at bearteam dot org
2004-11-02 18:55 ` [Bug java/18278] " tromey at gcc dot gnu dot org
2004-11-02 20:09 ` laurent at bearteam dot org
@ 2004-11-02 20:34 ` laurent at bearteam dot org
2004-11-02 20:38 ` laurent at bearteam dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: laurent at bearteam dot org @ 2004-11-02 20:34 UTC (permalink / raw)
To: java-prs
------- Additional Comments From laurent at bearteam dot org 2004-11-02 20:34 -------
Created an attachment (id=7460)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7460&action=view)
Sample JNI c code
This is jni.i.gz, as produced by:
cc -c -save-temps weakref.c -o weakref.o
gzip weakref.i
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
2004-11-02 18:53 [Bug java/18278] New: " laurent at bearteam dot org
2004-11-02 18:55 ` [Bug java/18278] " tromey at gcc dot gnu dot org
@ 2004-11-02 20:09 ` laurent at bearteam dot org
2004-11-02 20:34 ` laurent at bearteam dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: laurent at bearteam dot org @ 2004-11-02 20:09 UTC (permalink / raw)
To: java-prs
------- Additional Comments From laurent at bearteam dot org 2004-11-02 20:09 -------
(In reply to comment #1)
> Do you have some sample code or something?
> I tend to suspect your code, simply for the reason
> that GObject is not part of libgcj.
I should have mentionned that GObject is the class I try to cast the returned
weak local reference created in the JNI code to. I'll attach a sample code very
soon.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug java/18278] JNI functions cannot return a weak reference
2004-11-02 18:53 [Bug java/18278] New: " laurent at bearteam dot org
@ 2004-11-02 18:55 ` tromey at gcc dot gnu dot org
2004-11-02 20:09 ` laurent at bearteam dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2004-11-02 18:55 UTC (permalink / raw)
To: java-prs
------- Additional Comments From tromey at gcc dot gnu dot org 2004-11-02 18:55 -------
Do you have some sample code or something?
I tend to suspect your code, simply for the reason
that GObject is not part of libgcj.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-12-06 2:39 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-18278-9563@http.gcc.gnu.org/bugzilla/>
2005-11-28 20:06 ` [Bug java/18278] JNI functions cannot return a weak reference tromey at gcc dot gnu dot org
2005-11-29 18:35 ` tromey at gcc dot gnu dot org
2005-11-29 18:58 ` tromey at gcc dot gnu dot org
2005-11-29 21:14 ` tromey at gcc dot gnu dot org
2005-12-06 2:14 ` tromey at gcc dot gnu dot org
2005-12-06 2:39 ` tromey at gcc dot gnu dot org
2004-11-02 18:53 [Bug java/18278] New: " laurent at bearteam dot org
2004-11-02 18:55 ` [Bug java/18278] " tromey at gcc dot gnu dot org
2004-11-02 20:09 ` laurent at bearteam dot org
2004-11-02 20:34 ` laurent at bearteam dot org
2004-11-02 20:38 ` laurent at bearteam dot org
2004-12-01 21:41 ` tromey at gcc dot gnu dot org
2004-12-02 13:37 ` pinskia 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).