1 diff -ru gcc/java/class.c gcc/java/class.c
2 --- gcc/java/class.c Fri Feb 28 12:53:07 2003
3 +++ gcc/java/class.c Wed Feb 25 23:19:58 2004
4 @@ -1254,25 +1254,32 @@
5 if (DECL_RTL_SET_P (mdecl))
6 code = build1 (ADDR_EXPR, nativecode_ptr_type_node, mdecl);
7 START_RECORD_CONSTRUCTOR (minit, method_type_node);
8 - PUSH_FIELD_VALUE (minit, "name",
9 - build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ?
10 - init_identifier_node
11 - : DECL_NAME (mdecl)));
14 + // FIXME: should walk up the tree looking to see if this method
15 + // overrides one declared in an interface
16 + if (!flag_inhibit_reflection || !METHOD_STATIC(mdecl) || DECL_CLINIT_P(mdecl) ||
17 + (METHOD_STATIC(mdecl) && (strcmp(IDENTIFIER_POINTER(DECL_NAME(mdecl)),"main") == 0))) {
18 + PUSH_FIELD_VALUE (minit, "name",
19 + build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ?
20 + init_identifier_node
21 + : DECL_NAME (mdecl)));
22 tree signature = build_java_signature (TREE_TYPE (mdecl));
23 PUSH_FIELD_VALUE (minit, "signature",
26 - (IDENTIFIER_POINTER(signature),
27 - IDENTIFIER_LENGTH(signature)))));
30 + (IDENTIFIER_POINTER(signature),
31 + IDENTIFIER_LENGTH(signature)))));
33 + PUSH_FIELD_VALUE (minit, "name", null_pointer_node);
34 + PUSH_FIELD_VALUE (minit, "signature", null_pointer_node);
36 PUSH_FIELD_VALUE (minit, "accflags", build_int_2 (accflags, 0));
37 PUSH_FIELD_VALUE (minit, "index", index);
38 PUSH_FIELD_VALUE (minit, "ncode", code);
41 /* Compute the `throws' information for the method. */
42 tree table = null_pointer_node;
43 + if (!flag_inhibit_reflection)
44 if (DECL_FUNCTION_THROWS (mdecl) != NULL_TREE)
46 int length = 1 + list_length (DECL_FUNCTION_THROWS (mdecl));
48 field = TYPE_FIELDS (type);
49 if (DECL_NAME (field) == NULL_TREE)
50 field = TREE_CHAIN (field); /* Skip dummy field for inherited data. */
52 for ( ; field != NULL_TREE; field = TREE_CHAIN (field))
54 if (! DECL_ARTIFICIAL (field))
55 @@ -1462,8 +1470,11 @@
56 if (FIELD_STATIC (field))
58 tree initial = DECL_INITIAL (field);
59 + if (!flag_inhibit_reflection)
62 static_fields = tree_cons (NULL_TREE, init, static_fields);
64 /* If the initial value is a string constant,
65 prevent output_constant from trying to assemble the value. */
66 if (initial != NULL_TREE
68 DECL_INITIAL (field) = initial;
71 + if (!flag_inhibit_reflection)
73 instance_field_count++;
74 instance_fields = tree_cons (NULL_TREE, init, instance_fields);
75 diff -ru gcc/java/java-tree.h gcc/java/java-tree.h
76 --- gcc/java/java-tree.h Mon Nov 18 10:13:35 2002
77 +++ gcc/java/java-tree.h Wed Feb 25 19:49:44 2004
79 /* Encoding used for source files. */
80 extern const char *current_encoding;
82 +/** don't emit reflection information */
83 +extern int flag_inhibit_reflection;
85 /* The Java .class file that provides main_class; the main input file. */
86 extern struct JCF *current_jcf;
88 diff -ru gcc/java/lang.c gcc/java/lang.c
89 --- gcc/java/lang.c Sun Jan 5 07:03:25 2003
90 +++ gcc/java/lang.c Wed Feb 25 19:49:49 2004
92 /* The encoding of the source file. */
93 const char *current_encoding = NULL;
95 +/** don't emit reflection information */
96 +int flag_inhibit_reflection = 0;
98 /* When nonzero, report the now deprecated empty statements. */
99 int flag_extraneous_semicolon;
103 flag_inline_functions = 1;
104 flag_really_inline = 1;
108 +#define ARG "-finhibit-reflection"
109 + if (strncmp (p, ARG, sizeof (ARG) - 1) == 0)
111 + flag_inhibit_reflection = 1;
115 diff -ru libjava/boehm.cc libjava/boehm.cc
116 --- libjava/boehm.cc Thu Jan 2 21:19:53 2003
117 +++ libjava/boehm.cc Wed Feb 25 23:43:44 2004
120 #include <java/lang/Class.h>
121 #include <java/lang/reflect/Modifier.h>
122 +#include <java/lang/VirtualMachineError.h>
123 #include <java-interp.h>
125 // More nastiness: the GC wants to define TRUE and FALSE. We don't
127 for (int i = 0; i < c->method_count; ++i)
129 p = (ptr_t) c->methods[i].name;
130 + if (p == NULL) continue;
131 MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c,
133 p = (ptr_t) c->methods[i].signature;
136 #ifndef COMPACT_FIELDS
137 p = (ptr_t) field->name;
138 + if (p == NULL) continue;
139 MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8alabel);
141 p = (ptr_t) field->type;
142 + if (p == NULL) continue;
143 MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8blabel);
145 // For the interpreter, we also need to mark the memory
147 // Note: occasionally `klass' can be null. For instance, this
148 // can happen if a GC occurs between the point where an object
149 // is allocated and where the vtbl slot is set.
150 + throw new java::lang::VirtualMachineError();
151 while (klass && klass != &java::lang::Object::class$)
153 jfieldID field = JvGetFirstInstanceField (klass);
154 diff -ru libjava/gnu/gcj/convert/BytesToUnicode.java libjava/gnu/gcj/convert/BytesToUnicode.java
155 --- libjava/gnu/gcj/convert/BytesToUnicode.java Mon Jul 30 13:24:17 2001
156 +++ libjava/gnu/gcj/convert/BytesToUnicode.java Wed Feb 25 22:53:54 2004
161 - return new Input_8859_1();
162 + throw new UnsatisfiedLinkError();
166 diff -ru libjava/gnu/gcj/convert/UnicodeToBytes.java libjava/gnu/gcj/convert/UnicodeToBytes.java
167 --- libjava/gnu/gcj/convert/UnicodeToBytes.java Fri Aug 17 20:56:01 2001
168 +++ libjava/gnu/gcj/convert/UnicodeToBytes.java Wed Feb 25 22:53:48 2004
173 - return new Output_8859_1();
174 + throw new UnsatisfiedLinkError();
175 + //return new Output_8859_1();
179 diff -ru libjava/java/lang/Class.h libjava/java/lang/Class.h
180 --- libjava/java/lang/Class.h Sun Jan 19 22:49:28 2003
181 +++ libjava/java/lang/Class.h Wed Feb 25 21:34:30 2004
183 // NULL-terminated list of exception class names; can be NULL if
184 // there are none such.
185 _Jv_Utf8Const **throws;
187 _Jv_Method *getNextMethod ()
190 diff -ru libjava/java/lang/natClass.cc libjava/java/lang/natClass.cc
191 --- libjava/java/lang/natClass.cc Thu May 1 14:52:35 2003
192 +++ libjava/java/lang/natClass.cc Wed Feb 25 22:59:34 2004
193 @@ -808,10 +808,12 @@
194 // Steps 8, 9, 10, 11.
198 _Jv_Method *meth = _Jv_GetMethodLocal (this, clinit_name,
201 ((void (*) (void)) meth->ncode) ();
204 catch (java::lang::Throwable *except)
206 @@ -1326,13 +1328,13 @@
212 if (meth && (meth->name->data[0] == '<'))
214 // leave a placeholder in the itable for hidden init methods.
220 if (Modifier::isStatic(meth->accflags))
221 throw new java::lang::IncompatibleClassChangeError
222 diff -ru libjava/libgcj.spec.in libjava/libgcj.spec.in
223 --- libjava/libgcj.spec.in Wed Feb 12 18:09:27 2003
224 +++ libjava/libgcj.spec.in Wed Feb 25 19:51:22 2004
226 # to link with libgcj.
229 -*lib: -lgcj -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig)
230 +*lib: -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig)
232 *jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ -fkeep-inline-functions
233 diff -ru libjava/prims.cc libjava/prims.cc
234 --- libjava/prims.cc Fri Apr 25 09:02:21 2003
235 +++ libjava/prims.cc Wed Feb 25 23:16:52 2004
239 _Jv_ushort *aptr, *bptr;
240 + if (a == NULL || b == NULL) return false;
243 if (a->hash != b->hash)
246 _Jv_equal (Utf8Const* a, jstring str, jint hash)
248 + if (a == NULL) return false;
249 if (a->hash != (_Jv_ushort) hash)
251 jint len = str->length();
254 _Jv_equaln (Utf8Const *a, jstring str, jint n)
256 + if (a == NULL) return false;
257 jint len = str->length();
259 jchar *sptr = _Jv_GetStringChars (str);