]> gitweb.factorcode.org Git - factor.git/commitdiff
fix bigtime gc bug
authorSlava Pestov <slava@factorcode.org>
Tue, 10 Aug 2004 04:58:52 +0000 (04:58 +0000)
committerSlava Pestov <slava@factorcode.org>
Tue, 10 Aug 2004 04:58:52 +0000 (04:58 +0000)
TODO.FACTOR.txt
build.sh
library/test/continuations.factor
library/test/garbage-collection.factor [new file with mode: 0644]
library/test/test.factor
native/factor.h
native/gc.c
native/sbuf.c

index 1342ee2929824d7fc3c01fd501e1fde58fcd1497..095c7e3b7a17e9761fa92535f6da5aabed96bb1d 100644 (file)
@@ -43,6 +43,7 @@
 \r
 + listener:\r
 \r
+- backspace overzealous\r
 - fedit broken with listener\r
 - maple-like: press enter at old commands to evaluate there\r
 \r
index 17045a1bfbf42c6006939182486de7c551cfb93f..2980a4bbedbef142d710dc36295764963d7f5f61 100644 (file)
--- a/build.sh
+++ b/build.sh
@@ -4,8 +4,3 @@ export CFLAGS="-lm -pedantic -Wall -Winline -O3 -march=pentium4 -fomit-frame-poi
 $CC $CFLAGS -o f native/*.c
 
 strip f
-
-#export CC=gcc
-#export CFLAGS="-pedantic -Wall -g"
-#
-#$CC $CFLAGS -o f-debug native/*.c
index 02da3f3b52ae38cfd1501f28cf3b27db4b59fe35..a39fb6ed69362832ffc2f0922ba1e1cbd16f536d 100644 (file)
@@ -28,3 +28,6 @@ USE: test
 
 [ t ] [ 10 callcc1-test 10 count = ] unit-test
 [ t ] [ callcc-namespace-test ] unit-test
+
+! This caused the Java Factor to run out of memory
+[ ] [ 10000 [ [ call ] callcc0 ] times ] unit-test
diff --git a/library/test/garbage-collection.factor b/library/test/garbage-collection.factor
new file mode 100644 (file)
index 0000000..b449fde
--- /dev/null
@@ -0,0 +1,15 @@
+IN: scratchpad
+USE: kernel
+USE: namespaces
+USE: parser
+USE: strings
+USE: test
+
+! Various things that broke the CFactor GC at various times.
+! This should run without issue (and tests nothing useful)
+! in Java Factor
+
+! This was bloody stupid of me
+"20 <sbuf> \"foo\" set" eval
+"garbage-collection" eval
+
index 435e401cd8bd5f976a451dc9821a62da8283be7d..7eb454da35ab1ae60b69fefdbd36e8db9f21c683 100644 (file)
@@ -51,6 +51,7 @@ USE: vocabularies
     "Running Factor test suite..." print
     "vocabularies" get [ f "scratchpad" set ] bind
     [
+        "garbage-collection"
         "lists/cons"
         "lists/lists"
         "lists/assoc"
index d7f1941cd899cc9e65065d9108be058ef4fcf3bc..3e80e397b4b705b2996dc826cf3eb5f8c530048f 100644 (file)
@@ -33,7 +33,7 @@ typedef unsigned char BYTE;
 #define BYTES 1
 
 /* Memory heap size */
-#define DEFAULT_ARENA (128 * 1024 * 1024)
+#define DEFAULT_ARENA (32 * 1024 * 1024)
 #define STACK_SIZE 1024
 
 #include "error.h"
index 653622b6997965a4d8d7c15d3d7a787712e4ae7b..d692fda49433fce5ef6e9e992b58692722e68739 100644 (file)
@@ -10,7 +10,7 @@ INLINE void gc_debug(char* msg, CELL x) {
 #endif
 }
 
-/* Given a pointer to a pointer to oldspace, copy it to newspace. */
+/* Given a pointer to oldspace, copy it to newspace. */
 void* copy_untagged_object(void* pointer, CELL size)
 {
        void* newpointer = allot(size);
@@ -48,6 +48,11 @@ void copy_object(CELL* handle)
                newpointer = UNTAG(header);
                gc_debug("FORWARDING",newpointer);
        }
+       else if(TAG(pointer) == GC_COLLECTED)
+       {
+               critical_error("asked to copy forwarding pointer",pointer);
+               newpointer = 0; /* to shut up gcc */
+       }
        else
        {
                gc_debug("copy_object",pointer);
index 86f9a2f154051eb354fd83ab41ad46fd6c071dcc..5c8383ac2ff2948e52ad47e612b5df9703e7b72c 100644 (file)
@@ -129,6 +129,5 @@ void fixup_sbuf(SBUF* sbuf)
 
 void collect_sbuf(SBUF* sbuf)
 {
-       sbuf->string = copy_untagged_object(sbuf->string,
-               sizeof(sbuf->string) + sbuf->string->capacity);
+       sbuf->string = copy_untagged_object(sbuf->string,SSIZE(sbuf->string));
 }