* Re: [ecj] enum types
@ 2006-11-02 15:15 Andrew Haley
2006-11-28 23:07 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Haley @ 2006-11-02 15:15 UTC (permalink / raw)
To: gcc-patches, java-patches
We seem to have forgotten to handle enum types in gcj; fixed thusly.
Also, I took the oportunity to move the reflection data into R/O
memory.
Andrew.
2006-11-02 Andrew Haley <aph@redhat.com>
* java-tree.h (FIELD_ENUM): New.
(lang_decl_var.field_enum): New.
(lang_type.enum_class): New.
(CLASS_ENUM): New.
* class.c (set_class_decl_access_flags): Handle enum types.
(add_field): Handle enum fields.
(get_access_flags_from_decl): Likewise.
* class.c (make_class_data): Put reflection_data into rodata.
/* Return length of inheritance chain of CLAS, where java.lang.Object is 0,
@@ -781,6 +782,7 @@
TREE_CHAIN (field) = TYPE_FIELDS (class);
TYPE_FIELDS (class) = field;
DECL_CONTEXT (field) = class;
+ MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field);
if (flags & ACC_PUBLIC) FIELD_PUBLIC (field) = 1;
if (flags & ACC_PROTECTED) FIELD_PROTECTED (field) = 1;
@@ -788,6 +790,7 @@
if (flags & ACC_FINAL) FIELD_FINAL (field) = 1;
if (flags & ACC_VOLATILE) FIELD_VOLATILE (field) = 1;
if (flags & ACC_TRANSIENT) FIELD_TRANSIENT (field) = 1;
+ if (flags & ACC_ENUM) FIELD_ENUM (field) = 1;
if (is_static)
{
FIELD_STATIC (field) = 1;
@@ -1215,6 +1218,8 @@
access_flags |= ACC_VOLATILE;
if (FIELD_TRANSIENT (decl))
access_flags |= ACC_TRANSIENT;
+ if (FIELD_ENUM (decl))
+ access_flags |= ACC_ENUM;
return access_flags;
}
if (TREE_CODE (decl) == TYPE_DECL)
@@ -1237,6 +1242,8 @@
access_flags |= ACC_PROTECTED;
if (CLASS_STRICTFP (decl))
access_flags |= ACC_STRICT;
+ if (CLASS_ENUM (decl))
+ access_flags |= ACC_ENUM;
return access_flags;
}
if (TREE_CODE (decl) == FUNCTION_DECL)
@@ -2088,7 +2095,7 @@
DECL_ARTIFICIAL (array) = 1;
DECL_IGNORED_P (array) = 1;
TREE_READONLY (array) = 1;
- TREE_CONSTANT (array) = 1;
+ TREE_CONSTANT (DECL_INITIAL (array)) = 1;
rest_of_decl_compilation (array, 1, 0);
PUSH_FIELD_VALUE (cons, "reflection_data", build_address_of (array));
Index: java/constants.c
===================================================================
--- java/constants.c (revision 118395)
+++ java/constants.c (working copy)
@@ -571,6 +571,7 @@
TREE_STATIC (tags_decl) = 1;
DECL_INITIAL (tags_decl) = build_constructor_from_list
(tags_type, tags_list);
+ TREE_CONSTANT (DECL_INITIAL (tags_decl)) = 1;
rest_of_decl_compilation (tags_decl, 1, 0);
tags_value = build_address_of (tags_decl);
}
Index: java/java-tree.h
===================================================================
--- java/java-tree.h (revision 118395)
+++ java/java-tree.h (working copy)
@@ -901,6 +901,7 @@
/* True if NODE is a final field. */
#define FINAL_VARIABLE_P(NODE) (FIELD_FINAL (NODE) && !FIELD_STATIC (NODE))
/* True if NODE is a class final field. */
+#define FIELD_ENUM(DECL) (DECL_LANG_SPECIFIC (DECL)->u.v.field_enum)
#define CLASS_FINAL_VARIABLE_P(NODE) \
(FIELD_FINAL (NODE) && FIELD_STATIC (NODE))
/* True if NODE is a class initialization flag. This macro accesses
@@ -1052,6 +1053,7 @@
unsigned int local_slot : 1; /* Decl is a temporary in the stack frame. */
unsigned int class_field : 1; /* Decl needs mangle_class_field. */
unsigned int vtable : 1; /* Decl needs mangle_vtable. */
+ unsigned int field_enum:1; /* Field is an enum. */
};
/* This is what 'lang_decl' really points to. */
@@ -1095,6 +1097,7 @@
#define TYPE_PRIVATE_INNER_CLASS(T) (TYPE_LANG_SPECIFIC (T)->pic)
#define TYPE_PROTECTED_INNER_CLASS(T) (TYPE_LANG_SPECIFIC (T)->poic)
#define TYPE_STRICTFP(T) (TYPE_LANG_SPECIFIC (T)->strictfp)
+#define TYPE_ENUM(T) (TYPE_LANG_SPECIFIC (T)->enum_class)
#define TYPE_USES_ASSERTIONS(T) (TYPE_LANG_SPECIFIC (T)->assertions)
#define TYPE_ATABLE_METHODS(T) (TYPE_LANG_SPECIFIC (T)->atable_methods)
@@ -1182,6 +1185,7 @@
unsigned strictfp:1; /* `strictfp' class. */
unsigned assertions:1; /* Any method uses `assert'. */
unsigned dummy_class:1; /* Not a real class, just a placeholder. */
+ unsigned enum_class:1; /* Class is an enum type. */
};
#define JCF_u4 unsigned long
@@ -1503,6 +1507,7 @@
#define CLASS_PRIVATE(DECL) (TYPE_PRIVATE_INNER_CLASS (TREE_TYPE (DECL)))
#define CLASS_PROTECTED(DECL) (TYPE_PROTECTED_INNER_CLASS (TREE_TYPE (DECL)))
#define CLASS_STRICTFP(DECL) (TYPE_STRICTFP (TREE_TYPE (DECL)))
+#define CLASS_ENUM(DECL) (TYPE_ENUM (TREE_TYPE (DECL)))
#define CLASS_USES_ASSERTIONS(DECL) (TYPE_USES_ASSERTIONS (TREE_TYPE (DECL)))
/* @deprecated marker flag on methods, fields and classes */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ecj] enum types
2006-11-02 15:15 [ecj] enum types Andrew Haley
@ 2006-11-28 23:07 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2006-11-28 23:07 UTC (permalink / raw)
To: Andrew Haley; +Cc: gcc-patches, java-patches
>>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:
Andrew> We seem to have forgotten to handle enum types in gcj; fixed thusly.
FWIW this is part of PR 29495. I think there are still a few access
flags that aren't passed through though.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-28 23:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-02 15:15 [ecj] enum types Andrew Haley
2006-11-28 23:07 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).