Merged revisions 8245-8298 via svnmerge from
[cacao.git] / src / vmcore / utf8.c
index 46a0c7e168e9e65f943ff16b54cc66ebb5c7a3d7..2dccde9cd2d45e464611eb22d9ec37073ec73727 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: utf8.c 7246 2007-01-29 18:49:05Z twisti $
+   $Id: utf8.c 8249 2007-07-31 12:59:03Z panzi $
 
 */
 
 
 #include "mm/memory.h"
 
-#if defined(ENABLE_THREADS)
-# include "threads/native/lock.h"
-#else
-# include "threads/none/lock.h"
-#endif
+#include "threads/lock-common.h"
 
 #include "toolbox/hashtable.h"
 
@@ -75,10 +71,15 @@ utf *utf_java_lang_SecurityManager;
 utf *utf_java_lang_String;
 utf *utf_java_lang_System;
 utf *utf_java_lang_ThreadGroup;
+utf *utf_java_lang_ref_SoftReference;
+utf *utf_java_lang_ref_WeakReference;
+utf *utf_java_lang_ref_PhantomReference;
 utf *utf_java_io_Serializable;
 
 utf *utf_java_lang_Throwable;
 utf *utf_java_lang_Error;
+
+utf *utf_java_lang_AbstractMethodError;
 utf *utf_java_lang_ClassCircularityError;
 utf *utf_java_lang_ClassFormatError;
 utf *utf_java_lang_ExceptionInInitializerError;
@@ -87,23 +88,20 @@ utf *utf_java_lang_InstantiationError;
 utf *utf_java_lang_InternalError;
 utf *utf_java_lang_LinkageError;
 utf *utf_java_lang_NoClassDefFoundError;
+utf *utf_java_lang_NoSuchFieldError;
+utf *utf_java_lang_NoSuchMethodError;
 utf *utf_java_lang_OutOfMemoryError;
 utf *utf_java_lang_UnsatisfiedLinkError;
 utf *utf_java_lang_UnsupportedClassVersionError;
 utf *utf_java_lang_VerifyError;
 utf *utf_java_lang_VirtualMachineError;
 
-#if defined(ENABLE_JAVASE)
-utf *utf_java_lang_AbstractMethodError;
-utf *utf_java_lang_NoSuchFieldError;
-utf *utf_java_lang_NoSuchMethodError;
-#endif
-
 #if defined(WITH_CLASSPATH_GNU)
 utf *utf_java_lang_VMThrowable;
 #endif
 
 utf *utf_java_lang_Exception;
+
 utf *utf_java_lang_ArithmeticException;
 utf *utf_java_lang_ArrayIndexOutOfBoundsException;
 utf *utf_java_lang_ArrayStoreException;
@@ -115,11 +113,14 @@ utf *utf_java_lang_IllegalArgumentException;
 utf *utf_java_lang_IllegalMonitorStateException;
 utf *utf_java_lang_InstantiationException;
 utf *utf_java_lang_InterruptedException;
-utf *utf_java_lang_InvocationTargetException;
 utf *utf_java_lang_NegativeArraySizeException;
 utf *utf_java_lang_NullPointerException;
 utf *utf_java_lang_StringIndexOutOfBoundsException;
 
+utf *utf_java_lang_reflect_InvocationTargetException;
+
+utf *utf_java_security_PrivilegedActionException;
+
 #if defined(ENABLE_JAVASE)
 utf* utf_java_lang_Void;
 #endif
@@ -151,8 +152,20 @@ utf *utf_SourceFile;                    /* SourceFile                         */
 #if defined(ENABLE_JAVASE)
 utf *utf_EnclosingMethod;
 utf *utf_Signature;
-utf *utf_RuntimeVisibleAnnotations;
 utf *utf_StackMapTable;
+
+#if defined(ENABLE_ANNOTATIONS)
+utf *utf_sun_reflect_ConstantPool;
+#if defined(WITH_CLASSPATH_GNU)
+utf *utf_sun_reflect_annotation_AnnotationParser;
+#endif
+
+utf *utf_RuntimeVisibleAnnotations;
+utf *utf_RuntimeInvisibleAnnotations;
+utf *utf_RuntimeVisibleParameterAnnotations;
+utf *utf_RuntimeInvisibleParameterAnnotations;
+utf *utf_AnnotationDefault;
+#endif
 #endif
 
 utf *utf_init;                          /* <init>                             */
@@ -170,10 +183,14 @@ utf *utf_get;
 utf *utf_value;
 
 utf *utf_fillInStackTrace;
+utf *utf_findNative;
 utf *utf_getSystemClassLoader;
+utf *utf_initCause;
 utf *utf_loadClass;
 utf *utf_printStackTrace;
 
+utf *utf_division_by_zero;
+
 utf *utf_Z;                             /* Z                                  */
 utf *utf_B;                             /* B                                  */
 utf *utf_C;                             /* C                                  */
@@ -196,11 +213,14 @@ utf *utf_double__void;                  /* (D)V                               */
 utf *utf_void__java_lang_ClassLoader;   /* ()Ljava/lang/ClassLoader;          */
 utf *utf_void__java_lang_Object;        /* ()Ljava/lang/Object;               */
 utf *utf_void__java_lang_Throwable;     /* ()Ljava/lang/Throwable;            */
+utf *utf_java_lang_ClassLoader_java_lang_String__J;
+utf *utf_java_lang_Exception__V;        /* (Ljava/lang/Exception;)V           */
 utf *utf_java_lang_Object__java_lang_Object;
 utf *utf_java_lang_String__void;        /* (Ljava/lang/String;)V              */
 utf *utf_java_lang_String__java_lang_Class;
 utf *utf_java_lang_Thread__V;           /* (Ljava/lang/Thread;)V              */
 utf *utf_java_lang_Throwable__void;     /* (Ljava/lang/Throwable;)V           */
+utf *utf_java_lang_Throwable__java_lang_Throwable;
 
 utf *utf_not_named_yet;                 /* special name for unnamed classes   */
 utf *utf_null;
@@ -237,6 +257,16 @@ bool utf8_init(void)
        utf_java_lang_String           = utf_new_char("java/lang/String");
        utf_java_lang_System           = utf_new_char("java/lang/System");
        utf_java_lang_ThreadGroup      = utf_new_char("java/lang/ThreadGroup");
+
+       utf_java_lang_ref_SoftReference =
+               utf_new_char("java/lang/ref/SoftReference");
+
+       utf_java_lang_ref_WeakReference =
+               utf_new_char("java/lang/ref/WeakReference");
+
+       utf_java_lang_ref_PhantomReference =
+               utf_new_char("java/lang/ref/PhantomReference");
+
        utf_java_io_Serializable       = utf_new_char("java/io/Serializable");
 
        utf_java_lang_Throwable        = utf_new_char("java/lang/Throwable");
@@ -325,9 +355,6 @@ bool utf8_init(void)
        utf_java_lang_InterruptedException =
                utf_new_char("java/lang/InterruptedException");
 
-       utf_java_lang_InvocationTargetException =
-               utf_new_char("java/lang/InvocationTargetException");
        utf_java_lang_NegativeArraySizeException =
                utf_new_char("java/lang/NegativeArraySizeException");
 
@@ -337,6 +364,12 @@ bool utf8_init(void)
        utf_java_lang_StringIndexOutOfBoundsException =
                utf_new_char("java/lang/StringIndexOutOfBoundsException");
 
+       utf_java_lang_reflect_InvocationTargetException =
+               utf_new_char("java/lang/reflect/InvocationTargetException");
+
+       utf_java_security_PrivilegedActionException =
+               utf_new_char("java/security/PrivilegedActionException");
 #if defined(ENABLE_JAVASE)
        utf_java_lang_Void             = utf_new_char("java/lang/Void");
 #endif
@@ -372,8 +405,20 @@ bool utf8_init(void)
 #if defined(ENABLE_JAVASE)
        utf_EnclosingMethod            = utf_new_char("EnclosingMethod");
        utf_Signature                  = utf_new_char("Signature");
-       utf_RuntimeVisibleAnnotations  = utf_new_char("RuntimeVisibleAnnotations");
        utf_StackMapTable              = utf_new_char("StackMapTable");
+
+#if defined(ENABLE_ANNOTATIONS)
+       utf_sun_reflect_ConstantPool                = utf_new_char("sun/reflect/ConstantPool");
+#if defined(WITH_CLASSPATH_GNU)
+       utf_sun_reflect_annotation_AnnotationParser = utf_new_char("sun/reflect/annotation/AnnotationParser");
+#endif
+
+       utf_RuntimeVisibleAnnotations            = utf_new_char("RuntimeVisibleAnnotations");
+       utf_RuntimeInvisibleAnnotations          = utf_new_char("RuntimeInvisibleAnnotations");
+       utf_RuntimeVisibleParameterAnnotations   = utf_new_char("RuntimeVisibleParameterAnnotations");
+       utf_RuntimeInvisibleParameterAnnotations = utf_new_char("RuntimeInvisibleParameterAnnotations");
+       utf_AnnotationDefault                    = utf_new_char("AnnotationDefault");
+#endif
 #endif
 
        utf_init                           = utf_new_char("<init>");
@@ -390,10 +435,14 @@ bool utf8_init(void)
        utf_get                        = utf_new_char("get");
        utf_value                      = utf_new_char("value");
 
-       utf_printStackTrace            = utf_new_char("printStackTrace");
        utf_fillInStackTrace           = utf_new_char("fillInStackTrace");
-       utf_loadClass                  = utf_new_char("loadClass");
+       utf_findNative                 = utf_new_char("findNative");
        utf_getSystemClassLoader       = utf_new_char("getSystemClassLoader");
+       utf_initCause                  = utf_new_char("initCause");
+       utf_loadClass                  = utf_new_char("loadClass");
+       utf_printStackTrace            = utf_new_char("printStackTrace");
+
+       utf_division_by_zero           = utf_new_char("/ by zero");
 
        utf_Z                          = utf_new_char("Z");
        utf_B                          = utf_new_char("B");
@@ -419,6 +468,11 @@ bool utf8_init(void)
        utf_void__java_lang_ClassLoader =
                utf_new_char("()Ljava/lang/ClassLoader;");
 
+       utf_java_lang_ClassLoader_java_lang_String__J =
+               utf_new_char("(Ljava/lang/ClassLoader;Ljava/lang/String;)J");
+
+       utf_java_lang_Exception__V     = utf_new_char("(Ljava/lang/Exception;)V");
+
        utf_java_lang_Object__java_lang_Object =
                utf_new_char("(Ljava/lang/Object;)Ljava/lang/Object;");
 
@@ -430,6 +484,9 @@ bool utf8_init(void)
        utf_java_lang_Thread__V        = utf_new_char("(Ljava/lang/Thread;)V");
        utf_java_lang_Throwable__void  = utf_new_char("(Ljava/lang/Throwable;)V");
 
+       utf_java_lang_Throwable__java_lang_Throwable =
+               utf_new_char("(Ljava/lang/Throwable;)Ljava/lang/Throwable;");
+
        utf_null                       = utf_new_char("null");
        utf_not_named_yet              = utf_new_char("\t<not_named_yet>");
        array_packagename              = utf_new_char("\t<the array package>");
@@ -1009,7 +1066,7 @@ u4 utf_get_number_of_u2s(utf *u)
        if (utf_ptr != endpos) {
                /* string ended abruptly */
                exceptions_throw_internalerror("Illegal utf8 string");
-               return NULL;
+               return 0;
        }
 
        return len;