/* 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
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"
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
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
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
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
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
hashtable_utf = newhash;
}
- /* XXX REMOVE ME! */
- running = 0;
- /* XXX REMOVE ME! */
-
#if defined(USE_THREADS)
builtin_monitorexit(lock_hashtable_utf);
#endif
u4 len = 0; /* number of unicode characters */
if (!u) {
- *exceptionptr = new_nullpointerexception();
+ exceptions_throw_nullpointerexception();
return 0;
}
*******************************************************************************/
-#if defined(ENABLE_DEBUG)
+#if !defined(NDEBUG)
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) */
/*