fix bigtime gc bug

cvs
Slava Pestov 2004-08-10 04:58:52 +00:00
parent c737ea4379
commit d3a0945196
8 changed files with 28 additions and 9 deletions

View File

@ -43,6 +43,7 @@
+ listener:
- backspace overzealous
- fedit broken with listener
- maple-like: press enter at old commands to evaluate there

View File

@ -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

View 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

View File

@ -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

View 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"

View 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"

View 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);

View 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));
}