* src/vm/jit/optimizing/profile.h: Likewise.
* src/vm/jit/optimizing/recompile.c: Likewise.
* src/vm/jit/optimizing/recompile.h: Likewise.
* src/vm/jit/optimizing/Makefile.am (INCLUDES): Added OS_DIR.
(PROFILE_SOURCES): Added.
(RECOMPILE_SOURCES): Added.
(SSA_SOURCES): Added.
* src/vm/jit/recompile.c: Removed.
* src/vm/jit/recompile.h: Likewise.
* src/vm/jit/profile: Likewise.
* src/vm/jit/Makefile.am (SUBDIRS): Added optimizing.
(PROFILE_LIB): Removed.
(RECOMPILE_SOURCES): Likewise.
* src/cacao/Makefile.am (GC_LIB): Removed.
* src/mm/Makefile.am (DIST_DUBDIRS): Added boehm-gc.
(GC_LIB): Added.
* src/Makefile.am (DIST_SUBDIRS): Removed boehm-gc.
(SUBDIRS): Likewise.
(BOEHM): Removed.
* src/threads/native/threads.c (boehm-gc/include/gc.h): Changed to
mm/boehm-gc/include/gc.h.
* src/cacaoh/Makefile.am (GC_LIB): Removed.
* configure.ac (AC_CONFIG_FILES): Removed src/vm/jit/profile/Makefile.
(AC_CONFIG_SUBDIRS): Changed src/boehm-gc to src/mm/boehm-gc.
* autogen.sh: Changed path to boehm-gc.
--HG--
rename : src/vm/jit/profile/profile.c => src/vm/jit/optimizing/profile.c
rename : src/vm/jit/profile/profile.h => src/vm/jit/optimizing/profile.h
rename : src/vm/jit/recompile.c => src/vm/jit/optimizing/recompile.c
rename : src/vm/jit/recompile.h => src/vm/jit/optimizing/recompile.h
export CACAO_AUTOMAKE
export CACAO_AUTOCONF
-cd src/boehm-gc && ./autogen.sh && cd ../..
+cd src/mm/boehm-gc && ./autogen.sh && cd ../..
[src/vm/jit/powerpc/netbsd/Makefile]
[src/vm/jit/powerpc64/Makefile]
[src/vm/jit/powerpc64/linux/Makefile]
- [src/vm/jit/profile/Makefile]
[src/vm/jit/schedule/Makefile]
[src/vm/jit/sparc64/Makefile]
[src/vm/jit/sparc64/linux/Makefile]
dnl now configure subpackages with OPT_CFLAGS and ARCH_CFLAGS
export OPT_CFLAGS
export ARCH_CFLAGS
-AC_CONFIG_SUBDIRS(src/boehm-gc)
+AC_CONFIG_SUBDIRS(src/mm/boehm-gc)
AC_OUTPUT
##
## Changes:
##
-## $Id: Makefile.am 4357 2006-01-22 23:33:38Z twisti $
+## $Id: Makefile.am 5884 2006-10-31 20:11:28Z twisti $
## Process this file with automake to produce Makefile.in
DIST_SUBDIRS = \
- boehm-gc \
lib \
fdlibm \
mm \
cacao \
scripts
-if DISABLE_GC
-BOEHM =
-else
-BOEHM = boehm-gc
-endif
-
# Keep this order!!!
SUBDIRS = \
- $(BOEHM) \
lib \
fdlibm \
mm \
##
## Changes:
##
-## $Id: Makefile.am 5579 2006-09-29 11:37:12Z twisti $
+## $Id: Makefile.am 5884 2006-10-31 20:11:28Z twisti $
## Process this file with automake to produce Makefile.in
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR) -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR)/$(OS_DIR)
-if DISABLE_GC
-GC_LIB =
-else
-GC_LIB = $(top_builddir)/src/boehm-gc/libgc.la
-endif
-
if ENABLE_THREADS
-THREAD_LIB = $(top_builddir)/src/threads/native/libthreads.la
+THREAD_LIB = \
+ $(top_builddir)/src/threads/native/libthreads.la
endif
if ENABLE_STATICVM
##
## Changes:
##
-## $Id: Makefile.am 4921 2006-05-15 14:24:36Z twisti $
+## $Id: Makefile.am 5884 2006-10-31 20:11:28Z twisti $
## Process this file with automake to produce Makefile.in
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR) -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR)/$(OS_DIR)
-if DISABLE_GC
-GC_LIB =
-else
-GC_LIB = $(top_builddir)/src/boehm-gc/libgc.la
-endif
-
if ENABLE_THREADS
-THREAD_LIB = $(top_builddir)/src/threads/native/libthreads.la
+THREAD_LIB = \
+ $(top_builddir)/src/threads/native/libthreads.la
endif
if ENABLE_RT_TIMING
cacaoh_LDFLAGS = -lrt
endif
-noinst_LTLIBRARIES = libcacaoh.la
+noinst_LTLIBRARIES = \
+ libcacaoh.la
libcacaoh_la_SOURCES = \
headers.c \
##
## Changes:
##
-## $Id: Makefile.am 4627 2006-03-16 12:53:32Z twisti $
+## $Id: Makefile.am 5884 2006-10-31 20:11:28Z twisti $
## Process this file with automake to produce Makefile.in
LIBS =
+DIST_SUBDIRS = \
+ boehm-gc
+
if DISABLE_GC
-GC_FILE = nogc.c
+GC_FILE = \
+ nogc.c
else
-GC_FILE = boehm.c
+SUBDIRS = \
+ boehm-gc
+
+GC_FILE = \
+ boehm.c
+
+GC_LIB = \
+ $(top_builddir)/src/mm/boehm-gc/libgc.la
endif
-noinst_LTLIBRARIES = libmm.la
+noinst_LTLIBRARIES = \
+ libmm.la
libmm_la_SOURCES = \
$(GC_FILE) \
memory.c \
memory.h
+libmm_la_LIBADD = \
+ $(GC_LIB)
+
## Local variables:
## mode: Makefile
Changes: Christian Thalinger
Edwin Steiner
- $Id: threads.c 5870 2006-10-30 12:27:59Z twisti $
+ $Id: threads.c 5884 2006-10-31 20:11:28Z twisti $
*/
# define GC_IRIX_THREADS
# endif
# include <semaphore.h>
-# include "boehm-gc/include/gc.h"
+# include "mm/boehm-gc/include/gc.h"
#endif
#if defined(ENABLE_JVMTI)
##
## Changes: Edwin Steiner
##
-## $Id: Makefile.am 5814 2006-10-20 14:53:27Z twisti $
+## $Id: Makefile.am 5884 2006-10-31 20:11:28Z twisti $
## Process this file with automake to produce Makefile.in
inline \
loop \
optimizing \
- profile \
schedule \
tools \
verify \
x86_64
SUBDIRS = \
+ optimizing \
tools \
verify
ARCH_LIB = \
$(ARCH_DIR)/libarch.la
+
+OPTIMIZING_LIB = \
+ optimizing/liboptimizing.la
endif
if ENABLE_INTRP
loop/libloop.la
endif
-if ENABLE_PROFILING
-SUBDIRS += \
- profile
-
-PROFILE_LIB = \
- profile/libprofile.la
-endif
-
if USE_SCHEDULER
SUBDIRS += \
schedule
schedule/libschedule.la
endif
-if ENABLE_SSA
-SUBDIRS += \
- optimizing
-
-OPTIMIZING_LIB = \
- optimizing/liboptimizing.la
-endif
-
-if ENABLE_THREADS
-RECOMPILE_SOURCES = \
- recompile.c \
- recompile.h
-endif
-
if ENABLE_JIT
REG_SOURCES = \
reg.c \
## src/vm/jit/loop/Makefile.am
##
-## Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+## 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
## Process this file with automake to produce Makefile.in
-INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit -I$(top_srcdir)/src/vm/jit/@ARCH_DIR@
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR) -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR)/$(OS_DIR)
-noinst_LTLIBRARIES = liboptimizing.la
+if ENABLE_PROFILING
+PROFILE_SOURCES = \
+ profile.c \
+ profile.h
+endif
-liboptimizing_la_SOURCES = \
+if ENABLE_THREADS
+RECOMPILE_SOURCES = \
+ recompile.c \
+ recompile.h
+endif
+
+if ENABLE_SSA
+SSA_SOURCES = \
lsra.c \
lsra.h \
ssa.c \
dominators.h \
lifetimes.c \
lifetimes.h
+endif
+
+noinst_LTLIBRARIES = \
+ liboptimizing.la
+
+liboptimizing_la_SOURCES = \
+ $(PROFILE_SOURCES) \
+ $(RECOMPILE_SOURCES) \
+ $(SSA_SOURCES)
## Local variables:
--- /dev/null
+/* src/vm/jit/optimizing/profile.c - runtime profiling
+
+ 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, J. Wenninger, Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Contact: cacao@cacaojvm.org
+
+ Authors: Christian Thalinger
+
+ Changes:
+
+ $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include "vm/types.h"
+
+#include "mm/memory.h"
+#include "native/jni.h"
+#include "native/include/java_lang_Thread.h"
+#include "native/include/java_lang_VMThread.h"
+
+#if defined(ENABLE_THREADS)
+# include "threads/native/threads.h"
+#endif
+
+#include "vm/builtin.h"
+#include "vm/class.h"
+#include "vm/classcache.h"
+#include "vm/method.h"
+#include "vm/options.h"
+#include "vm/stringlocal.h"
+#include "vm/jit/jit.h"
+#include "vm/jit/methodheader.h"
+#include "vm/jit/optimizing/recompile.h"
+
+
+/* global variables ***********************************************************/
+
+#if defined(ENABLE_THREADS)
+static java_lang_VMThread *profile_vmthread;
+#endif
+
+
+/* profile_init ****************************************************************
+
+ Initializes the profile global lock.
+
+*******************************************************************************/
+
+bool profile_init(void)
+{
+ /* everything's ok */
+
+ return true;
+}
+
+
+/* profile_thread **************************************************************
+
+ XXX
+
+*******************************************************************************/
+
+static s4 runs = 0;
+static s4 hits = 0;
+static s4 misses = 0;
+
+#if defined(ENABLE_THREADS)
+static void profile_thread(void)
+{
+ threadobject *t;
+ s4 nanos;
+ u1 *pc;
+ u1 *pv;
+ methodinfo *m;
+ codeinfo *code;
+
+ while (true) {
+ /* sleep thread for 0.5-1.0 ms */
+
+ nanos = 500 + (int) (500.0 * (rand() / (RAND_MAX + 1.0)));
+/* fprintf(stderr, "%d\n", nanos); */
+
+ threads_sleep(0, nanos);
+ runs++;
+
+ /* iterate over all started threads */
+
+ t = mainthreadobj;
+
+ do {
+ /* is this a Java thread? */
+
+ if (t->flags & THREAD_FLAG_JAVA) {
+ /* send SIGUSR2 to thread to get the current PC */
+
+ pthread_kill(t->tid, SIGUSR2);
+
+ /* the thread object now contains the current thread PC */
+
+ pc = t->pc;
+
+ /* get the PV for the current PC */
+
+ pv = codegen_get_pv_from_pc_nocheck(pc);
+
+ /* get methodinfo pointer from data segment */
+
+ if (pv == NULL) {
+ misses++;
+ }
+ else {
+ code = *((codeinfo **) (pv + CodeinfoPointer));
+
+ /* For asm_vm_call_method the codeinfo pointer is
+ NULL (which is also in the method tree). */
+
+ if (code != NULL) {
+ m = code->m;
+
+ /* native methods are never recompiled */
+
+ if (!(m->flags & ACC_NATIVE)) {
+ /* increase the method incovation counter */
+
+ code->frequency++;
+ hits++;
+
+ if (code->frequency > 500) {
+ /* clear frequency count before
+ recompilation */
+
+ code->frequency = 0;
+
+ /* add this method to the method list
+ and start recompilation */
+
+ recompile_queue_method(m);
+ }
+ }
+ }
+ }
+ }
+
+ t = t->next;
+ } while ((t != NULL) && (t != mainthreadobj));
+ }
+}
+#endif
+
+
+/* profile_start_thread ********************************************************
+
+ Starts the profile sampling thread.
+
+*******************************************************************************/
+
+#if defined(ENABLE_THREADS)
+bool profile_start_thread(void)
+{
+ java_lang_Thread *t;
+
+ /* create the profile object */
+
+ profile_vmthread =
+ (java_lang_VMThread *) builtin_new(class_java_lang_VMThread);
+
+ if (profile_vmthread == NULL)
+ return false;
+
+ t = (java_lang_Thread *) builtin_new(class_java_lang_Thread);
+
+ t->vmThread = profile_vmthread;
+ t->name = javastring_new_from_ascii("Profiling Sampler");
+ t->daemon = true;
+ t->priority = 5;
+
+ profile_vmthread->thread = t;
+
+ /* actually start the profile sampling thread */
+
+ threads_start_thread(t, profile_thread);
+
+ /* everything's ok */
+
+ return true;
+}
+#endif
+
+
+/* profile_printstats **********************************************************
+
+ Prints profiling statistics gathered during runtime.
+
+*******************************************************************************/
+
+#if !defined(NDEBUG)
+void profile_printstats(void)
+{
+ list *l;
+ list_method_entry *lme;
+ list_method_entry *tlme;
+ classinfo *c;
+ methodinfo *m;
+ codeinfo *code;
+ u4 slot;
+ classcache_name_entry *nmen;
+ classcache_class_entry *clsen;
+ s4 i;
+ s4 j;
+ u4 frequency;
+ s8 cycles;
+
+ frequency = 0;
+ cycles = 0;
+
+ /* create new method list */
+
+ l = list_create(OFFSET(list_method_entry, linkage));
+
+ /* iterate through all classes and methods */
+
+ for (slot = 0; slot < hashtable_classcache.size; slot++) {
+ nmen = (classcache_name_entry *) hashtable_classcache.ptr[slot];
+
+ for (; nmen; nmen = nmen->hashlink) {
+ /* iterate over all class entries */
+
+ for (clsen = nmen->classes; clsen; clsen = clsen->next) {
+ c = clsen->classobj;
+
+ if (c == NULL)
+ continue;
+
+ /* interate over all class methods */
+
+ for (i = 0; i < c->methodscount; i++) {
+ m = &(c->methods[i]);
+
+ code = m->code;
+
+ /* was this method actually called? */
+
+ if ((code != NULL) && (code->frequency > 0)) {
+ /* add to overall stats */
+
+ 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);
+ }
+ else {
+ for (; tlme != NULL; tlme = list_next(l, tlme)) {
+ /* check the frequency */
+
+ if (code->frequency > tlme->m->code->frequency) {
+ list_add_before(l, tlme, lme);
+ break;
+ }
+ }
+
+ /* if we are at the end of the list, add
+ it as last entry */
+
+ if (tlme == NULL)
+ list_add_last(l, lme);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* print all methods sorted */
+
+ printf(" frequency ratio cycles ratio method name\n");
+ printf("----------- --------- -------------- --------- -------------\n");
+
+ /* now iterate through the list and print it */
+
+ for (lme = list_first(l); lme != NULL; lme = list_next(l, lme)) {
+ /* get method of the list element */
+
+ m = lme->m;
+
+ code = m->code;
+
+ printf("%10d %.5f %12ld %.5f ",
+ code->frequency,
+ (double) code->frequency / (double) frequency,
+ (long) code->cycles,
+ (double) code->cycles / (double) cycles);
+
+ method_println(m);
+
+ /* print basic block frequencies */
+
+ if (opt_prof_bb) {
+ for (j = 0; j < code->basicblockcount; j++)
+ printf(" L%03d: %10d\n",
+ j, code->bbfrequency[j]);
+ }
+ }
+
+ printf("----------- -------------- \n");
+ printf("%10d %12ld\n", frequency, (long) cycles);
+
+ printf("\nruns : %10d\n", runs);
+ printf("hits : %10d\n", hits);
+ printf("misses: %10d\n", misses);
+}
+#endif /* !defined(NDEBUG) */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
--- /dev/null
+/* src/vm/jit/profile.h - runtime profiling
+
+ 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, J. Wenninger, Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Contact: cacao@cacaojvm.org
+
+ Authors: Christian Thalinger
+
+ Changes:
+
+ $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $
+
+*/
+
+
+#ifndef _PROFILE_H
+#define _PROFILE_H
+
+#include "config.h"
+#include "vm/types.h"
+
+#include "vm/global.h"
+
+
+/* function prototypes ********************************************************/
+
+bool profile_init(void);
+bool profile_start_thread(void);
+
+#if !defined(NDEBUG)
+void profile_printstats(void);
+#endif
+
+#endif /* _PROFILE_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
--- /dev/null
+/* src/vm/jit/optimizing/recompile.c - recompilation system
+
+ 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, J. Wenninger, Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Contact: cacao@cacaojvm.org
+
+ Authors: Christian Thalinger
+
+ Changes:
+
+ $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $
+
+*/
+
+
+#include "config.h"
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include "vm/types.h"
+
+#include "mm/memory.h"
+#include "native/jni.h"
+#include "native/include/java_lang_Thread.h"
+#include "native/include/java_lang_VMThread.h"
+
+#if defined(ENABLE_THREADS)
+# include "threads/native/lock.h"
+# include "threads/native/threads.h"
+#endif
+
+#include "toolbox/list.h"
+#include "vm/builtin.h"
+#include "vm/classcache.h"
+#include "vm/exceptions.h"
+#include "vm/stringlocal.h"
+#include "vm/jit/optimizing/recompile.h"
+
+
+/* global variables ***********************************************************/
+
+static java_lang_VMThread *recompile_vmthread;
+static java_objectheader *lock_recompile_thread;
+static list *list_recompile_methods;
+
+
+/* recompile_init **************************************************************
+
+ Initializes the recompilation system.
+
+*******************************************************************************/
+
+bool recompile_init(void)
+{
+ /* initialize the recompile lock object */
+
+ lock_recompile_thread = NEW(java_objectheader);
+
+ lock_init_object_lock(lock_recompile_thread);
+
+ /* create method list */
+
+ list_recompile_methods = list_create(OFFSET(list_method_entry, linkage));
+
+ /* everything's ok */
+
+ return true;
+}
+
+
+/* recompile_replace_vftbl *****************************************************
+
+ XXX
+
+*******************************************************************************/
+
+static void recompile_replace_vftbl(methodinfo *m)
+{
+ codeinfo *code;
+ codeinfo *pcode;
+ u4 slot;
+ classcache_name_entry *nmen;
+ classcache_class_entry *clsen;
+ classinfo *c;
+ vftbl_t *vftbl;
+ s4 i;
+
+ /* get current and previous codeinfo structure */
+
+ code = m->code;
+ pcode = code->prev;
+
+ assert(pcode);
+
+ /* iterate over all classes */
+
+ for (slot = 0; slot < hashtable_classcache.size; slot++) {
+ nmen = (classcache_name_entry *) hashtable_classcache.ptr[slot];
+
+ for (; nmen; nmen = nmen->hashlink) {
+ /* iterate over all class entries */
+
+ for (clsen = nmen->classes; clsen; clsen = clsen->next) {
+ c = clsen->classobj;
+
+ if (c == NULL)
+ continue;
+
+ /* Search for entrypoint of the previous codeinfo in
+ the vftbl and replace it with the current one. */
+
+ vftbl = c->vftbl;
+
+ /* Is the class linked? Means, is the vftbl finished? */
+
+ if (!(c->state & CLASS_LINKED))
+ continue;
+
+ /* Does the class have a vftbl? Some internal classes
+ (e.g. $NEW$) are linked, but do not have a
+ vftbl. */
+
+ if (vftbl == NULL)
+ continue;
+
+ for (i = 0; i < vftbl->vftbllength; i++) {
+ if (vftbl->table[i] == pcode->entrypoint) {
+#if !defined(NDEBUG)
+ printf("replacing vftbl in: ");
+ class_println(c);
+#endif
+ vftbl->table[i] = code->entrypoint;
+ }
+ }
+ }
+ }
+ }
+}
+
+
+/* recompile_thread ************************************************************
+
+ XXX
+
+*******************************************************************************/
+
+static void recompile_thread(void)
+{
+ list_method_entry *lme;
+
+ while (true) {
+ /* get the lock on the recompile lock object, so we can call wait */
+
+ lock_monitor_enter(lock_recompile_thread);
+
+ /* wait forever (0, 0) on that object till we are signaled */
+
+ lock_wait_for_object(lock_recompile_thread, 0, 0);
+
+ /* leave the lock */
+
+ lock_monitor_exit(lock_recompile_thread);
+
+ /* get the next method and recompile it */
+
+ while ((lme = list_first(list_recompile_methods)) != NULL) {
+ /* recompile this method */
+
+ if (jit_recompile(lme->m) != NULL) {
+ /* replace in vftbl's */
+
+ recompile_replace_vftbl(lme->m);
+ }
+ else {
+ /* XXX what is the right-thing(tm) to do here? */
+
+ exceptions_print_exception(*exceptionptr);
+ }
+
+ /* remove the compiled method */
+
+ list_remove(list_recompile_methods, lme);
+
+ /* free the entry */
+
+ FREE(lme, list_method_entry);
+ }
+ }
+}
+
+
+/* recompile_start_thread ******************************************************
+
+ Starts the recompilation thread.
+
+*******************************************************************************/
+
+bool recompile_start_thread(void)
+{
+ java_lang_Thread *t;
+
+ /* create the profile object */
+
+ recompile_vmthread =
+ (java_lang_VMThread *) builtin_new(class_java_lang_VMThread);
+
+ if (recompile_vmthread == NULL)
+ return false;
+
+ t = (java_lang_Thread *) builtin_new(class_java_lang_Thread);
+
+ t->vmThread = recompile_vmthread;
+ t->name = javastring_new_from_ascii("Recompiler");
+ t->daemon = true;
+ t->priority = 5;
+
+ recompile_vmthread->thread = t;
+
+ /* actually start the recompilation thread */
+
+ threads_start_thread(t, recompile_thread);
+
+ /* everything's ok */
+
+ return true;
+}
+
+
+/* recompile_queue_method ******************************************************
+
+ Adds a method to the recompilation list and signal the
+ recompilation thread that there is some work to do.
+
+*******************************************************************************/
+
+void recompile_queue_method(methodinfo *m)
+{
+ list_method_entry *lme;
+
+ /* create a method entry */
+
+ lme = NEW(list_method_entry);
+ lme->m = m;
+
+ /* and add it to the list */
+
+ list_add_last(list_recompile_methods, lme);
+
+ /* get the lock on the recompile lock object, so we can call notify */
+
+ lock_monitor_enter(lock_recompile_thread);
+
+ /* signal the recompiler thread */
+
+ lock_notify_object(lock_recompile_thread);
+
+ /* leave the lock */
+
+ lock_monitor_exit(lock_recompile_thread);
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
--- /dev/null
+/* src/vm/jit/recompile.h - recompilation system
+
+ 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, J. Wenninger, Institut f. Computersprachen - TU Wien
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Contact: cacao@cacaojvm.org
+
+ Authors: Christian Thalinger
+
+ Changes:
+
+ $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $
+
+*/
+
+
+#ifndef _RECOMPILE_H
+#define _RECOMPILE_H
+
+#include "config.h"
+#include "vm/types.h"
+
+#include "vm/global.h"
+
+
+/* list_method_entry **********************************************************/
+
+typedef struct list_method_entry list_method_entry;
+
+struct list_method_entry {
+ methodinfo *m;
+ listnode linkage;
+};
+
+
+/* function prototypes ********************************************************/
+
+bool recompile_init(void);
+bool recompile_start_thread(void);
+
+void recompile_queue_method(methodinfo *m);
+
+#endif /* _PROFILE_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */
+++ /dev/null
-*.a
-*.o
-*.la
-*.lo
-.deps
-.libs
-Makefile
-Makefile.in
-TAGS
+++ /dev/null
-## src/vm/jit/profile/Makefile.am
-##
-## 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.
-##
-## This program is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License as
-## published by the Free Software Foundation; either version 2, or (at
-## your option) any later version.
-##
-## This program is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## General Public License for more details.
-##
-## 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., 51 Franklin Street, Fifth Floor, Boston, MA
-## 02110-1301, USA.
-##
-## Contact: cacao@cacaojvm.org
-##
-## Authors: Christian Thalinger
-##
-## Changes:
-##
-## $Id: Makefile.am 4357 2006-01-22 23:33:38Z twisti $
-
-## Process this file with automake to produce Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR) -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR)/$(OS_DIR)
-
-LIBS =
-
-noinst_LTLIBRARIES = \
- libprofile.la
-
-libprofile_la_SOURCES = \
- profile.c \
- profile.h
-
-
-## Local variables:
-## mode: Makefile
-## indent-tabs-mode: t
-## c-basic-offset: 4
-## tab-width: 8
-## compile-command: "automake --add-missing"
-## End:
+++ /dev/null
-/* src/vm/jit/profile.c - runtime profiling
-
- 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, J. Wenninger, Institut f. Computersprachen - TU Wien
-
- This file is part of CACAO.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- 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., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
- $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $
-
-*/
-
-
-#include "config.h"
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include "vm/types.h"
-
-#include "mm/memory.h"
-#include "native/jni.h"
-#include "native/include/java_lang_Thread.h"
-#include "native/include/java_lang_VMThread.h"
-
-#if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
-#endif
-
-#include "vm/builtin.h"
-#include "vm/class.h"
-#include "vm/classcache.h"
-#include "vm/method.h"
-#include "vm/options.h"
-#include "vm/stringlocal.h"
-#include "vm/jit/jit.h"
-#include "vm/jit/methodheader.h"
-#include "vm/jit/recompile.h"
-
-
-/* global variables ***********************************************************/
-
-#if defined(ENABLE_THREADS)
-static java_lang_VMThread *profile_vmthread;
-#endif
-
-
-/* profile_init ****************************************************************
-
- Initializes the profile global lock.
-
-*******************************************************************************/
-
-bool profile_init(void)
-{
- /* everything's ok */
-
- return true;
-}
-
-
-/* profile_thread **************************************************************
-
- XXX
-
-*******************************************************************************/
-
-static s4 runs = 0;
-static s4 hits = 0;
-static s4 misses = 0;
-
-#if defined(ENABLE_THREADS)
-static void profile_thread(void)
-{
- threadobject *t;
- s4 nanos;
- u1 *pc;
- u1 *pv;
- methodinfo *m;
- codeinfo *code;
-
- while (true) {
- /* sleep thread for 0.5-1.0 ms */
-
- nanos = 500 + (int) (500.0 * (rand() / (RAND_MAX + 1.0)));
-/* fprintf(stderr, "%d\n", nanos); */
-
- threads_sleep(0, nanos);
- runs++;
-
- /* iterate over all started threads */
-
- t = mainthreadobj;
-
- do {
- /* is this a Java thread? */
-
- if (t->flags & THREAD_FLAG_JAVA) {
- /* send SIGUSR2 to thread to get the current PC */
-
- pthread_kill(t->tid, SIGUSR2);
-
- /* the thread object now contains the current thread PC */
-
- pc = t->pc;
-
- /* get the PV for the current PC */
-
- pv = codegen_get_pv_from_pc_nocheck(pc);
-
- /* get methodinfo pointer from data segment */
-
- if (pv == NULL) {
- misses++;
- }
- else {
- code = *((codeinfo **) (pv + CodeinfoPointer));
-
- /* For asm_vm_call_method the codeinfo pointer is
- NULL (which is also in the method tree). */
-
- if (code != NULL) {
- m = code->m;
-
- /* native methods are never recompiled */
-
- if (!(m->flags & ACC_NATIVE)) {
- /* increase the method incovation counter */
-
- code->frequency++;
- hits++;
-
- if (code->frequency > 500) {
- /* clear frequency count before
- recompilation */
-
- code->frequency = 0;
-
- /* add this method to the method list
- and start recompilation */
-
- recompile_queue_method(m);
- }
- }
- }
- }
- }
-
- t = t->next;
- } while ((t != NULL) && (t != mainthreadobj));
- }
-}
-#endif
-
-
-/* profile_start_thread ********************************************************
-
- Starts the profile sampling thread.
-
-*******************************************************************************/
-
-#if defined(ENABLE_THREADS)
-bool profile_start_thread(void)
-{
- java_lang_Thread *t;
-
- /* create the profile object */
-
- profile_vmthread =
- (java_lang_VMThread *) builtin_new(class_java_lang_VMThread);
-
- if (profile_vmthread == NULL)
- return false;
-
- t = (java_lang_Thread *) builtin_new(class_java_lang_Thread);
-
- t->vmThread = profile_vmthread;
- t->name = javastring_new_from_ascii("Profiling Sampler");
- t->daemon = true;
- t->priority = 5;
-
- profile_vmthread->thread = t;
-
- /* actually start the profile sampling thread */
-
- threads_start_thread(t, profile_thread);
-
- /* everything's ok */
-
- return true;
-}
-#endif
-
-
-/* profile_printstats **********************************************************
-
- Prints profiling statistics gathered during runtime.
-
-*******************************************************************************/
-
-#if !defined(NDEBUG)
-void profile_printstats(void)
-{
- list *l;
- list_method_entry *lme;
- list_method_entry *tlme;
- classinfo *c;
- methodinfo *m;
- codeinfo *code;
- u4 slot;
- classcache_name_entry *nmen;
- classcache_class_entry *clsen;
- s4 i;
- s4 j;
- u4 frequency;
- s8 cycles;
-
- frequency = 0;
- cycles = 0;
-
- /* create new method list */
-
- l = list_create(OFFSET(list_method_entry, linkage));
-
- /* iterate through all classes and methods */
-
- for (slot = 0; slot < hashtable_classcache.size; slot++) {
- nmen = (classcache_name_entry *) hashtable_classcache.ptr[slot];
-
- for (; nmen; nmen = nmen->hashlink) {
- /* iterate over all class entries */
-
- for (clsen = nmen->classes; clsen; clsen = clsen->next) {
- c = clsen->classobj;
-
- if (c == NULL)
- continue;
-
- /* interate over all class methods */
-
- for (i = 0; i < c->methodscount; i++) {
- m = &(c->methods[i]);
-
- code = m->code;
-
- /* was this method actually called? */
-
- if ((code != NULL) && (code->frequency > 0)) {
- /* add to overall stats */
-
- 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);
- }
- else {
- for (; tlme != NULL; tlme = list_next(l, tlme)) {
- /* check the frequency */
-
- if (code->frequency > tlme->m->code->frequency) {
- list_add_before(l, tlme, lme);
- break;
- }
- }
-
- /* if we are at the end of the list, add
- it as last entry */
-
- if (tlme == NULL)
- list_add_last(l, lme);
- }
- }
- }
- }
- }
- }
-
- /* print all methods sorted */
-
- printf(" frequency ratio cycles ratio method name\n");
- printf("----------- --------- -------------- --------- -------------\n");
-
- /* now iterate through the list and print it */
-
- for (lme = list_first(l); lme != NULL; lme = list_next(l, lme)) {
- /* get method of the list element */
-
- m = lme->m;
-
- code = m->code;
-
- printf("%10d %.5f %12ld %.5f ",
- code->frequency,
- (double) code->frequency / (double) frequency,
- (long) code->cycles,
- (double) code->cycles / (double) cycles);
-
- method_println(m);
-
- /* print basic block frequencies */
-
- if (opt_prof_bb) {
- for (j = 0; j < code->basicblockcount; j++)
- printf(" L%03d: %10d\n",
- j, code->bbfrequency[j]);
- }
- }
-
- printf("----------- -------------- \n");
- printf("%10d %12ld\n", frequency, (long) cycles);
-
- printf("\nruns : %10d\n", runs);
- printf("hits : %10d\n", hits);
- printf("misses: %10d\n", misses);
-}
-#endif /* !defined(NDEBUG) */
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
+++ /dev/null
-/* src/vm/jit/profile.h - runtime profiling
-
- 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, J. Wenninger, Institut f. Computersprachen - TU Wien
-
- This file is part of CACAO.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- 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., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
- $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $
-
-*/
-
-
-#ifndef _PROFILE_H
-#define _PROFILE_H
-
-#include "config.h"
-#include "vm/types.h"
-
-#include "vm/global.h"
-
-
-/* function prototypes ********************************************************/
-
-bool profile_init(void);
-bool profile_start_thread(void);
-
-#if !defined(NDEBUG)
-void profile_printstats(void);
-#endif
-
-#endif /* _PROFILE_H */
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
+++ /dev/null
-/* src/vm/jit/recompile.c - recompilation system
-
- 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, J. Wenninger, Institut f. Computersprachen - TU Wien
-
- This file is part of CACAO.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- 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., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
- $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $
-
-*/
-
-
-#include "config.h"
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include "vm/types.h"
-
-#include "mm/memory.h"
-#include "native/jni.h"
-#include "native/include/java_lang_Thread.h"
-#include "native/include/java_lang_VMThread.h"
-
-#if defined(ENABLE_THREADS)
-# include "threads/native/lock.h"
-# include "threads/native/threads.h"
-#endif
-
-#include "toolbox/list.h"
-#include "vm/builtin.h"
-#include "vm/classcache.h"
-#include "vm/exceptions.h"
-#include "vm/stringlocal.h"
-#include "vm/jit/recompile.h"
-
-
-/* global variables ***********************************************************/
-
-static java_lang_VMThread *recompile_vmthread;
-static java_objectheader *lock_recompile_thread;
-static list *list_recompile_methods;
-
-
-/* recompile_init **************************************************************
-
- Initializes the recompilation system.
-
-*******************************************************************************/
-
-bool recompile_init(void)
-{
- /* initialize the recompile lock object */
-
- lock_recompile_thread = NEW(java_objectheader);
-
- lock_init_object_lock(lock_recompile_thread);
-
- /* create method list */
-
- list_recompile_methods = list_create(OFFSET(list_method_entry, linkage));
-
- /* everything's ok */
-
- return true;
-}
-
-
-/* recompile_replace_vftbl *****************************************************
-
- XXX
-
-*******************************************************************************/
-
-static void recompile_replace_vftbl(methodinfo *m)
-{
- codeinfo *code;
- codeinfo *pcode;
- u4 slot;
- classcache_name_entry *nmen;
- classcache_class_entry *clsen;
- classinfo *c;
- vftbl_t *vftbl;
- s4 i;
-
- /* get current and previous codeinfo structure */
-
- code = m->code;
- pcode = code->prev;
-
- assert(pcode);
-
- /* iterate over all classes */
-
- for (slot = 0; slot < hashtable_classcache.size; slot++) {
- nmen = (classcache_name_entry *) hashtable_classcache.ptr[slot];
-
- for (; nmen; nmen = nmen->hashlink) {
- /* iterate over all class entries */
-
- for (clsen = nmen->classes; clsen; clsen = clsen->next) {
- c = clsen->classobj;
-
- if (c == NULL)
- continue;
-
- /* Search for entrypoint of the previous codeinfo in
- the vftbl and replace it with the current one. */
-
- vftbl = c->vftbl;
-
- /* Is the class linked? Means, is the vftbl finished? */
-
- if (!(c->state & CLASS_LINKED))
- continue;
-
- /* Does the class have a vftbl? Some internal classes
- (e.g. $NEW$) are linked, but do not have a
- vftbl. */
-
- if (vftbl == NULL)
- continue;
-
- for (i = 0; i < vftbl->vftbllength; i++) {
- if (vftbl->table[i] == pcode->entrypoint) {
-#if !defined(NDEBUG)
- printf("replacing vftbl in: ");
- class_println(c);
-#endif
- vftbl->table[i] = code->entrypoint;
- }
- }
- }
- }
- }
-}
-
-
-/* recompile_thread ************************************************************
-
- XXX
-
-*******************************************************************************/
-
-static void recompile_thread(void)
-{
- list_method_entry *lme;
-
- while (true) {
- /* get the lock on the recompile lock object, so we can call wait */
-
- lock_monitor_enter(lock_recompile_thread);
-
- /* wait forever (0, 0) on that object till we are signaled */
-
- lock_wait_for_object(lock_recompile_thread, 0, 0);
-
- /* leave the lock */
-
- lock_monitor_exit(lock_recompile_thread);
-
- /* get the next method and recompile it */
-
- while ((lme = list_first(list_recompile_methods)) != NULL) {
- /* recompile this method */
-
- if (jit_recompile(lme->m) != NULL) {
- /* replace in vftbl's */
-
- recompile_replace_vftbl(lme->m);
- }
- else {
- /* XXX what is the right-thing(tm) to do here? */
-
- exceptions_print_exception(*exceptionptr);
- }
-
- /* remove the compiled method */
-
- list_remove(list_recompile_methods, lme);
-
- /* free the entry */
-
- FREE(lme, list_method_entry);
- }
- }
-}
-
-
-/* recompile_start_thread ******************************************************
-
- Starts the recompilation thread.
-
-*******************************************************************************/
-
-bool recompile_start_thread(void)
-{
- java_lang_Thread *t;
-
- /* create the profile object */
-
- recompile_vmthread =
- (java_lang_VMThread *) builtin_new(class_java_lang_VMThread);
-
- if (recompile_vmthread == NULL)
- return false;
-
- t = (java_lang_Thread *) builtin_new(class_java_lang_Thread);
-
- t->vmThread = recompile_vmthread;
- t->name = javastring_new_from_ascii("Recompiler");
- t->daemon = true;
- t->priority = 5;
-
- recompile_vmthread->thread = t;
-
- /* actually start the recompilation thread */
-
- threads_start_thread(t, recompile_thread);
-
- /* everything's ok */
-
- return true;
-}
-
-
-/* recompile_queue_method ******************************************************
-
- Adds a method to the recompilation list and signal the
- recompilation thread that there is some work to do.
-
-*******************************************************************************/
-
-void recompile_queue_method(methodinfo *m)
-{
- list_method_entry *lme;
-
- /* create a method entry */
-
- lme = NEW(list_method_entry);
- lme->m = m;
-
- /* and add it to the list */
-
- list_add_last(list_recompile_methods, lme);
-
- /* get the lock on the recompile lock object, so we can call notify */
-
- lock_monitor_enter(lock_recompile_thread);
-
- /* signal the recompiler thread */
-
- lock_notify_object(lock_recompile_thread);
-
- /* leave the lock */
-
- lock_monitor_exit(lock_recompile_thread);
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */
+++ /dev/null
-/* src/vm/jit/recompile.h - recompilation system
-
- 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, J. Wenninger, Institut f. Computersprachen - TU Wien
-
- This file is part of CACAO.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- 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., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
- $Id: cacao.c 4357 2006-01-22 23:33:38Z twisti $
-
-*/
-
-
-#ifndef _RECOMPILE_H
-#define _RECOMPILE_H
-
-#include "config.h"
-#include "vm/types.h"
-
-#include "vm/global.h"
-
-
-/* list_method_entry **********************************************************/
-
-typedef struct list_method_entry list_method_entry;
-
-struct list_method_entry {
- methodinfo *m;
- listnode linkage;
-};
-
-
-/* function prototypes ********************************************************/
-
-bool recompile_init(void);
-bool recompile_start_thread(void);
-
-void recompile_queue_method(methodinfo *m);
-
-#endif /* _PROFILE_H */
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- */