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]

Patch: RFC: gcj versioning on head


Andrew pointed out that the existing gcj ABI versioning code broke as
soon as the trunk was renamed 4.1.  I had done this "kind of on
purpose", knowing that we would be breaking ABI compatibility on head
at least once.

However, it is more convenient to manage this manually... since we
haven't actually broken compatibility yet, it is nice to be able to
switch back and forth between 4.0 and 4.1 without recompiling objects.

This patch changes our approach to be more manual.  The C++ ABI still
uses an exact match against the gcc version (since ABI breakage here
is much more common), while the BC ABI uses an explicit number that we
will increment whenever we change it.

On the runtime side we do something similar.  However, I expect we may
manage the runtime somewhat differently; for instance we may choose to
accept several different versions of the BC ABI.

I thought I'd post this for commentary before checking it in.
I'll put it in sometime next week unless there are
objections/suggestions/etc.

Tom


Index: gcc/java/ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* decl.c (GCJ_CURRENT_BC_ABI_VERSION): New define.
	(parse_version): Use it.

Index: libjava/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* include/jvm.h (GCJ_40_BC_ABI_VERSION): New define.
	(_Jv_CheckABIVersion): Use it.


Index: gcc/java/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.212
diff -u -r1.212 decl.c
--- gcc/java/decl.c 9 Mar 2005 19:04:54 -0000 1.212
+++ gcc/java/decl.c 17 Mar 2005 16:04:44 -0000
@@ -64,6 +64,13 @@
 /* Used when computing the ABI version.  */
 #define GCJ_BINARYCOMPAT_ADDITION 5
 
+/* The version of the BC ABI that we generate.  At the moment we are
+   compatible with what shipped in GCC 4.0.  This must be kept in sync
+   with parse_version(), libgcj, and reality (if the BC format
+   changes, this must change.  */
+#define GCJ_CURRENT_BC_ABI_VERSION \
+  (4 * 10000 + 0 * 10 + GCJ_BINARYCOMPAT_ADDITION)
+
 /* The ABI version number.  */
 tree gcj_abi_version;
 
@@ -606,7 +613,7 @@
      (objects generated by different version of gcj), but will
      probably always require strict matching for ordinary ABI.  */
   if (flag_indirect_dispatch)
-    abi_version += GCJ_BINARYCOMPAT_ADDITION;
+    abi_version = GCJ_CURRENT_BC_ABI_VERSION;
 
   gcj_abi_version = build_int_cstu (ptr_type_node, abi_version);
 }
Index: libjava/include/jvm.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/jvm.h,v
retrieving revision 1.80
diff -u -r1.80 jvm.h
--- libjava/include/jvm.h 17 Mar 2005 00:18:48 -0000 1.80
+++ libjava/include/jvm.h 17 Mar 2005 16:04:54 -0000
@@ -562,14 +562,17 @@
 #define GCJ_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 10)
 #define GCJ_BINARYCOMPAT_ADDITION 5
 
+// At present we know we are compatible with the BC ABI as used in GCC
+// 4.0.
+#define GCJ_40_BC_ABI_VERSION (4 * 10000 + 0 * 10 + GCJ_BINARYCOMPAT_ADDITION)
+
 inline bool
 _Jv_CheckABIVersion (unsigned long value)
 {
-  // For this release, recognize just our defined C++ ABI and our
-  // defined BC ABI.  (In the future we may recognize past BC ABIs as
-  // well.)
+  // Recognize our defined C++ ABI.
   return (value == GCJ_VERSION
-	  || value == (GCJ_VERSION + GCJ_BINARYCOMPAT_ADDITION));
+	  // At the moment this is the only BC ABI we recognize.
+	  || value == GCJ_40_BC_ABI_VERSION);
 }
 
 // It makes the source cleaner if we simply always define this


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