- the heap
- additional support functions
- $Id: tables.c 1185 2004-06-19 12:23:13Z twisti $
+ $Id: tables.c 1240 2004-06-30 20:07:25Z twisti $
*/
#include <sys/mman.h>
#include <unistd.h>
#include "types.h"
-#include "main.h"
+#include "options.h"
#include "tables.h"
#include "loader.h"
#include "asmpart.h"
+#include "statistics.h"
#include "threads/thread.h"
#include "threads/locks.h"
#include "toolbox/logging.h"
#include "toolbox/memory.h"
-/* statistics */
-int count_utf_len = 0; /* size of utf hash */
-int count_utf_new = 0; /* calls of utf_new */
-int count_utf_new_found = 0; /* calls of utf_new with fast return */
-
hashtable utf_hash; /* hashtable for utf8-symbols */
hashtable string_hash; /* hashtable for javastrings */
hashtable class_hash; /* hashtable for classes */
if (opt_eager) {
classinfo *tc;
+ classinfo *tmp;
list_init(&unlinkedclasses, OFFSET(classinfo, listnode));
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
tables_unlock();
#endif
- return NULL;
+ return c;
}
}
/* link all referenced classes */
- while ((tc = list_first(&unlinkedclasses))) {
- printf("tc=%p next=%p prev=%p ", tc, tc->listnode.next, tc->listnode.prev);
- utf_display(tc->name);
- printf("\n");
- fflush(stdout);
+ tc = list_first(&unlinkedclasses);
- /* skip super class */
+ while (tc) {
+ /* skip the current loaded/linked class */
if (tc != c) {
if (!class_link(tc)) {
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
tables_unlock();
#endif
- return NULL;
+ return c;
}
}
- list_remove(&unlinkedclasses, tc);
+ /* we need a tmp variable here, because list_remove sets prev and
+ next to NULL */
+ tmp = list_next(&unlinkedclasses, tc);
+ list_remove(&unlinkedclasses, tc);
+ tc = tmp;
}
if (!c->linked) {
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
tables_unlock();
#endif
- return NULL;
+ return c;
}
}
}