Static class references are now explicitly added to the rootset.
authormichi <none@none>
Tue, 6 Mar 2007 10:28:12 +0000 (10:28 +0000)
committermichi <none@none>
Tue, 6 Mar 2007 10:28:12 +0000 (10:28 +0000)
* src/mm/cacao-gc/rootset.c (rootset_from_classes): Added.
* src/mm/cacao-gc/rootset.h (REFTYPE_CLASSREF): Added.

--HG--
branch : exact-gc

configure.ac
src/mm/cacao-gc/rootset.c
src/mm/cacao-gc/rootset.h
src/vm/builtin.h
src/vm/jit/codegen-common.c
src/vm/jit/i386/asmpart.S
src/vm/jit/i386/emit.c
src/vm/jit/x86_64/emit.c
src/vmcore/classcache.c
tests/regression/Makefile.am

index 05284e9099bc4a68726a95941f2c8a17c058d101..c2ca770c0ffaab9c23037250ded6543161a94b36 100644 (file)
@@ -22,7 +22,7 @@ dnl along with this program; if not, write to the Free Software
 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.
 
index 1cd9b826d25e652f241c1bda04566de54e0e75a9..4ae074fd43ea509bb399bec54ce2bdc6e119c235 100644 (file)
@@ -168,6 +168,56 @@ void rootset_from_globals(rootset_t *rs)
 }
 
 
+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
@@ -276,6 +326,7 @@ rootset_t *rootset_readout()
        /* 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;
@@ -343,7 +394,9 @@ void rootset_writeback(rootset_t *rs)
 
 #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)
index af70efb885ebf15698e79efc4afb3cc5719e6d9f..758467ac7be2a64f76aa7701f87963f71069ddc0 100644 (file)
@@ -52,7 +52,7 @@ typedef struct rootset_t rootset_t;
 /* 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
@@ -60,6 +60,7 @@ typedef struct rootset_t rootset_t;
 #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 */
index 3fa01fefb8e6afb92f5fd5df9f57c3dddfcc655f..a1e9b983963b8f5cf271c7c2b80e64f2b44a2806 100644 (file)
@@ -22,7 +22,7 @@
    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 $
 
 */
 
index 7496334bfe433a2e565c69c267835dc137db518b..f46d0d9cab33ec174a5b454e736fc4d823593f6f 100644 (file)
@@ -39,7 +39,7 @@
    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 $
 
 */
 
index 05d1d0199b6c1ee2ebe05b94e1f89f3a2efd8687..92f75974ef7cdd67ef3d2a6a6d9870ac88bb2068 100644 (file)
@@ -22,7 +22,7 @@
    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 $
 
 */
 
index e41b296a11e09fdb497e16643ff9bd14e0657359..215b53643d27fe1afe79f8d0b8b0ac9831d29b24 100644 (file)
@@ -22,7 +22,7 @@
    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 $
 
 */
 
index b7d792f7fe33de27915169a429964c8c69f9fde4..6406a1bbd57a0a741b64489794d6da064d6469f6 100644 (file)
@@ -22,7 +22,7 @@
    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 $
 
 */
 
index 11a6669078b793583b96bea78ce96426e4fb214e..1a9c7d8699e8ed896dd3f1f93021247a2b96f35c 100644 (file)
@@ -22,7 +22,7 @@
    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 $
 
 */
 
index 6a32c19c729b5aecb32c238a3df6d7dff52d5ce3..c02f75e31cb44e9ccb4ec15f13e749b5d18988c1 100644 (file)
@@ -26,7 +26,7 @@
 ##
 ## 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