* src/mm/cacao-gc/rootset.c (rootset_from_classes): Added.
* src/mm/cacao-gc/rootset.h (REFTYPE_CLASSREF): Added.
--HG--
branch : exact-gc
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
-dnl $Id: configure.ac 7441 2007-03-02 23:13:10Z michi $
+dnl $Id: configure.ac 7434 2007-03-02 19:44:53Z edwin $
dnl Process this file with autoconf to produce a configure script.
}
+void rootset_from_classes(rootset_t *rs)
+{
+ classinfo *c;
+ fieldinfo *f;
+ void *sys_start, *sys_end;
+ int refcount;
+ int i;
+
+ GC_LOG( dolog("GC: Acquiring Root-Set from classes ..."); );
+
+ /* TODO: cleanup!!! */
+ sys_start = heap_region_sys->base;
+ sys_end = heap_region_sys->ptr;
+
+ refcount = rs->refcount;
+
+ /* walk through all classinfo blocks */
+ for (c = sys_start; c < (classinfo *) sys_end; c++) {
+
+ GC_LOG2( printf("Searching in class "); class_print(c); printf("\n"); );
+
+ /* walk through all fields */
+ f = c->fields;
+ for (i = 0; i < c->fieldscount; i++, f++) {
+
+ /* check if this is a static reference */
+ if (!IS_ADR_TYPE(f->type) || !(f->flags & ACC_STATIC))
+ continue;
+
+ /* check for outside or null pointers */
+ if (f->value.a == NULL)
+ continue;
+
+ GC_LOG2( printf("Found Static Field Reference: %p\n", (void *) f->value.a);
+ printf("\tfrom field: "); field_print(f); printf("\n");
+ printf("\tto object : "); heap_print_object(f->value.a); printf("\n"); );
+
+ /* add this static field reference to the root set */
+ ROOTSET_ADD(&( f->value ), true, REFTYPE_CLASSREF);
+
+ }
+
+ }
+
+ /* remeber how many references there are inside this root set */
+ rs->refcount = refcount;
+
+}
+
+
/* rootset_from_thread *********************************************************
Searches the stack of the passed thread for references and compiles a
/* find the global rootset ... */
rs_top = rootset_create();
rootset_from_globals(rs_top);
+ rootset_from_classes(rs_top);
/* ... and the rootsets for the threads */
rs = rs_top;
#if !defined(NDEBUG)
const char* ref_type_names[] = {
- "XXXXXX", "THREAD", "CLASSL", "GLOBAL", "FINAL ", "LOCAL ", "STACK "
+ "XXXXXX", "THREAD", "CLASSL",
+ "GLOBAL", "FINAL ", "LOCAL ",
+ "STACK ", "STATIC"
};
void rootset_print(rootset_t *rs)
/* Structures *****************************************************************/
#define ROOTSET_DUMMY_THREAD ((threadobject *) (ptrint) -1)
-#define RS_REFS 32
+#define RS_REFS 512 /* TODO: you see why we need to rethink this!!! */
#define REFTYPE_THREADOBJECT 1
#define REFTYPE_CLASSLOADER 2
#define REFTYPE_FINALIZER 4
#define REFTYPE_LOCALREF 5
#define REFTYPE_STACK 6
+#define REFTYPE_CLASSREF 7
/* rootset is passed as array of pointers, which point to the location of
the reference */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: builtin.h 7356 2007-02-14 11:00:28Z twisti $
+ $Id: builtin.h 7316 2007-02-10 19:06:54Z twisti $
*/
memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen-common.c 7407 2007-02-26 19:12:03Z michi $
+ $Id: codegen-common.c 7403 2007-02-25 21:31:58Z pm $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7355 2007-02-14 10:57:32Z twisti $
+ $Id: asmpart.S 7310 2007-02-09 13:00:04Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: emit.c 7356 2007-02-14 11:00:28Z twisti $
+ $Id: emit.c 7316 2007-02-10 19:06:54Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: emit.c 7356 2007-02-14 11:00:28Z twisti $
+ $Id: emit.c 7317 2007-02-11 00:02:54Z twisti $
*/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: classcache.c 7441 2007-03-02 23:13:10Z michi $
+ $Id: classcache.c 7435 2007-03-02 19:45:42Z edwin $
*/
##
## Authors: Christian Thalinger
##
-## $Id: Makefile.am 7441 2007-03-02 23:13:10Z michi $
+## $Id: Makefile.am 7433 2007-03-02 19:42:13Z edwin $
## Process this file with automake to produce Makefile.in