* src/mm/gc-common.h: Added.
* src/vm/builtin.c, src/vm/jit/mips/linux/md-os.c,
src/vm/jit/mips/irix/md-os.c, src/vm/jit/stacktrace.c, src/vm/vm.c,
src/native/tool/gennativetable.c, src/native/jni.c,
src/native/vm/gnu_java_lang_management_VMThreadMXBeanImpl.c,
src/native/vm/gnu_java_lang_management_VMMemoryMXBeanImpl.c,
src/native/vm/java_lang_VMObject.c, src/native/vm/java_lang_VMRuntime.c,
src/native/vm/gnu_java_lang_management_VMClassLoadingMXBeanImpl.c,
src/native/jvmti/jvmti.c, src/mm/nogc.c, src/mm/boehm.c, src/mm/memory.h,
src/threads/native/threads.c, src/cacaoh/headers.c, src/cacaoh/cacaoh.c:
Changed include from "mm/boehm.h" to "mm/gc-common.h"
* src/mm/Makefile.am: Added subdir and lib for cacao-gc
* src/mm/cacao-gc: Added.
* src/mm/cacao-gc/gc.c: Added.
* src/mm/cacao-gc/Makefile.am: Added.
* src/mm/cacao-gc/.cvsignore: Added.
* src/threads/native/threads.c: Fixed include of boehms gc.h
* src/vm/jit/mips/linux/md-os.c (md_init) [ENABLE_GC_BOEHM]: Added ifdef
for boehm specific call.
* src/vm/jit/mips/irix/md-os.c: Likewise.
* src/vm/signal.c: Likewise.
* configure.ac: Adapted buildsystem for new GC. Added cacao-gc.
--HG--
rename : src/mm/boehm.h => src/mm/gc-common.h
dnl check for garbage collector usage
-AC_MSG_CHECKING(whether GC should be disabled)
-AC_ARG_ENABLE([gc],
- [AS_HELP_STRING(--disable-gc,disable garbage collector (for debugging only!) [[default=yes]])],
- [case "${enableval}" in
- no) DISABLE_GC=yes
- AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
- ;;
- *) DISABLE_GC=no;;
- esac],
- [DISABLE_GC=no])
-AC_MSG_RESULT(${DISABLE_GC})
-AM_CONDITIONAL([DISABLE_GC], test x"${DISABLE_GC}" = "xyes")
+AC_ARG_ENABLE([gc], [AS_HELP_STRING(--enable-gc,enable garbage collector support (none,boehm,cacao) [[default=boehm]])])
+AC_MSG_CHECKING(whether GC should be enabled)
+enable_gc=${enable_gc:-boehm}
+case "$enable_gc" in
+no | none)
+ AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
+ ENABLE_GC=none
+ AC_MSG_RESULT(no)
+ ;;
+
+boehm)
+ AC_DEFINE([ENABLE_GC_BOEHM], 1, [enable conservative boehm-gc])
+ ENABLE_GC=boehm
+ AC_MSG_RESULT(yes, boehm-gc)
+ ;;
+
+cacao)
+ AC_DEFINE([ENABLE_GC_CACAO], 1, [enable exact cacao-gc])
+ ENABLE_GC=cacao
+ AC_MSG_RESULT(yes, cacao-gc)
+ ;;
+
+*)
+ AC_MSG_ERROR($enable_gc is an unknown garbage collector package)
+ ;;
+esac
+AM_CONDITIONAL([DISABLE_GC], test x"${ENABLE_GC}" = "xnone")
+AM_CONDITIONAL([ENABLE_GC_BOEHM], test x"${ENABLE_GC}" = "xboehm")
+AM_CONDITIONAL([ENABLE_GC_CACAO], test x"${ENABLE_GC}" = "xcacao")
dnl check for dump memory usage
[src/fdlibm/Makefile]
[src/lib/Makefile]
[src/mm/Makefile]
+ [src/mm/cacao-gc/Makefile]
[src/native/Makefile]
[src/native/include/Makefile]
[src/native/jvmti/Makefile]
Philipp Tomsich
Christian Thalinger
- $Id: cacaoh.c 5809 2006-10-20 13:09:54Z twisti $
+ $Id: cacaoh.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "vm/types.h"
#include "cacaoh/headers.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "native/include/java_lang_Throwable.h"
Christian Thalinger
Edwin Steiner
- $Id: headers.c 5868 2006-10-30 11:21:36Z edwin $
+ $Id: headers.c 5900 2006-11-04 17:30:44Z michi $
*/
# include <ucontext.h>
#endif
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "native/include/java_lang_String.h"
#include "native/include/java_lang_Throwable.h"
##
## Changes:
##
-## $Id: Makefile.am 5884 2006-10-31 20:11:28Z twisti $
+## $Id: Makefile.am 5900 2006-11-04 17:30:44Z michi $
## Process this file with automake to produce Makefile.in
LIBS =
DIST_SUBDIRS = \
- boehm-gc
+ boehm-gc \
+ cacao-gc
if DISABLE_GC
GC_FILE = \
nogc.c
-else
+endif
+
+if ENABLE_GC_BOEHM
SUBDIRS = \
boehm-gc
$(top_builddir)/src/mm/boehm-gc/libgc.la
endif
+if ENABLE_GC_CACAO
+SUBDIRS = \
+ cacao-gc
+
+GC_LIB = \
+ $(top_builddir)/src/mm/cacao-gc/libgc.la
+endif
+
noinst_LTLIBRARIES = \
libmm.la
libmm_la_SOURCES = \
$(GC_FILE) \
- boehm.h \
+ gc-common.h \
memory.c \
memory.h
Changes: Christian Thalinger
- $Id: boehm.c 5189 2006-07-31 12:25:09Z twisti $
+ $Id: boehm.c 5900 2006-11-04 17:30:44Z michi $
*/
#endif
#include "boehm-gc/include/gc.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#if defined(ENABLE_THREADS)
+++ /dev/null
-/* src/mm/boehm.h - interface for boehm gc header
-
- 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: boehm.h 5189 2006-07-31 12:25:09Z twisti $
-
-*/
-
-
-#ifndef _BOEHM_H
-#define _BOEHM_H
-
-#include "config.h"
-#include "vm/types.h"
-
-#include "vm/method.h"
-
-
-/* function prototypes ********************************************************/
-
-void gc_init(u4 heapmaxsize, u4 heapstartsize);
-
-void *heap_alloc_uncollectable(u4 bytelength);
-void *heap_allocate(u4 bytelength, u4 references, methodinfo *finalizer);
-void heap_free(void *p);
-
-void gc_call(void);
-s8 gc_get_heap_size(void);
-s8 gc_get_free_bytes(void);
-s8 gc_get_total_bytes(void);
-s8 gc_get_max_heap_size(void);
-void gc_invoke_finalizers(void);
-void gc_finalize_all(void);
-void *gc_out_of_memory(size_t bytes_requested);
-
-#if defined(DISABLE_GC)
-void nogc_init(u4 heapmaxsize, u4 heapstartsize);
-void *nogc_realloc(void *src, s4 len1, s4 len2);
-#endif
-
-#endif /* _BOEHM_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/mm/cacao-gc/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: Michael Starzinger
+##
+## $Id$
+
+## 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 = libgc.la
+
+libgc_la_SOURCES = \
+ gc.c \
+ gc.h \
+ heap.c
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
--- /dev/null
+/* src/mm/cacao-gc/gc.c - main garbage collector methods
+
+ 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: Michael Starzinger
+
+ Changes:
+
+ $Id$
+
+*/
+
+
+#include "config.h"
+#include <signal.h>
+#include <stdlib.h>
+#include "vm/types.h"
+
+#include "heap.h"
+#include "toolbox/logging.h"
+#include "vm/options.h"
+
+
+/* gc_init *********************************************************************
+
+ Initializes the garbage collector.
+
+*******************************************************************************/
+
+void gc_init(u4 heapmaxsize, u4 heapstartsize)
+{
+ if (opt_verbosegc)
+ dolog("GC: Initialising with heap-size %d (max. %d)",
+ heapstartsize, heapmaxsize);
+
+ heap_base = malloc(heapstartsize);
+
+ if (heap_base == NULL)
+ exceptions_throw_outofmemory_exit();
+
+ heap_current_size = heapstartsize;
+ heap_maximal_size = heapmaxsize;
+
+ dolog("GC: Got base pointer %p", heap_base);
+}
+
+
+void gc_call(void)
+{
+ if (opt_verbosegc)
+ dolog("GC: Forced Collection");
+}
+
+
+int GC_signum1()
+{
+ return SIGUSR1;
+}
+
+
+int GC_signum2()
+{
+ return SIGUSR2;
+}
+
+
+/*
+ * 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/mm/gc-common.h - gc independant interface for heap managment
+
+ 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: gc-common.h 5900 2006-11-04 17:30:44Z michi $
+
+*/
+
+
+#ifndef _GC_COMMON_H
+#define _GC_COMMON_H
+
+#include "config.h"
+#include "vm/types.h"
+
+#include "vm/method.h"
+
+
+/* function prototypes ********************************************************/
+
+void gc_init(u4 heapmaxsize, u4 heapstartsize);
+
+void *heap_alloc_uncollectable(u4 bytelength);
+void *heap_allocate(u4 bytelength, u4 references, methodinfo *finalizer);
+void heap_free(void *p);
+
+void gc_call(void);
+s8 gc_get_heap_size(void);
+s8 gc_get_free_bytes(void);
+s8 gc_get_total_bytes(void);
+s8 gc_get_max_heap_size(void);
+void gc_invoke_finalizers(void);
+void gc_finalize_all(void);
+void *gc_out_of_memory(size_t bytes_requested);
+
+#if defined(DISABLE_GC)
+void nogc_init(u4 heapmaxsize, u4 heapstartsize);
+void *nogc_realloc(void *src, s4 len1, s4 len2);
+#endif
+
+#endif /* _GC_COMMON_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:
+ */
Changes: Christian Thalinger
- $Id: memory.h 5868 2006-10-30 11:21:36Z edwin $
+ $Id: memory.h 5900 2006-11-04 17:30:44Z michi $
*/
/* internal includes **********************************************************/
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
/*
Changes:
- $Id: nogc.c 5868 2006-10-30 11:21:36Z edwin $
+ $Id: nogc.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "boehm-gc/include/gc.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "toolbox/logging.h"
#include "vm/options.h"
Christian Thalinger
Edwin Steiner
- $Id: jni.c 5821 2006-10-24 16:41:54Z edwin $
+ $Id: jni.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "vm/types.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "native/jni.h"
#include "native/native.h"
Samuel Vinson
Christan Thalinger
- $Id: jvmti.c 5806 2006-10-19 10:10:23Z twisti $
+ $Id: jvmti.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "vm/jit/asmpart.h"
#include "vm/class.h"
#include "vm/classcache.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "toolbox/logging.h"
#include "vm/options.h"
#include "vm/stringlocal.h"
Changes:
- $Id: gennativetable.c 5638 2006-10-02 18:04:37Z twisti $
+ $Id: gennativetable.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "vm/types.h"
#include "cacaoh/headers.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#if defined(ENABLE_THREADS)
#include "config.h"
#include "vm/types.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "native/jni.h"
#include "config.h"
#include "vm/types.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "native/jni.h"
#include "native/include/java_lang_management_MemoryUsage.h"
#include "config.h"
#include "vm/types.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "native/jni.h"
#include "native/include/java_lang_management_ThreadInfo.h"
Changes: Joseph Wenninger
Christian Thalinger
- $Id: java_lang_VMObject.c 5153 2006-07-18 08:19:24Z twisti $
+ $Id: java_lang_VMObject.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "vm/types.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "toolbox/logging.h"
#include "native/jni.h"
Christian Thalinger
Edwin Steiner
- $Id: java_lang_VMRuntime.c 5153 2006-07-18 08:19:24Z twisti $
+ $Id: java_lang_VMRuntime.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "vm/types.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "native/jni.h"
#include "native/native.h"
Changes: Christian Thalinger
Edwin Steiner
- $Id: threads.c 5884 2006-10-31 20:11:28Z twisti $
+ $Id: threads.c 5900 2006-11-04 17:30:44Z michi $
*/
# include "threads/native/generic-primitives.h"
#endif
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "native/native.h"
#include "native/include/java_lang_Object.h"
# define GC_IRIX_THREADS
# endif
# include <semaphore.h>
-# include "mm/boehm-gc/include/gc.h"
+# if defined(ENABLE_GC_BOEHM)
+# include "mm/boehm-gc/include/gc.h"
+# endif
#endif
#if defined(ENABLE_JVMTI)
calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 5862 2006-10-30 00:45:30Z edwin $
+ $Id: builtin.c 5900 2006-11-04 17:30:44Z michi $
*/
# undef Bias
#endif
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "native/native.h"
#include "native/include/java_lang_Cloneable.h"
Changes: Christian Thalinger
- $Id: md-os.c 4921 2006-05-15 14:24:36Z twisti $
+ $Id: md-os.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "vm/jit/mips/md-abi.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "vm/exceptions.h"
#include "vm/global.h"
#include "vm/signallocal.h"
/* The Boehm GC initialization blocks the SIGSEGV signal. So we do a */
/* dummy allocation here to ensure that the GC is initialized. */
+#if defined(ENABLE_GC_BOEHM)
heap_allocate(1, 0, NULL);
+#endif
/* Turn off flush-to-zero */
Changes: Christian Thalinger
- $Id: md-os.c 5748 2006-10-12 13:13:18Z twisti $
+ $Id: md-os.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "vm/jit/mips/md-abi.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "vm/exceptions.h"
#include "vm/signallocal.h"
#include "vm/stringlocal.h"
/* The Boehm GC initialization blocks the SIGSEGV signal. So we do a */
/* dummy allocation here to ensure that the GC is initialized. */
+#if defined(ENABLE_GC_BOEHM)
heap_allocate(1, 0, NULL);
+#endif
#if 0
/* Turn off flush-to-zero */
Changes: Christian Thalinger
Edwin Steiner
- $Id: stacktrace.c 5805 2006-10-19 09:32:29Z twisti $
+ $Id: stacktrace.c 5900 2006-11-04 17:30:44Z michi $
*/
#include "vm/types.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "native/native.h"
Changes:
- $Id: signal.c 5809 2006-10-20 13:09:54Z twisti $
+ $Id: signal.c 5900 2006-11-04 17:30:44Z michi $
*/
/* Allocate something so the garbage collector's signal handlers
are installed. */
+#if defined(ENABLE_GC_BOEHM)
(void) GCNEW(u1);
+#endif
/* install signal handlers we need to convert to exceptions */
#include "vm/types.h"
-#include "mm/boehm.h"
+#include "mm/gc-common.h"
#include "mm/memory.h"
#include "native/jni.h"
#include "native/native.h"