Remove unused environment slot and simply room primitive

slava 2006-11-01 19:29:58 +00:00
parent c41d7e19f6
commit b571e6fb0d
9 changed files with 13 additions and 42 deletions

View File

@ -66,12 +66,10 @@ IN: compiler
{ +clobber+ { "n" } } { +clobber+ { "n" } }
} define-intrinsic } define-intrinsic
: card-offset 1 getenv ; inline
: generate-write-barrier ( -- ) : generate-write-barrier ( -- )
#! Mark the card pointed to by vreg. #! Mark the card pointed to by vreg.
"obj" operand card-bits SHR "obj" operand card-bits SHR
"obj" operand card-offset ADD rel-absolute-cell rel-cards "obj" operand HEX: ffff ADD rel-absolute-cell rel-cards
"obj" operand [] card-mark OR ; "obj" operand [] card-mark OR ;
\ set-slot [ \ set-slot [

View File

@ -92,7 +92,7 @@ IN: kernel-internals
: num-tags 8 ; inline : num-tags 8 ; inline
: tag-bits 3 ; inline : tag-bits 3 ; inline
: cell ( -- n ) 17 getenv ; foldable : cell ( -- n ) 1 getenv ; foldable
: fixnum-tag BIN: 000 ; inline : fixnum-tag BIN: 000 ; inline
: bignum-tag BIN: 001 ; inline : bignum-tag BIN: 001 ; inline

View File

@ -28,7 +28,7 @@ strings styles vectors words ;
: room. ( -- ) : room. ( -- )
[ [
{ "" "Total" "Used" "Free" } , { "" "Total" "Used" "Free" } ,
data-room 0 [ data-room 2 group 0 [
"Generation " pick number>string append "Generation " pick number>string append
>r first2 r> total/used/free, 1+ >r first2 r> total/used/free, 1+
] reduce drop ] reduce drop

View File

@ -257,8 +257,8 @@ void recursive_mark(CELL xt)
/* Push the free space and total size of the code heap */ /* Push the free space and total size of the code heap */
void primitive_code_room(void) void primitive_code_room(void)
{ {
box_unsigned_cell(heap_free_space(&compiling)); dpush(tag_fixnum(heap_free_space(&compiling) / 1024));
box_unsigned_cell(compiling.limit - compiling.base); dpush(tag_fixnum((compiling.limit - compiling.base) / 1024);
} }
/* Perform a code GC */ /* Perform a code GC */

View File

@ -82,29 +82,17 @@ void primitive_size(void)
/* Push memory usage statistics in data heap */ /* Push memory usage statistics in data heap */
void primitive_data_room(void) void primitive_data_room(void)
{ {
F_ARRAY *a = allot_array(ARRAY_TYPE,gen_count * 2,F);
int gen; int gen;
box_unsigned_cell(cards_end - cards); dpush(tag_fixnum((cards_end - cards) >> 10));
box_unsigned_cell(prior.limit - prior.base); dpush(tag_fixnum((prior.limit - prior.base) >> 10));
for(gen = 0; gen < gen_count; gen++) for(gen = 0; gen < gen_count; gen++)
{ {
F_ZONE *z = &generations[gen]; F_ZONE *z = &generations[gen];
CELL used = allot_cell(z->limit - z->here); put(AREF(a,gen * 2),tag_fixnum((z->limit - z->here) >> 10));
REGISTER_ROOT(used); put(AREF(a,gen * 2 + 1),tag_fixnum((z->limit - z->base) >> 10));
CELL total = allot_cell(z->limit - z->base);
UNREGISTER_ROOT(used);
CELL pair = allot_array_2(used,total);
REGISTER_ROOT(pair);
}
F_ARRAY *a = allot_array(ARRAY_TYPE,gen_count,F);
for(gen = gen_count - 1; gen >= 0; gen--)
{
CELL pair;
UNREGISTER_ROOT(pair);
put(AREF(a,gen),pair);
} }
dpush(tag_object(a)); dpush(tag_object(a));

View File

@ -23,7 +23,6 @@ void init_factor(const char* image,
userenv[CPU_ENV] = tag_object(from_char_string(FACTOR_CPU_STRING)); userenv[CPU_ENV] = tag_object(from_char_string(FACTOR_CPU_STRING));
userenv[OS_ENV] = tag_object(from_char_string(FACTOR_OS_STRING)); userenv[OS_ENV] = tag_object(from_char_string(FACTOR_OS_STRING));
userenv[GEN_ENV] = tag_fixnum(gen_count); userenv[GEN_ENV] = tag_fixnum(gen_count);
userenv[CARD_OFF_ENV] = allot_cell(cards_offset);
userenv[IMAGE_ENV] = tag_object(from_char_string(image)); userenv[IMAGE_ENV] = tag_object(from_char_string(image));
userenv[CELL_SIZE_ENV] = tag_fixnum(sizeof(CELL)); userenv[CELL_SIZE_ENV] = tag_fixnum(sizeof(CELL));
} }

View File

@ -12,8 +12,8 @@ CELL callframe_end;
#define USER_ENV 32 #define USER_ENV 32
#define CARD_OFF_ENV 1 /* for compiling set-slot */ #define CELL_SIZE_ENV 1 /* sizeof(CELL) */
#define NLX_VECTOR_ENV 2 /* non-local exit hook */ #define NLX_VECTOR_ENV 2 /* non-local exit hook, used by library only */
#define NAMESTACK_ENV 3 /* used by library only */ #define NAMESTACK_ENV 3 /* used by library only */
#define GLOBAL_ENV 4 #define GLOBAL_ENV 4
#define BREAK_ENV 5 #define BREAK_ENV 5
@ -28,7 +28,6 @@ CELL callframe_end;
#define OUT_ENV 14 #define OUT_ENV 14
#define GEN_ENV 15 /* set to gen_count */ #define GEN_ENV 15 /* set to gen_count */
#define IMAGE_ENV 16 /* image name */ #define IMAGE_ENV 16 /* image name */
#define CELL_SIZE_ENV 17 /* sizeof(CELL) */
/* TAGGED user environment data; see getenv/setenv prims */ /* TAGGED user environment data; see getenv/setenv prims */
DLLEXPORT CELL userenv[USER_ENV]; DLLEXPORT CELL userenv[USER_ENV];

View File

@ -65,18 +65,6 @@ void primitive_byte_array(void)
dpush(tag_object(allot_byte_array(size))); dpush(tag_object(allot_byte_array(size)));
} }
CELL allot_array_2(CELL v1, CELL v2)
{
REGISTER_ROOT(v1);
REGISTER_ROOT(v2);
F_ARRAY *a = allot_array_internal(ARRAY_TYPE,2);
UNREGISTER_ROOT(v2);
UNREGISTER_ROOT(v1);
put(AREF(a,0),v1);
put(AREF(a,1),v2);
return tag_object(a);
}
CELL allot_array_4(CELL v1, CELL v2, CELL v3, CELL v4) CELL allot_array_4(CELL v1, CELL v2, CELL v3, CELL v4)
{ {
REGISTER_ROOT(v1); REGISTER_ROOT(v1);

View File

@ -31,7 +31,6 @@ F_ARRAY *allot_array_internal(CELL type, F_FIXNUM capacity);
F_ARRAY *allot_array(CELL type, F_FIXNUM capacity, CELL fill); F_ARRAY *allot_array(CELL type, F_FIXNUM capacity, CELL fill);
F_ARRAY *allot_byte_array(F_FIXNUM size); F_ARRAY *allot_byte_array(F_FIXNUM size);
CELL allot_array_2(CELL v1, CELL v2);
CELL allot_array_4(CELL v1, CELL v2, CELL v3, CELL v4); CELL allot_array_4(CELL v1, CELL v2, CELL v3, CELL v4);
void primitive_array(void); void primitive_array(void);