*** empty log message ***

This commit is contained in:
hyung-hwan 2005-05-18 16:34:51 +00:00
parent 855f95d490
commit fd13891ef3
3 changed files with 16 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: memory.c,v 1.7 2005-05-08 11:16:07 bacon Exp $ * $Id: memory.c,v 1.8 2005-05-18 16:34:51 bacon Exp $
*/ */
#include <xp/stx/memory.h> #include <xp/stx/memory.h>
@ -31,19 +31,11 @@ xp_stx_memory_t* xp_stx_memory_open (
mem->slots = slots; mem->slots = slots;
/* weave the free slot list */ /* weave the free slot list */
/*
mem->free = &slots[capacity - 1];
while (capacity > 1) {
capacity--;
mem->slots[capacity] = (xp_stx_object_t*)&mem->slots[capacity - 1];
}
mem->slots[--capacity] = XP_NULL;
*/
mem->free = &slots[0]; mem->free = &slots[0];
for (n = 0; n < capacity - 1; n++) { for (n = 0; n < capacity - 1; n++) {
mem->slots[n] = (xp_stx_object_t*)&mem->slots[n + 1]; mem->slots[n] = (xp_stx_object_t*)&mem->slots[n + 1];
} }
mem->slots[n + 1] = XP_NULL; mem->slots[n] = XP_NULL;
return mem; return mem;
} }
@ -86,6 +78,7 @@ xp_stx_word_t xp_stx_memory_alloc (xp_stx_memory_t* mem, xp_stx_word_t nbytes)
mem->free = (xp_stx_object_t**)*slot; mem->free = (xp_stx_object_t**)*slot;
*slot = object; *slot = object;
xp_printf (XP_TEXT("returning %d\n"), slot - mem->slots);
return (xp_stx_word_t)(slot - mem->slots); return (xp_stx_word_t)(slot - mem->slots);
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: object.c,v 1.15 2005-05-18 04:01:51 bacon Exp $ * $Id: object.c,v 1.16 2005-05-18 16:34:51 bacon Exp $
*/ */
#include <xp/stx/object.h> #include <xp/stx/object.h>
@ -25,7 +25,7 @@ xp_stx_word_t xp_stx_alloc_object (xp_stx_t* stx, xp_stx_word_t n)
xp_assert (stx->nil == XP_STX_NIL); xp_assert (stx->nil == XP_STX_NIL);
XP_STX_CLASS(stx,idx) = stx->nil; XP_STX_CLASS(stx,idx) = stx->nil;
XP_STX_ACCESS(stx,idx) = (n << 2) | XP_STX_INDEXED; XP_STX_ACCESS(stx,idx) = (n << 2) | XP_STX_INDEXED;
while (n--) XP_STX_AT(stx,idx,n) = stx->nil; while (n-- > 0) XP_STX_AT(stx,idx,n) = stx->nil;
return idx; return idx;
} }
@ -42,7 +42,7 @@ xp_stx_word_t xp_stx_alloc_byte_object (xp_stx_t* stx, xp_stx_word_t n)
xp_assert (stx->nil == XP_STX_NIL); xp_assert (stx->nil == XP_STX_NIL);
XP_STX_CLASS(stx,idx) = stx->nil; XP_STX_CLASS(stx,idx) = stx->nil;
XP_STX_ACCESS(stx,idx) = (n << 2) | XP_STX_BYTE_INDEXED; XP_STX_ACCESS(stx,idx) = (n << 2) | XP_STX_BYTE_INDEXED;
while (n--) XP_STX_BYTEAT(stx,idx,n) = 0; while (n-- > 0) XP_STX_BYTEAT(stx,idx,n) = 0;
return idx; return idx;
} }
@ -61,7 +61,7 @@ xp_stx_word_t xp_stx_alloc_string_object (
XP_STX_CLASS(stx,idx) = stx->nil; XP_STX_CLASS(stx,idx) = stx->nil;
XP_STX_ACCESS(stx,idx) = (n << 2) | XP_STX_CHAR_INDEXED; XP_STX_ACCESS(stx,idx) = (n << 2) | XP_STX_CHAR_INDEXED;
XP_STX_CHARAT(stx,idx,n) = XP_STX_CHAR('\0'); XP_STX_CHARAT(stx,idx,n) = XP_STX_CHAR('\0');
while (n--) XP_STX_CHARAT(stx,idx,n) = str[n]; while (n-- > 0) XP_STX_CHARAT(stx,idx,n) = str[n];
return idx; return idx;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: stx.c,v 1.18 2005-05-18 16:05:34 bacon Exp $ * $Id: stx.c,v 1.19 2005-05-18 16:34:51 bacon Exp $
*/ */
#include <xp/stx/stx.h> #include <xp/stx/stx.h>
@ -57,11 +57,14 @@ int xp_stx_bootstrap (xp_stx_t* stx)
xp_stx_word_t class_Object, class_Class; xp_stx_word_t class_Object, class_Class;
xp_stx_word_t tmp; xp_stx_word_t tmp;
xp_printf (XP_TEXT("bootstreap\n"));
__create_bootstrapping_objects (stx); __create_bootstrapping_objects (stx);
xp_printf (XP_TEXT("bootstreap over\n"));
/* more initialization */ /* more initialization */
XP_STX_CLASS(stx,stx->symbol_table) = XP_STX_CLASS(stx,stx->symbol_table) =
xp_stx_new_class (stx, XP_STX_TEXT("SymbolTable")); xp_stx_new_class (stx, XP_STX_TEXT("SymbolTable"));
xp_printf (XP_TEXT("bootstreap 1111\n"));
XP_STX_CLASS(stx,stx->smalltalk) = XP_STX_CLASS(stx,stx->smalltalk) =
xp_stx_new_class (stx, XP_STX_TEXT("SystemDictionary")); xp_stx_new_class (stx, XP_STX_TEXT("SystemDictionary"));
@ -70,15 +73,18 @@ int xp_stx_bootstrap (xp_stx_t* stx)
xp_stx_hash_string_object(stx,symbol_Smalltalk), xp_stx_hash_string_object(stx,symbol_Smalltalk),
symbol_Smalltalk, stx->smalltalk); symbol_Smalltalk, stx->smalltalk);
/* more initialization for nil, true, false */ /* create #nil, #true, #false */
xp_stx_new_symbol (stx, XP_STX_TEXT("nil")); xp_stx_new_symbol (stx, XP_STX_TEXT("nil"));
xp_stx_new_symbol (stx, XP_STX_TEXT("true")); xp_stx_new_symbol (stx, XP_STX_TEXT("true"));
xp_stx_new_symbol (stx, XP_STX_TEXT("false")); xp_stx_new_symbol (stx, XP_STX_TEXT("false"));
/* nil setClass: UndefinedObject */
XP_STX_CLASS(stx,stx->nil) = XP_STX_CLASS(stx,stx->nil) =
xp_stx_new_class (stx, XP_STX_TEXT("UndefinedObject")); xp_stx_new_class (stx, XP_STX_TEXT("UndefinedObject"));
/* true setClass: True */
XP_STX_CLASS(stx,stx->true) = XP_STX_CLASS(stx,stx->true) =
xp_stx_new_class (stx, XP_STX_TEXT("True")); xp_stx_new_class (stx, XP_STX_TEXT("True"));
/* fales setClass: False */
XP_STX_CLASS(stx,stx->false) = XP_STX_CLASS(stx,stx->false) =
xp_stx_new_class (stx, XP_STX_TEXT("False")); xp_stx_new_class (stx, XP_STX_TEXT("False"));
@ -138,6 +144,7 @@ static void __create_bootstrapping_objects (xp_stx_t* stx)
class_PairlinkMeta = /* Pairlink class */ class_PairlinkMeta = /* Pairlink class */
xp_stx_alloc_object(stx,XP_STX_CLASS_SIZE); xp_stx_alloc_object(stx,XP_STX_CLASS_SIZE);
/* (Symlink class) setClass: Metaclass */ /* (Symlink class) setClass: Metaclass */
XP_STX_CLASS(stx,class_SymlinkMeta) = stx->class_metaclass; XP_STX_CLASS(stx,class_SymlinkMeta) = stx->class_metaclass;
/* (Symbol class) setClass: Metaclass */ /* (Symbol class) setClass: Metaclass */