Revert "gc_dump_arena"

This reverts commit 1445725df2c2b7b8776c53daaed1c88d58174763.
This commit is contained in:
Jan Nieuwenhuizen 2019-10-29 22:24:58 +01:00
parent c5c887ae5a
commit 8d7ff09239
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
2 changed files with 0 additions and 112 deletions

View File

@ -172,7 +172,6 @@ void copy_cell (SCM to, SCM from);
void gc_ ();
void gc_stats_ (char const* where);
void init_symbols_ ();
void gc_dump_arena (struct scm *cells, long size);
#include "mes/builtins.h"
#include "mes/constants.h"

111
src/gc.c
View File

@ -25,13 +25,6 @@
#include <string.h>
#include <stdlib.h>
/* DUMP */
#include <fcntl.h>
int dump_fd;
#define ltoa(x) ntoab(x, 10, 0)
#define oputc(x) fdputc(x, dump_fd)
#define oputs(x) fdputs(x, dump_fd)
// CONSTANT FRAME_SIZE 5
#define FRAME_SIZE 5
@ -692,107 +685,3 @@ gc_pop_frame () /*:((internal)) */
g_stack = g_stack + FRAME_SIZE;
return x;
}
void
gc_dump_arena (struct scm *cells, long size)
{
#if POINTER_CELLS
struct scm *dist = cells;
#endif
if (!dump_fd)
dump_fd = mes_open ("dump.mo", O_CREAT|O_WRONLY, 0644);
oputs ("stack="); oputs (ltoa (g_stack)); oputc ('\n');
while (cells[size].type == 0 && cells[size].car == 0 && cells[size].cdr == 0)
size = size - 1;
oputs ("size="); oputs (ltoa (size)); oputc ('\n');
while (size > 0)
{
int i;
for (i=0; i < 16; i = i + 1)
{
long t = cells->type;
long a = cells->car;
long d = cells->cdr;
if (size == 0)
oputs ("0 0 0");
else
{
oputs (ltoa (t));
oputc (' ');
#if POINTER_CELLS
if (t == TMACRO
|| t == TPAIR
|| t == TREF
|| t == TVARIABLE)
{
oputs (ltoa ((cells->car - dist) / M2_CELL_SIZE));
/* oputs ("["); oputs (ltoa (a)); oputs ("]"); */
}
else
#endif
oputs (ltoa (a));
oputc (' ');
if (t != TBYTES)
{
#if POINTER_CELLS
if (t == TCLOSURE
|| t == TCONTINUATION
|| t == TKEYWORD
|| t == TMACRO
|| t == TPAIR
|| t == TPORT
|| t == TSPECIAL
|| t == TSTRING
|| t == TSTRUCT
|| t == TSYMBOL
|| t == TVALUES
|| t == TVECTOR)
{
oputs (ltoa ((cells->cdr - dist) / M2_CELL_SIZE));
/* oputs ("["); oputs (ltoa (d)); oputs ("]"); */
}
else
#endif
if (t == TNUMBER && d > 1000)
oputs (ltoa (1001));
else
oputs (ltoa (d));
}
if (t == TBYTES)
{
int c = bytes_cells (a);
char *p = &cells->cdr;
size = size - c;
oputc ('"');
while (a > 0)
{
if (p[0] != 0)
oputc (p[0]);
p = p + 1;
a = a - 1;
}
oputc ('"');
cells = cells + c * M2_CELL_SIZE;
size = size - c;
}
#if 0
else if (t == TSTRUCT)
{
cells = cells + (a + 1) * M2_CELL_SIZE;
size = size - a - 1;
}
#endif
else
{
cells = cells + M2_CELL_SIZE;
size = size - 1;
}
}
if (i != 15)
oputs (" ");
else
oputc ('\n');
}
oputc ('\n');
}
}