This is the mail archive of the java-patches@gcc.gnu.org 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]
Other format: [Raw text]

[3.3] Patch ping: JNI ABI and Windows


Ranjit submitted this patch a while back but it hasn't yet been
approved.

JNI is a Java-specific API and ABI.  On Windows, JNI methods have to
use the stdcall convention.  In gcj we sometimes generate stubs that
call these methods directly.  In order for gcj to know that a given
call must be stdcall, we need a new target macro.

There is a corresponding patch to gcj that will go in separately.

As it stands, JNI methods on Windows simply don't work.  Ranjit has
tested this patch (plus the gcj patch, of course) on Windows and
verified that with it, JNI methods once again work.

Ok for 3.3 and the trunk?

Tom

2003-02-11  Ranjit Mathew  <rmathew@hotmail.com>

	* doc/tm.texi (MODIFY_JNI_METHOD_CALL): Document.
	* config/i386/cygwin.h (MODIFY_JNI_METHOD_CALL): New macro.

Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.182.2.3
diff -u -r1.182.2.3 tm.texi
--- doc/tm.texi 31 Jan 2003 23:51:24 -0000 1.182.2.3
+++ doc/tm.texi 12 Feb 2003 01:41:08 -0000
@@ -1,4 +1,4 @@
-@c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002
+@c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003
 @c Free Software Foundation, Inc.
 @c This is part of the GCC manual.
 @c For copying conditions, see the file gcc.texi.
@@ -9130,6 +9130,22 @@
 Define this macro for systems like AIX, where the linker discards
 object files that are not referenced from @code{main} and uses export
 lists.
+
+@findex MODIFY_JNI_METHOD_CALL
+@item MODIFY_JNI_METHOD_CALL (@var{mdecl})
+Define this macro to a C expression representing a variant of the
+method call @var{mdecl}, if Java Native Interface (JNI) methods
+must be invoked differently from other methods on your target.
+For example, on 32-bit Windows, JNI methods must be invoked using
+the @code{stdcall} calling convention and this macro is then
+defined as this expression:
+
+@smallexample
+build_type_attribute_variant (@var{mdecl},
+                              build_tree_list
+                              (get_identifier ("stdcall"),
+                               NULL))
+@end smallexample
 
 @end table
 
Index: config/i386/cygwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/cygwin.h,v
retrieving revision 1.75
diff -u -r1.75 cygwin.h
--- config/i386/cygwin.h 5 Dec 2002 23:55:15 -0000 1.75
+++ config/i386/cygwin.h 12 Feb 2003 01:41:09 -0000
@@ -1,6 +1,6 @@
 /* Operating system specific defines to be used when targeting GCC for
    hosting on Windows32, using a Unix style C library and tools.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
 This file is part of GNU CC.
@@ -396,6 +396,15 @@
 		     gen_rtx_SYMBOL_REF (Pmode, "_monstartup")),	\
 	const0_rtx));							\
     }
+
+/* Java Native Interface (JNI) methods on Win32 are invoked using the
+   stdcall calling convention.  */
+#undef MODIFY_JNI_METHOD_CALL
+#define MODIFY_JNI_METHOD_CALL(MDECL)					      \
+  build_type_attribute_variant ((MDECL),				      \
+			       build_tree_list (get_identifier ("stdcall"),   \
+						NULL))
+
 
 /* External function declarations.  */
 


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