diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 2044fc49694..1d8107b206e 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,18 @@ +2002-12-27 Mark Mitchell + + * boehm.cc: Remove stray semicolon. + * interpret.cc: Likewise. + * prims.cc: Likewise. + * verify.cc (_Jv_BytecodeVerifier::verify_fail): Move definition + earlier to ensure default arguments are processed. + * gcj/array.h (JArray): Add forward declaration. + (elements): Likewise. + * gcj/javaprim.h: Remove stray semicolons. + * include/bohm-gc.h: Likewise. + * include/jni.h: Likewise. + * include/jvm.h: Likewise. + * java/lang/Class.h (_Jv_GetArrayClass): Declare _Jv_NewArrayClass. + 2002-12-23 Jeff Sturm * exception.cc (PERSONALITY_FUNCTION): Clear least-significant-bit diff --git a/libjava/boehm.cc b/libjava/boehm.cc index 90796f2ddf0..df17ce82d9f 100644 --- a/libjava/boehm.cc +++ b/libjava/boehm.cc @@ -37,7 +37,7 @@ extern "C" // These aren't declared in any Boehm GC header. void GC_finalize_all (void); ptr_t GC_debug_generic_malloc (size_t size, int k, GC_EXTRA_PARAMS); -}; +} #define MAYBE_MARK(Obj, Top, Limit, Source, Exit) \ Top=GC_MARK_AND_PUSH((GC_PTR)Obj, Top, Limit, (GC_PTR *)Source) diff --git a/libjava/gcj/array.h b/libjava/gcj/array.h index db58ddfbdf8..33ea038df93 100644 --- a/libjava/gcj/array.h +++ b/libjava/gcj/array.h @@ -1,6 +1,6 @@ // array.h - Header file for CNI arrays. -*- c++ -*- -/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation This file is part of libgcj. @@ -29,6 +29,14 @@ public: friend jsize JvGetArrayLength (__JArray*); }; +template +class JArray; + +template +inline T* elements(JArray& x); +template +inline T* elements(JArray* x); + template class JArray : public __JArray { @@ -45,7 +53,7 @@ inline T* elements(JArray& x) { return x.data; } template inline T* elements(JArray* x) { return x->data; } -}; // end extern "Java" +} // end extern "Java" /* These typesdefs match those in JNI. */ typedef __JArray *jarray; diff --git a/libjava/gcj/javaprims.h b/libjava/gcj/javaprims.h index 8ed649432a2..c6e4a00ae39 100644 --- a/libjava/gcj/javaprims.h +++ b/libjava/gcj/javaprims.h @@ -123,7 +123,7 @@ extern "Java" class ValidatorAndPriority; class WriteAbortedException; class Writer; - }; + } namespace lang { @@ -222,7 +222,7 @@ extern "Java" class ReferenceQueue; class SoftReference; class WeakReference; - }; + } namespace reflect { @@ -240,8 +240,8 @@ extern "Java" class Proxy$ProxyType; class ReflectPermission; class UndeclaredThrowableException; - }; - }; + } + } namespace util { @@ -369,7 +369,7 @@ extern "Java" class JarInputStream; class JarOutputStream; class Manifest; - }; + } namespace zip { @@ -393,10 +393,10 @@ extern "Java" class ZipFile$ZipEntryEnumeration; class ZipInputStream; class ZipOutputStream; - }; - }; - }; -}; + } + } + } +} typedef struct java::lang::Object* jobject; typedef class java::lang::Class* jclass; diff --git a/libjava/include/boehm-gc.h b/libjava/include/boehm-gc.h index 6c60c794502..509900c737c 100644 --- a/libjava/include/boehm-gc.h +++ b/libjava/include/boehm-gc.h @@ -1,7 +1,7 @@ // -*- c++ -*- // boehm-gc.h - Defines for Boehm collector. -/* Copyright (C) 1998, 1999 Free Software Foundation +/* Copyright (C) 1998, 1999, 2002 Free Software Foundation This file is part of libgcj. @@ -19,7 +19,7 @@ extern "C" { JV_MARKOBJ_DECL; JV_MARKARRAY_DECL; -}; +} // Enough stuff to inline _Jv_AllocObj. Ugly. #include diff --git a/libjava/include/jni.h b/libjava/include/jni.h index 31f57985683..cab4571b094 100644 --- a/libjava/include/jni.h +++ b/libjava/include/jni.h @@ -211,7 +211,7 @@ extern JNIIMPEXP jint JNICALL JNI_CreateJavaVM (JavaVM **, void **, void *); extern JNIIMPEXP jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *); #ifdef __cplusplus -}; +} #endif /* __cplusplus */ typedef union jvalue diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index e02901de824..1e604980e0e 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -162,7 +162,7 @@ namespace gcj /* Set to true by _Jv_CreateJavaVM. */ extern bool runtimeInitialized; -}; +} /* Type of pointer used as finalizer. */ typedef void _Jv_FinalizerFunc (jobject); diff --git a/libjava/interpret.cc b/libjava/interpret.cc index 9791b4a5cd8..15fb413e835 100644 --- a/libjava/interpret.cc +++ b/libjava/interpret.cc @@ -91,7 +91,7 @@ static inline void dupx (_Jv_word *sp, int n, int x) sp[top-(n+x)-i] = sp[top-i]; } -}; +} // Used to convert from floating types to integral types. template diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index d59899a8182..5a56fd35c3b 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -333,6 +333,9 @@ private: inline friend jclass _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader) { + extern void _Jv_NewArrayClass (jclass element, + java::lang::ClassLoader *loader, + _Jv_VTable *array_vtable = 0); if (__builtin_expect (!klass->arrayclass, false)) _Jv_NewArrayClass (klass, loader); return klass->arrayclass; diff --git a/libjava/prims.cc b/libjava/prims.cc index 2195db161e1..61c66540831 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -592,15 +592,15 @@ _Jv_NewMultiArray (jclass array_type, jint dimensions, ...) _Jv_ArrayVTable _Jv_##NAME##VTable; \ java::lang::Class _Jv_##NAME##Class __attribute__ ((aligned (8))); -DECLARE_PRIM_TYPE(byte); -DECLARE_PRIM_TYPE(short); -DECLARE_PRIM_TYPE(int); -DECLARE_PRIM_TYPE(long); -DECLARE_PRIM_TYPE(boolean); -DECLARE_PRIM_TYPE(char); -DECLARE_PRIM_TYPE(float); -DECLARE_PRIM_TYPE(double); -DECLARE_PRIM_TYPE(void); +DECLARE_PRIM_TYPE(byte) +DECLARE_PRIM_TYPE(short) +DECLARE_PRIM_TYPE(int) +DECLARE_PRIM_TYPE(long) +DECLARE_PRIM_TYPE(boolean) +DECLARE_PRIM_TYPE(char) +DECLARE_PRIM_TYPE(float) +DECLARE_PRIM_TYPE(double) +DECLARE_PRIM_TYPE(void) void _Jv_InitPrimClass (jclass cl, char *cname, char sig, int len, diff --git a/libjava/verify.cc b/libjava/verify.cc index dbf80d4bf03..238a3e926f1 100644 --- a/libjava/verify.cc +++ b/libjava/verify.cc @@ -128,6 +128,34 @@ private: return r; } + __attribute__ ((__noreturn__)) void verify_fail (char *s, jint pc = -1) + { + using namespace java::lang; + StringBuffer *buf = new StringBuffer (); + + buf->append (JvNewStringLatin1 ("verification failed")); + if (pc == -1) + pc = start_PC; + if (pc != -1) + { + buf->append (JvNewStringLatin1 (" at PC ")); + buf->append (pc); + } + + _Jv_InterpMethod *method = current_method; + buf->append (JvNewStringLatin1 (" in ")); + buf->append (current_class->getName()); + buf->append ((jchar) ':'); + buf->append (JvNewStringUTF (method->get_method()->name->data)); + buf->append ((jchar) '('); + buf->append (JvNewStringUTF (method->get_method()->signature->data)); + buf->append ((jchar) ')'); + + buf->append (JvNewStringLatin1 (": ")); + buf->append (JvNewStringLatin1 (s)); + throw new java::lang::VerifyError (buf->toString ()); + } + // This enum holds a list of tags for all the different types we // need to handle. Reference types are treated specially by the // type class. @@ -3064,34 +3092,6 @@ private: } } - __attribute__ ((__noreturn__)) void verify_fail (char *s, jint pc = -1) - { - using namespace java::lang; - StringBuffer *buf = new StringBuffer (); - - buf->append (JvNewStringLatin1 ("verification failed")); - if (pc == -1) - pc = start_PC; - if (pc != -1) - { - buf->append (JvNewStringLatin1 (" at PC ")); - buf->append (pc); - } - - _Jv_InterpMethod *method = current_method; - buf->append (JvNewStringLatin1 (" in ")); - buf->append (current_class->getName()); - buf->append ((jchar) ':'); - buf->append (JvNewStringUTF (method->get_method()->name->data)); - buf->append ((jchar) '('); - buf->append (JvNewStringUTF (method->get_method()->signature->data)); - buf->append ((jchar) ')'); - - buf->append (JvNewStringLatin1 (": ")); - buf->append (JvNewStringLatin1 (s)); - throw new java::lang::VerifyError (buf->toString ()); - } - public: void verify_instructions ()