X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=blobdiff_plain;f=upstream%2Fgcc-3.3%2Fpatches%2Fzzz-disable-reflection.patch;fp=upstream%2Fgcc-3.3%2Fpatches%2Fzzz-disable-reflection.patch;h=4c1fd6714c180cc27343c516bb57b32f88c883e9;hp=0000000000000000000000000000000000000000;hb=a6c4f7b784acf2269c33188982b0d479cc11a0f4;hpb=15801ed8984e7463b3fbe517e13d86cd08db9b15 diff --git a/upstream/gcc-3.3/patches/zzz-disable-reflection.patch b/upstream/gcc-3.3/patches/zzz-disable-reflection.patch new file mode 100644 index 0000000..4c1fd67 --- /dev/null +++ b/upstream/gcc-3.3/patches/zzz-disable-reflection.patch @@ -0,0 +1,259 @@ +diff -ru gcc/java/class.c gcc/java/class.c +--- gcc/java/class.c Fri Feb 28 12:53:07 2003 ++++ gcc/java/class.c Wed Feb 25 23:19:58 2004 +@@ -1254,25 +1254,32 @@ + if (DECL_RTL_SET_P (mdecl)) + code = build1 (ADDR_EXPR, nativecode_ptr_type_node, mdecl); + START_RECORD_CONSTRUCTOR (minit, method_type_node); +- PUSH_FIELD_VALUE (minit, "name", +- build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ? +- init_identifier_node +- : DECL_NAME (mdecl))); +- { ++ ++ // FIXME: should walk up the tree looking to see if this method ++ // overrides one declared in an interface ++ if (!flag_inhibit_reflection || !METHOD_STATIC(mdecl) || DECL_CLINIT_P(mdecl) || ++ (METHOD_STATIC(mdecl) && (strcmp(IDENTIFIER_POINTER(DECL_NAME(mdecl)),"main") == 0))) { ++ PUSH_FIELD_VALUE (minit, "name", ++ build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ? ++ init_identifier_node ++ : DECL_NAME (mdecl))); + tree signature = build_java_signature (TREE_TYPE (mdecl)); + PUSH_FIELD_VALUE (minit, "signature", +- (build_utf8_ref +- (unmangle_classname +- (IDENTIFIER_POINTER(signature), +- IDENTIFIER_LENGTH(signature))))); ++ (build_utf8_ref ++ (unmangle_classname ++ (IDENTIFIER_POINTER(signature), ++ IDENTIFIER_LENGTH(signature))))); ++ } else { ++ PUSH_FIELD_VALUE (minit, "name", null_pointer_node); ++ PUSH_FIELD_VALUE (minit, "signature", null_pointer_node); + } + PUSH_FIELD_VALUE (minit, "accflags", build_int_2 (accflags, 0)); + PUSH_FIELD_VALUE (minit, "index", index); + PUSH_FIELD_VALUE (minit, "ncode", code); +- + { + /* Compute the `throws' information for the method. */ + tree table = null_pointer_node; ++ if (!flag_inhibit_reflection) + if (DECL_FUNCTION_THROWS (mdecl) != NULL_TREE) + { + int length = 1 + list_length (DECL_FUNCTION_THROWS (mdecl)); +@@ -1454,6 +1461,7 @@ + field = TYPE_FIELDS (type); + if (DECL_NAME (field) == NULL_TREE) + field = TREE_CHAIN (field); /* Skip dummy field for inherited data. */ ++ + for ( ; field != NULL_TREE; field = TREE_CHAIN (field)) + { + if (! DECL_ARTIFICIAL (field)) +@@ -1462,8 +1470,11 @@ + if (FIELD_STATIC (field)) + { + tree initial = DECL_INITIAL (field); ++ if (!flag_inhibit_reflection) ++ { + static_field_count++; + static_fields = tree_cons (NULL_TREE, init, static_fields); ++ } + /* If the initial value is a string constant, + prevent output_constant from trying to assemble the value. */ + if (initial != NULL_TREE +@@ -1473,6 +1484,7 @@ + DECL_INITIAL (field) = initial; + } + else ++ if (!flag_inhibit_reflection) + { + instance_field_count++; + instance_fields = tree_cons (NULL_TREE, init, instance_fields); +diff -ru gcc/java/java-tree.h gcc/java/java-tree.h +--- gcc/java/java-tree.h Mon Nov 18 10:13:35 2002 ++++ gcc/java/java-tree.h Wed Feb 25 19:49:44 2004 +@@ -225,6 +225,9 @@ + /* Encoding used for source files. */ + extern const char *current_encoding; + ++/** don't emit reflection information */ ++extern int flag_inhibit_reflection; ++ + /* The Java .class file that provides main_class; the main input file. */ + extern struct JCF *current_jcf; + +diff -ru gcc/java/lang.c gcc/java/lang.c +--- gcc/java/lang.c Sun Jan 5 07:03:25 2003 ++++ gcc/java/lang.c Wed Feb 25 19:49:49 2004 +@@ -171,6 +171,9 @@ + /* The encoding of the source file. */ + const char *current_encoding = NULL; + ++/** don't emit reflection information */ ++int flag_inhibit_reflection = 0; ++ + /* When nonzero, report the now deprecated empty statements. */ + int flag_extraneous_semicolon; + +@@ -431,6 +434,13 @@ + { + flag_inline_functions = 1; + flag_really_inline = 1; ++ return 1; ++ } ++#undef ARG ++#define ARG "-finhibit-reflection" ++ if (strncmp (p, ARG, sizeof (ARG) - 1) == 0) ++ { ++ flag_inhibit_reflection = 1; + return 1; + } + #undef ARG +diff -ru libjava/boehm.cc libjava/boehm.cc +--- libjava/boehm.cc Thu Jan 2 21:19:53 2003 ++++ libjava/boehm.cc Wed Feb 25 23:43:44 2004 +@@ -17,6 +17,7 @@ + + #include + #include ++#include + #include + + // More nastiness: the GC wants to define TRUE and FALSE. We don't +@@ -147,6 +148,7 @@ + for (int i = 0; i < c->method_count; ++i) + { + p = (ptr_t) c->methods[i].name; ++ if (p == NULL) continue; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, + cm1label); + p = (ptr_t) c->methods[i].signature; +@@ -164,9 +166,11 @@ + + #ifndef COMPACT_FIELDS + p = (ptr_t) field->name; ++ if (p == NULL) continue; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8alabel); + #endif + p = (ptr_t) field->type; ++ if (p == NULL) continue; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8blabel); + + // For the interpreter, we also need to mark the memory +@@ -258,6 +262,7 @@ + // Note: occasionally `klass' can be null. For instance, this + // can happen if a GC occurs between the point where an object + // is allocated and where the vtbl slot is set. ++ throw new java::lang::VirtualMachineError(); + while (klass && klass != &java::lang::Object::class$) + { + jfieldID field = JvGetFirstInstanceField (klass); +diff -ru libjava/gnu/gcj/convert/BytesToUnicode.java libjava/gnu/gcj/convert/BytesToUnicode.java +--- libjava/gnu/gcj/convert/BytesToUnicode.java Mon Jul 30 13:24:17 2001 ++++ libjava/gnu/gcj/convert/BytesToUnicode.java Wed Feb 25 22:53:54 2004 +@@ -65,7 +65,7 @@ + } + catch (Throwable ex) + { +- return new Input_8859_1(); ++ throw new UnsatisfiedLinkError(); + } + } + +diff -ru libjava/gnu/gcj/convert/UnicodeToBytes.java libjava/gnu/gcj/convert/UnicodeToBytes.java +--- libjava/gnu/gcj/convert/UnicodeToBytes.java Fri Aug 17 20:56:01 2001 ++++ libjava/gnu/gcj/convert/UnicodeToBytes.java Wed Feb 25 22:53:48 2004 +@@ -63,7 +63,8 @@ + } + catch (Throwable ex) + { +- return new Output_8859_1(); ++ throw new UnsatisfiedLinkError(); ++ //return new Output_8859_1(); + } + } + +diff -ru libjava/java/lang/Class.h libjava/java/lang/Class.h +--- libjava/java/lang/Class.h Sun Jan 19 22:49:28 2003 ++++ libjava/java/lang/Class.h Wed Feb 25 21:34:30 2004 +@@ -80,7 +80,6 @@ + // NULL-terminated list of exception class names; can be NULL if + // there are none such. + _Jv_Utf8Const **throws; +- + _Jv_Method *getNextMethod () + { return this + 1; } + }; +diff -ru libjava/java/lang/natClass.cc libjava/java/lang/natClass.cc +--- libjava/java/lang/natClass.cc Thu May 1 14:52:35 2003 ++++ libjava/java/lang/natClass.cc Wed Feb 25 22:59:34 2004 +@@ -808,10 +808,12 @@ + // Steps 8, 9, 10, 11. + try + { ++ /* + _Jv_Method *meth = _Jv_GetMethodLocal (this, clinit_name, + void_signature); + if (meth) + ((void (*) (void)) meth->ncode) (); ++ */ + } + catch (java::lang::Throwable *except) + { +@@ -1326,13 +1328,13 @@ + if (meth) + break; + } +- ++ /* + if (meth && (meth->name->data[0] == '<')) + { + // leave a placeholder in the itable for hidden init methods. + itable[pos] = NULL; + } +- else if (meth) ++ else*/ if (meth) + { + if (Modifier::isStatic(meth->accflags)) + throw new java::lang::IncompatibleClassChangeError +diff -ru libjava/libgcj.spec.in libjava/libgcj.spec.in +--- libjava/libgcj.spec.in Wed Feb 12 18:09:27 2003 ++++ libjava/libgcj.spec.in Wed Feb 25 19:51:22 2004 +@@ -4,6 +4,6 @@ + # to link with libgcj. + # + %rename lib liborig +-*lib: -lgcj -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig) ++*lib: -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig) + + *jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ -fkeep-inline-functions +diff -ru libjava/prims.cc libjava/prims.cc +--- libjava/prims.cc Fri Apr 25 09:02:21 2003 ++++ libjava/prims.cc Wed Feb 25 23:16:52 2004 +@@ -165,6 +165,7 @@ + { + int len; + _Jv_ushort *aptr, *bptr; ++ if (a == NULL || b == NULL) return false; + if (a == b) + return true; + if (a->hash != b->hash) +@@ -188,6 +189,7 @@ + jboolean + _Jv_equal (Utf8Const* a, jstring str, jint hash) + { ++ if (a == NULL) return false; + if (a->hash != (_Jv_ushort) hash) + return false; + jint len = str->length(); +@@ -210,6 +212,7 @@ + jboolean + _Jv_equaln (Utf8Const *a, jstring str, jint n) + { ++ if (a == NULL) return false; + jint len = str->length(); + jint i = 0; + jchar *sptr = _Jv_GetStringChars (str);