/* src/vm/jit/optimizing/profile.c - runtime profiling
- Copyright (C) 1996-2005, 2006, 2007 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, J. Wenninger, Institut f. Computersprachen - TU Wien
+ Copyright (C) 1996-2005, 2006, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: profile.c 7952 2007-05-23 17:53:13Z twisti $
-
*/
#include "vm/types.h"
-#include "mm/memory.h"
+#include "mm/memory.hpp"
-#include "threads/threads-common.h"
+#include "threads/threadlist.hpp"
+#include "threads/thread.hpp"
-#include "vm/builtin.h"
-#include "vm/stringlocal.h"
+#include "vm/jit/builtin.hpp"
+#include "vm/class.hpp"
+#include "vm/classcache.hpp"
+#include "vm/method.hpp"
+#include "vm/options.h"
+#include "vm/string.hpp"
-#include "vm/jit/jit.h"
+#include "vm/jit/jit.hpp"
#include "vm/jit/methodheader.h"
-#include "vm/jit/optimizing/recompile.h"
+#include "vm/jit/methodtree.h"
-#include "vmcore/class.h"
-#include "vmcore/classcache.h"
-#include "vmcore/method.h"
-#include "vmcore/options.h"
+#include "vm/jit/optimizing/recompiler.hpp"
/* profile_init ****************************************************************
threads_sleep(0, nanos);
runs++;
- /* lock the threads lists */
-
- threads_list_lock();
+ // Lock the thread lists.
+ ThreadList_lock();
+#if 0
/* iterate over all started threads */
- for (t = threads_list_first(); t != NULL; t = threads_list_next(t)) {
+ for (t = ThreadList_first(); t != NULL; t = ThreadList_next(t)) {
/* is this a Java thread? */
if (!(t->flags & THREAD_FLAG_JAVA))
pc = t->pc;
- /* get the PV for the current PC */
+ /* Get the PV for the current PC. */
- pv = codegen_get_pv_from_pc_nocheck(pc);
+ pv = methodtree_find_nocheck(pc);
/* get methodinfo pointer from data segment */
/* add this method to the method list and
start recompilation */
- recompile_queue_method(m);
+ Recompiler_queue_method(m);
}
}
}
}
}
+#endif
- /* unlock the threads lists */
-
- threads_list_unlock();
+ // Unlock the thread lists.
+ ThreadList_unlock();
}
}
#endif
#if !defined(NDEBUG)
void profile_printstats(void)
{
- list_t *l;
- list_method_entry *lme;
- list_method_entry *tlme;
classinfo *c;
methodinfo *m;
codeinfo *code;
frequency = 0;
cycles = 0;
+#if 0
/* create new method list */
-
- l = list_create(OFFSET(list_method_entry, linkage));
+ // TODO Use a sorted container.
+ List* l = List_new();
/* iterate through all classes and methods */
frequency += code->frequency;
cycles += code->cycles;
- /* create new list entry */
-
- lme = NEW(list_method_entry);
- lme->m = m;
-
/* sort the new entry into the list */
- if ((tlme = list_first(l)) == NULL) {
- list_add_first(l, lme);
+ if (List_empty(l) == NULL) {
+ List_push_back(l, m);
}
else {
for (; tlme != NULL; tlme = list_next(l, tlme)) {
j, code->bbfrequency[j]);
}
}
+#endif
printf("----------- -------------- \n");
printf("%10d %12ld\n", frequency, (long) cycles);