* src/vm/jit/stack.c (show_icmd): Fixed ICMD_ELSE_ICONST output.
[cacao.git] / src / vm / utf8.c
index 5d118e1002bf0267e378bbc26f703a7007eaa044..f14cf3e2c0f30e4ffa58403829ff4632c8dd8230 100644 (file)
@@ -1,9 +1,9 @@
 /* src/vm/utf.c - utf functions
 
-   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
-   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
-   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
-   Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Reinhard Grafl
 
@@ -30,7 +30,7 @@
             Andreas Krall
             Christian Thalinger
 
-   $Id: utf8.c 3835 2005-12-01 23:32:57Z twisti $
+   $Id: utf8.c 4357 2006-01-22 23:33:38Z twisti $
 
 */
 
 #include "vm/types.h"
 
 #include "mm/memory.h"
+
+#if defined(USE_THREADS)
+# if defined(NATIVE_THREADS)
+#  include "threads/native/threads.h"
+# else
+#  include "threads/green/threads.h"
+# endif
+#endif
+
+#include "vm/builtin.h"
 #include "vm/exceptions.h"
 #include "vm/hashtable.h"
 #include "vm/options.h"
@@ -174,7 +184,7 @@ bool utf8_init(void)
 
        hashtable_create(&hashtable_utf, HASHTABLE_UTF_SIZE);
 
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
        if (opt_stat)
                count_utf_len += sizeof(utf*) * hashtable_utf.size;
 #endif
@@ -476,20 +486,11 @@ utf *utf_new(const char *text, u2 length)
        utf *u;                             /* hashtable element                  */
        u2 i;
 
-       /* XXX REMOVE ME! after testing of course ;-) */
-       static int running = 0;
-       /* XXX REMOVE ME! */
-
 #if defined(USE_THREADS)
        builtin_monitorenter(lock_hashtable_utf);
 #endif
 
-       /* XXX REMOVE ME! after testing of course ;-) */
-       assert(running == 0);
-       running = 1;
-       /* XXX REMOVE ME! */
-
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
        if (opt_stat)
                count_utf_new++;
 #endif
@@ -508,17 +509,13 @@ utf *utf_new(const char *text, u2 length)
                                if (text[i] != u->text[i])
                                        goto nomatch;
                        
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
                        if (opt_stat)
                                count_utf_new_found++;
 #endif
 
                        /* symbol found in hashtable */
 
-                       /* XXX REMOVE ME! */
-                       running = 0;
-                       /* XXX REMOVE ME! */
-
 #if defined(USE_THREADS)
                        builtin_monitorexit(lock_hashtable_utf);
 #endif
@@ -530,7 +527,7 @@ utf *utf_new(const char *text, u2 length)
                u = u->hashlink; /* next element in external chain */
        }
 
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
        if (opt_stat)
                count_utf_len += sizeof(utf) + length + 1;
 #endif
@@ -563,7 +560,7 @@ utf *utf_new(const char *text, u2 length)
                hashtable_create(&newhash, hashtable_utf.size * 2);
                newhash.entries = hashtable_utf.entries;
 
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
                if (opt_stat)
                        count_utf_len += sizeof(utf*) * hashtable_utf.size;
 #endif
@@ -592,10 +589,6 @@ utf *utf_new(const char *text, u2 length)
                hashtable_utf = newhash;
        }
 
-       /* XXX REMOVE ME! */
-       running = 0;
-       /* XXX REMOVE ME! */
-
 #if defined(USE_THREADS)
        builtin_monitorexit(lock_hashtable_utf);
 #endif
@@ -782,7 +775,7 @@ u4 utf_strlen(utf *u)
        u4 len = 0;                         /* number of unicode characters       */
 
        if (!u) {
-               *exceptionptr = new_nullpointerexception();
+               exceptions_throw_nullpointerexception();
                return 0;
        }
 
@@ -1147,7 +1140,7 @@ bool is_valid_name_utf(utf *u)
 
 *******************************************************************************/
 
-#if defined(ENABLE_DEBUG)
+#if !defined(NDEBUG)
 void utf_show(void)
 {
 
@@ -1231,7 +1224,7 @@ void utf_show(void)
        /* avg. chainlength = sum of chainlengths / number of chains */
        printf("avg. chainlength:%5.2f\n",(float) sum_chainlength / (hashtable_utf.size-chain_count[0]));
 }
-#endif /* defined(ENABLE_DEBUG) */
+#endif /* !defined(NDEBUG) */
 
 
 /*