aboutsummaryrefslogtreecommitdiff
path: root/libjava/include/jvm.h
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/include/jvm.h')
-rw-r--r--libjava/include/jvm.h47
1 files changed, 33 insertions, 14 deletions
diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h
index bceb291fb58..3a2eb9b923e 100644
--- a/libjava/include/jvm.h
+++ b/libjava/include/jvm.h
@@ -564,31 +564,50 @@ extern void (*_Jv_JVMPI_Notify_THREAD_END) (JVMPI_Event *event);
extern void _Jv_RegisterBootstrapPackages ();
+#define FLAG_BINARYCOMPAT_ABI (1<<31) /* Class is built with the BC-ABI. */
-// This is used to find ABI versions we recognize.
-#define GCJ_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 10)
-#define GCJ_BINARYCOMPAT_ADDITION 5
-#define GCJ_BOOTSTRAP_LOADER_ADDITION 1
+#define FLAG_BOOTSTRAP_LOADER (1<<30) /* Used when defining a class that
+ should be loaded by the bootstrap
+ loader. */
-// 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)
+// These are used to find ABI versions we recognize.
+#define GCJ_CXX_ABI_VERSION (__GNUC__ * 100000 + __GNUC_MINOR__ * 1000)
+
+// This is the old-style BC version ID used by GCJ 4.0.0.
+#define OLD_GCJ_40_BC_ABI_VERSION (4 * 10000 + 0 * 10 + 5)
+
+// New style version IDs used by GCJ 4.0.1 and later.
+#define GCJ_40_BC_ABI_VERSION (4 * 100000 + 0 * 1000)
inline bool
_Jv_CheckABIVersion (unsigned long value)
{
- // Recognize our defined C++ ABIs.
- return (value == GCJ_VERSION
- || value == (GCJ_VERSION + GCJ_BOOTSTRAP_LOADER_ADDITION)
- || value == GCJ_40_BC_ABI_VERSION
- || value == (GCJ_40_BC_ABI_VERSION + GCJ_BOOTSTRAP_LOADER_ADDITION));
+ // We are compatible with GCJ 4.0.0 BC-ABI classes. This release used a
+ // different format for the version ID string.
+ if (value == OLD_GCJ_40_BC_ABI_VERSION)
+ return true;
+
+ // The 20 low-end bits are used for the version number.
+ unsigned long version = value & 0xfffff;
+
+ if (value & FLAG_BINARYCOMPAT_ABI)
+ {
+ int abi_rev = version % 100;
+ int abi_ver = version - abi_rev;
+ if (abi_ver == GCJ_40_BC_ABI_VERSION && abi_rev <= 0)
+ return true;
+ }
+ else
+ // C++ ABI
+ return version == GCJ_CXX_ABI_VERSION;
+
+ return false;
}
inline bool
_Jv_ClassForBootstrapLoader (unsigned long value)
{
- return (value == (GCJ_VERSION + GCJ_BOOTSTRAP_LOADER_ADDITION)
- || value == (GCJ_40_BC_ABI_VERSION + GCJ_BOOTSTRAP_LOADER_ADDITION));
+ return (value & FLAG_BOOTSTRAP_LOADER);
}
// It makes the source cleaner if we simply always define this