From 558ba6feeeb75bafdbcadd05a8e708b567b3bfc0 Mon Sep 17 00:00:00 2001
From: Maximilian Downey Twiss <creatorsmithmdt@gmail.com>
Date: Thu, 17 Nov 2022 14:08:04 +1100
Subject: [PATCH 08/56] Re-add MODIFY_JNI_METHOD_CALL.

gcc/ChangeLog:

	* config/i386/cygming.h (MODIFY_JNI_METHOD_CALL): Define.
	* doc/tm.texi: Rebuild.
	* doc/tm.texi.in (Misc): Document MODIFY_JNI_METHOD_CALL.
---
 gcc/config/i386/cygming.h |  8 ++++++++
 gcc/doc/tm.texi           | 16 ++++++++++++++++
 gcc/doc/tm.texi.in        | 16 ++++++++++++++++
 3 files changed, 40 insertions(+)

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 4007fd96eac..867ac5bf181 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -376,6 +376,14 @@ do {						\
 	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))
+
 /* For Win32 ABI compatibility */
 #undef DEFAULT_PCC_STRUCT_RETURN
 #define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index af77d16030c..c370c34b584 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -11954,6 +11954,22 @@ object files that are not referenced from @code{main} and uses export
 lists.
 @end defmac
 
+@defmac 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 Microsoft 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 defmac
+
 @deftypefn {Target Hook} bool TARGET_CANNOT_MODIFY_JUMPS_P (void)
 This target hook returns @code{true} past the point in which new jump
 instructions could be created.  On machines that require a register for
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 62c49ac46de..1ec14c27b40 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7777,6 +7777,22 @@ object files that are not referenced from @code{main} and uses export
 lists.
 @end defmac
 
+@defmac 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 Microsoft 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 defmac
+
 @hook TARGET_CANNOT_MODIFY_JUMPS_P
 
 @hook TARGET_HAVE_CONDITIONAL_EXECUTION
-- 
2.38.1

Reply via email to