aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/java/ChangeLog11
-rw-r--r--gcc/java/class.c4
-rw-r--r--gcc/java/decl.c57
-rw-r--r--gcc/java/java-tree.h3
4 files changed, 70 insertions, 5 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index cf7810c..116df16 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,14 @@
+2005-01-24 Tom Tromey <tromey@redhat.com>
+
+ * java-tree.h (gcj_abi_version): Declare.
+ * class.c (make_class_data): Push gcj_abi_version into "next"
+ field. Renamed field.
+ * decl.c (gcj_abi_version): New global.
+ (parse_version): New function.
+ (java_init_decl_processing): Call it. Renamed 'next' field.
+ Include version.h.
+ (GCJ_BINARYCOMPAT_ADDITION): New define.
+
2005-01-24 Roger Sayle <roger@eyesopen.com>
PR java/19295
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 9413820..53a31e9 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1,5 +1,5 @@
/* Functions related to building classes and their related objects.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GCC.
@@ -1741,7 +1741,7 @@ make_class_data (tree type)
FINISH_RECORD_CONSTRUCTOR (temp);
START_RECORD_CONSTRUCTOR (cons, class_type_node);
PUSH_SUPER_VALUE (cons, temp);
- PUSH_FIELD_VALUE (cons, "next", null_pointer_node);
+ PUSH_FIELD_VALUE (cons, "next_or_version", gcj_abi_version);
PUSH_FIELD_VALUE (cons, "name", build_utf8_ref (DECL_NAME (type_decl)));
PUSH_FIELD_VALUE (cons, "accflags",
build_int_cst (NULL_TREE,
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 5ec5d78..1343ebf 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -1,6 +1,6 @@
/* Process declarations and variables for the GNU compiler for the
Java(TM) language.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GCC.
@@ -47,6 +47,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "cgraph.h"
#include "tree-inline.h"
#include "target.h"
+#include "version.h"
#if defined (DEBUG_JAVA_BINDING_LEVELS)
extern void indent (void);
@@ -58,6 +59,13 @@ static tree push_promoted_type (const char *, tree);
static struct binding_level *make_binding_level (void);
static tree create_primitive_vtable (const char *);
static tree check_local_unnamed_variable (tree, tree, tree);
+static void parse_version (void);
+
+/* Used when computing the ABI version. */
+#define GCJ_BINARYCOMPAT_ADDITION 5
+
+/* The ABI version number. */
+tree gcj_abi_version;
/* Name of the Cloneable class. */
tree java_lang_cloneable_identifier_node;
@@ -559,6 +567,49 @@ do_nothing (tree t)
return t;
}
+/* Parse the version string and compute the ABI version number. */
+static void
+parse_version (void)
+{
+ const char *p = version_string;
+ unsigned int major = 0, minor = 0;
+ unsigned int abi_version;
+
+ /* Skip leading junk. */
+ while (*p && !ISDIGIT (*p))
+ ++p;
+ gcc_assert (*p);
+
+ /* Extract major version. */
+ while (ISDIGIT (*p))
+ {
+ major = major * 10 + *p - '0';
+ ++p;
+ }
+
+ gcc_assert (*p == '.' && ISDIGIT (p[1]));
+ ++p;
+
+ /* Extract minor version. */
+ while (ISDIGIT (*p))
+ {
+ minor = minor * 10 + *p - '0';
+ ++p;
+ }
+
+ /* Implicit in this computation is the idea that we won't break the
+ old-style binary ABI in a sub-minor release (e.g., from 4.0.0 to
+ 4.0.1). */
+ abi_version = 10000 * major + 10 * minor;
+ /* It is helpful to distinguish BC ABI from ordinary ABI at this
+ level, since at some point we will recognize a variety of BC ABIs
+ (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;
+
+ gcj_abi_version = build_int_cstu (ptr_type_node, abi_version);
+}
void
java_init_decl_processing (void)
@@ -835,7 +886,7 @@ java_init_decl_processing (void)
set_super_info (0, string_type_node, object_type_node, 0);
class_ptr_type = build_pointer_type (class_type_node);
- PUSH_FIELD (class_type_node, field, "next", class_ptr_type);
+ PUSH_FIELD (class_type_node, field, "next_or_version", class_ptr_type);
PUSH_FIELD (class_type_node, field, "name", utf8const_ptr_type);
PUSH_FIELD (class_type_node, field, "accflags", access_flags_type_node);
PUSH_FIELD (class_type_node, field, "superclass", class_ptr_type);
@@ -1100,6 +1151,8 @@ java_init_decl_processing (void)
#if 0
soft_fmodf_node = built_in_decls[BUILT_IN_FMODF];
#endif
+
+ parse_version ();
}
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index e10abac..bd76446 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -1,6 +1,6 @@
/* Definitions for parsing and type checking for the GNU compiler for
the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GCC.
@@ -274,6 +274,7 @@ typedef struct CPool constant_pool;
extern GTY(()) tree java_lang_cloneable_identifier_node;
extern GTY(()) tree java_io_serializable_identifier_node;
+extern GTY(()) tree gcj_abi_version;
enum java_tree_index
{