[add rts/test directory
John Meacham <john@repetae.net>**20120212004706
 Ignore-this: 1e6d0cb4ba809a1d6089d04704d5a60f
] move ./src/data/HsFFI.h ./rts/HsFFI.h
adddir ./rts/test
hunk ./Makefile.am 96
-	$(INSTALL_DATA) "$(srcdir)/src/data/HsFFI.h" $(DESTDIR)$(datadir)/@PACKAGE@-@SHORTVERSION@/include
+	$(INSTALL_DATA) "$(srcdir)/rts/HsFFI.h" $(DESTDIR)$(datadir)/@PACKAGE@-@SHORTVERSION@/include
hunk ./Makefile.am 113
-	   src/data/targets.ini rts/rts_constants.h rts/stableptr.c rts/queue.h src/data/HsFFI.h \
+	   src/data/targets.ini rts/rts_constants.h rts/stableptr.c rts/queue.h rts/HsFFI.h \
hunk ./rts/jhc_jgc.c 80
-        VALGRIND_MAKE_MEM_DEFINED(s,S_BLOCK(s)->pi.size * sizeof(uintptr_t));
+        VALGRIND_MAKE_MEM_DEFINED(s,(S_BLOCK(s))->pi.size * sizeof(uintptr_t));
hunk ./rts/slub.c 6
-#define S_BLOCK(val) (struct s_block *)((uintptr_t)(val) & ~ (BLOCK_SIZE - 1))
+#define S_BLOCK(val) ((struct s_block *)((uintptr_t)(val) & ~ (BLOCK_SIZE - 1)))
hunk ./rts/slub.c 351
-#ifdef SLAB_TEST
-
-#define NUM_CACHES 15
-#define FACTOR (1 << 16)
-
-void
-stress_test(int n) {
-        struct s_arena *arena = new_arena();
-        struct s_cache *caches[NUM_CACHES];
-
-        void *ptrs[n];
-        memset(ptrs,0,n*sizeof(void *));
-        for(int i = 0; i < NUM_CACHES; i++)
-                caches[i] = new_cache(arena,sizeof(void *)*(i + 1), 0);
-        for(int i = 0; i < FACTOR * n; i++) {
-                int wp = rand() % n;
-                if (ptrs[wp]) {
-                        s_free(ptrs[wp]);
-                        //free(ptrs[wp]);
-                        ptrs[wp] = NULL;
-                } else {
-                        ptrs[wp] = s_alloc(caches[rand() % NUM_CACHES]);
-                        //ptrs[wp] = malloc((rand() % NUM_CACHES) * sizeof(uintptr_t));
-                }
-        }
-}
-
-int
-main(int argc, char *argv[])
-{
-
-        setbuf(stdout,NULL);
-        stress_test(1 << 8);
-        struct s_arena *arena = new_arena();
-        for(int i = 0;i < 10; i++) {
-        struct s_cache *sc = new_cache(arena,i,0);
-        print_cache(sc);
-        }
-        struct s_cache *sc1 = new_cache(arena,7,4);
-        struct s_cache *sc2 = new_cache(arena,1,3);
-
-        printf("Alloc1: %p\n", s_alloc(sc1));
-        printf("Alloc1: %p\n", s_alloc(sc1));
-        printf("Alloc1: %p\n", s_alloc(sc1));
-        printf("Alloc2: %p\n", s_alloc(sc2));
-        printf("Alloc2: %p\n", s_alloc(sc2));
-        printf("Alloc2: %p\n", s_alloc(sc2));
-
-        print_cache(sc1);
-        print_cache(sc2);
-
-        return 0;
-}
-
-#endif
addfile ./rts/test/Makefile
hunk ./rts/test/Makefile 1
+# tests of the rts
+
+CFLAGS=-I.. -I../.. -std=gnu99 -g -O2
+
+slab_test: slab_test.c
+
+clean:
+	rm -f slab_test
addfile ./rts/test/slab_test.c
hunk ./rts/test/slab_test.c 1
+char jhc_c_compile[] = "(compile)";
+char jhc_command[] = "(command)";
+char jhc_version[] = "(version)";
+
+#define JHC_VALGRIND 1
+
+#define _JHC_STANDALONE 0
+#define _JHC_GC _JHC_GC_JGC
+
+#include "jhc_rts_header.h"
+#include "jhc_jgc.h"
+#include "debug.c"
+#include "jhc_rts_alloc.c"
+#include "jhc_rts.c"
+#include "profile.c"
+#include "jhc_rts2.c"
+#include "slub.c"
+#include "jhc_jgc.c"
+
+#define NUM_CACHES 15
+#define FACTOR (1 << 16)
+
+static void jhc_hs_init(void) {}
+static const void * const nh_stuff[] = { NULL };
+
+void
+stress_test(int n) {
+        jhc_alloc_init();
+        struct s_arena *arena = new_arena();
+        struct s_cache *caches[NUM_CACHES];
+
+        void *ptrs[n];
+        memset(ptrs,0,n*sizeof(void *));
+        for(int i = 0; i < NUM_CACHES; i++)
+                caches[i] = new_cache(arena,sizeof(void *)*(i + 1), 0);
+        for(int i = 0; i < FACTOR * n; i++) {
+                int wp = rand() % n;
+                if (ptrs[wp]) {
+                        //s_free(ptrs[wp]);
+                        //free(ptrs[wp]);
+                        ptrs[wp] = NULL;
+                } else {
+                        ptrs[wp] = s_alloc(saved_gc, caches[rand() % NUM_CACHES]);
+                        //ptrs[wp] = malloc((rand() % NUM_CACHES) * sizeof(uintptr_t));
+                }
+        }
+}
+
+int
+main(int argc, char *argv[])
+{
+
+        setbuf(stdout,NULL);
+        stress_test(1 << 2);
+        struct s_arena *arena = new_arena();
+        for(int i = 0;i < 10; i++) {
+        struct s_cache *sc = new_cache(arena,i,0);
+        print_cache(sc);
+        }
+        struct s_cache *sc1 = new_cache(arena,7,4);
+        struct s_cache *sc2 = new_cache(arena,1,3);
+
+        printf("Alloc1: %p\n", s_alloc(saved_gc, sc1));
+        printf("Alloc1: %p\n", s_alloc(saved_gc, sc1));
+        printf("Alloc1: %p\n", s_alloc(saved_gc, sc1));
+        printf("Alloc2: %p\n", s_alloc(saved_gc, sc2));
+        printf("Alloc2: %p\n", s_alloc(saved_gc, sc2));
+        printf("Alloc2: %p\n", s_alloc(saved_gc, sc2));
+
+        print_cache(sc1);
+        print_cache(sc2);
+
+        return 0;
+}