From 93f8e21b71a52f12a70eb8556c244ed886612bbd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 25 May 2005 15:23:56 +0000 Subject: re PR libgcj/21703 (hang when rapidly calling String.intern()) PR libgcj/21703: * java/lang/ref/natReference.cc (find_slot): Handle case where table has no NULL entries. * java/lang/natString.cc (_Jv_StringFindSlot): Handle case where table has no NULL entries. From-SVN: r100153 --- libjava/java/lang/ref/natReference.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'libjava/java/lang/ref') diff --git a/libjava/java/lang/ref/natReference.cc b/libjava/java/lang/ref/natReference.cc index e322ae3..5ad5b10 100644 --- a/libjava/java/lang/ref/natReference.cc +++ b/libjava/java/lang/ref/natReference.cc @@ -1,6 +1,6 @@ // natReference.cc - Native code for References -/* Copyright (C) 2001, 2002, 2003 Free Software Foundation +/* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation This file is part of libgcj. @@ -78,7 +78,7 @@ find_slot (jobject key) int start_index = hcode & (hash_size - 1); int index = start_index; int deleted_index = -1; - for (;;) + do { object_list *ptr = &hash[index]; if (ptr->reference == key) @@ -96,8 +96,12 @@ find_slot (jobject key) JvAssert (ptr->reference == DELETED_REFERENCE); } index = (index + step) & (hash_size - 1); - JvAssert (index != start_index); } + while (index != start_index); + // Note that we can have INDEX == START_INDEX if the table has no + // NULL entries but does have DELETED entries. + JvAssert (deleted_index >= 0); + return &hash[deleted_index]; } static void -- cgit v1.1