mini-mes: Workarounds for gc.c.
* gc.c (gc_copy)[!__GNUC__]: Avoid by value assignment from array-of struct entry. * scaffold/mini-mes.c (gc_init_cells): Workarounds.
This commit is contained in:
parent
6a816687e8
commit
934260fc27
29
gc.c
29
gc.c
|
@ -70,12 +70,41 @@ gc_copy (SCM old) ///((internal))
|
||||||
{
|
{
|
||||||
if (TYPE (old) == TBROKEN_HEART) return g_cells[old].car;
|
if (TYPE (old) == TBROKEN_HEART) return g_cells[old].car;
|
||||||
SCM new = g_free++;
|
SCM new = g_free++;
|
||||||
|
#if 0
|
||||||
g_news[new] = g_cells[old];
|
g_news[new] = g_cells[old];
|
||||||
|
#else
|
||||||
|
SCM y = new;
|
||||||
|
SCM z = old;
|
||||||
|
SCM zz = TYPE (z);
|
||||||
|
NTYPE (y) = zz;
|
||||||
|
zz = CAR (z);
|
||||||
|
NCAR (y) = zz;
|
||||||
|
zz = CDR (z);
|
||||||
|
NCDR (y) = zz;
|
||||||
|
#endif
|
||||||
if (NTYPE (new) == TVECTOR)
|
if (NTYPE (new) == TVECTOR)
|
||||||
{
|
{
|
||||||
NVECTOR (new) = g_free;
|
NVECTOR (new) = g_free;
|
||||||
for (int i=0; i<LENGTH (old); i++)
|
for (int i=0; i<LENGTH (old); i++)
|
||||||
|
#if 0
|
||||||
|
//__GNUC__
|
||||||
g_news[g_free++] = g_cells[VECTOR (old)+i];
|
g_news[g_free++] = g_cells[VECTOR (old)+i];
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
//eputs ("gc_copy\n");
|
||||||
|
y = g_free;
|
||||||
|
g_free++;
|
||||||
|
z = VECTOR (old);
|
||||||
|
z = z + i;
|
||||||
|
//z = g_cells[z];
|
||||||
|
zz = TYPE (z);
|
||||||
|
NTYPE (y) = zz;
|
||||||
|
zz = CAR (z);
|
||||||
|
NCAR (y) = zz;
|
||||||
|
zz = CDR (z);
|
||||||
|
NCDR (y) = zz;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
TYPE (old) = TBROKEN_HEART;
|
TYPE (old) = TBROKEN_HEART;
|
||||||
CAR (old) = new;
|
CAR (old) = new;
|
||||||
|
|
|
@ -1439,27 +1439,65 @@ gc_init_cells () ///((internal))
|
||||||
{
|
{
|
||||||
//return 0;
|
//return 0;
|
||||||
//g_cells = (scm *)malloc (ARENA_SIZE);
|
//g_cells = (scm *)malloc (ARENA_SIZE);
|
||||||
|
//int size = ARENA_SIZE * sizeof (struct scm);
|
||||||
|
int size = ARENA_SIZE * 12;
|
||||||
|
#if MES_GC
|
||||||
|
size = size * 2;
|
||||||
|
#endif
|
||||||
#if __GNUC__
|
#if __GNUC__
|
||||||
arena = (char*)malloc (ARENA_SIZE);
|
arena = (char*)malloc (size);
|
||||||
#else
|
#else
|
||||||
char *p = 0;
|
char *p = 0;
|
||||||
p = malloc (ARENA_SIZE);
|
p = malloc (size);
|
||||||
arena = p;
|
arena = p;
|
||||||
#endif
|
#endif
|
||||||
g_cells = arena;
|
g_cells = arena;
|
||||||
return 0;
|
return 0;
|
||||||
//g_cells = (scm *)malloc (2*ARENA_SIZE*sizeof(scm));
|
//g_cells = (scm *)malloc (2*ARENA_SIZE*sizeof(scm));
|
||||||
|
|
||||||
// #if __NYACC__ || FIXME_NYACC
|
TYPE (0) = TVECTOR;
|
||||||
// TYPE (0) = TVECTOR;
|
LENGTH (0) = 1000;
|
||||||
// // #else
|
VECTOR (0) = 0;
|
||||||
// // TYPE (0) = VECTOR;
|
g_cells++;
|
||||||
// #endif
|
TYPE (0) = TCHAR;
|
||||||
// LENGTH (0) = 1000;
|
VALUE (0) = 'c';
|
||||||
// VECTOR (0) = 0;
|
return 0;
|
||||||
// g_cells++;
|
}
|
||||||
// TYPE (0) = CHAR;
|
|
||||||
// VALUE (0) = 'c';
|
SCM
|
||||||
|
gc_init_news () ///((internal))
|
||||||
|
{
|
||||||
|
eputs ("gc_init_news\n");
|
||||||
|
///g_news = g_cells-1 + ARENA_SIZE;
|
||||||
|
//g_news = g_cells + ARENA_SIZE * 12 + GC_SAFETY * 6;
|
||||||
|
char *p = g_cells;
|
||||||
|
// g_news = g_cells;
|
||||||
|
int halfway = ARENA_SIZE * 12;
|
||||||
|
int safety = GC_SAFETY * 12;
|
||||||
|
safety = safety / 2;
|
||||||
|
halfway = halfway + safety;
|
||||||
|
// g_news = g_news + halfway;
|
||||||
|
p = p + halfway;
|
||||||
|
g_news = p;
|
||||||
|
eputs ("g_cells=");
|
||||||
|
eputs (itoa (g_cells));
|
||||||
|
eputs (" size=");
|
||||||
|
eputs (itoa (halfway));
|
||||||
|
eputs (" news=");
|
||||||
|
eputs (itoa (g_news));
|
||||||
|
eputs (" news - cells=");
|
||||||
|
char * c = g_cells;
|
||||||
|
eputs (itoa (p - c));
|
||||||
|
eputs ("\n");
|
||||||
|
|
||||||
|
|
||||||
|
NTYPE (0) = TVECTOR;
|
||||||
|
NLENGTH (0) = 1000;
|
||||||
|
NVECTOR (0) = 0;
|
||||||
|
g_news++;
|
||||||
|
NTYPE (0) = TCHAR;
|
||||||
|
NVALUE (0) = 'n';
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// INIT NEWS
|
// INIT NEWS
|
||||||
|
|
Loading…
Reference in a new issue