64 if ( result != NULL ) {
81 L
"Allocated special cell NIL\n" );
96 L
"Allocated special cell T\n" );
114 L
"FATAL: Failed to allocate memory for cons page %d\n",
150 if ( cell->
count == 0 ) {
151 switch ( cell->
tag.value ) {
191 fprintf( stderr,
"WARNING: Freeing object of type %s!",
192 (
char * ) &( cell->
tag.bytes ) );
202 L
"ERROR: Attempt to free cell with %d dangling references at page %d, offset %d\n",
207 L
"ERROR: Attempt to free cell which is already FREE at page %d, offset %d\n",
235 cell->
tag.value = tag;
244 L
"Allocated cell of type '%4.4s' at %d, %d \n",
267 L
"WARNING: initialise_cons_pages() called a second or subsequent time\n" );
273 L
"Allocation summary: allocated %lld; deallocated %lld; not deallocated %lld.\n",
struct cons_pointer allocate_cell(uint32_t tag)
Allocates a cell with the specified tag.
uint64_t total_cells_freed
void make_cons_page()
Make a cons page.
int initialised_cons_pages
the number of cons pages which have thus far been initialised.
bool conspageinitihasbeencalled
Flag indicating whether conspage initialisation has been done.
struct cons_page * conspages[NCONSPAGES]
An array of pointers to cons pages.
void free_cell(struct cons_pointer pointer)
Frees the cell at the specified pointer; for all the types of cons-space object which point to other ...
void dump_pages(URL_FILE *output)
dump the allocated pages to this output stream.
uint64_t total_cells_allocated
keep track of total cells allocated and freed to check for leakage.
void summarise_allocation()
struct cons_pointer freelist
The (global) pointer to the (global) freelist.
void initialise_cons_pages()
initialise the cons page system; to be called exactly once during startup.
#define NCONSPAGES
the number of cons pages we will initially allow for.
#define CONSPAGESIZE
the number of cons cells on a cons page.
struct cons_space_object cell[CONSPAGESIZE]
a cons page is essentially just an array of cons space objects.
bool check_tag(struct cons_pointer pointer, uint32_t value)
True if the value of the tag on the cell at this pointer is this value, or, if the tag of the cell is...
struct cons_pointer dec_ref(struct cons_pointer pointer)
Decrement the reference count of the object at this cons pointer.
#define SPECIALTV
The string SPFM, considered as an unsigned int.
#define VECTORPOINTTV
The string VECP, considered as an unsigned int.
#define SYMBOLTV
The string SYMB, considered as an unsigned int.
union cons_space_object::@2 tag
union cons_space_object::@3 payload
#define NIL
a cons pointer which points to the special NIL cell
#define FUNCTIONTV
The string FUNC, considered as an unsigned int.
uint32_t page
the index of the page on which this cell resides
#define STRINGTV
The string STRG, considered as an unsigned int.
#define INTEGERTV
The string INTR, considered as an unsigned int.
#define FREETAG
An unallocated cell on the free list - should never be encountered by a Lisp function.
#define FREETV
The string FREE, considered as an unsigned int.
#define NILTAG
The special cons cell at address {0,0} whose car and cdr both point to itself.
#define TAGLENGTH
The length of a tag, in bytes.
#define RATIOTV
The string RTIO, considered as an unsigned int.
#define CONSTV
The string CONS, considered as an unsigned int.
#define TRUETAG
The special cons cell at address {0,1} which is canonically different from NIL.
#define NLAMBDATV
The string NLMD, considered as an unsigned int.
uint32_t count
the count of the number of references to this cell
uint32_t offset
the index of the cell within the page
#define EXCEPTIONTV
The string EXEP, considered as an unsigned int.
#define MAXREFERENCE
the maximum possible value of a reference count
#define LAMBDATV
The string LMDA, considered as an unsigned int.
#define WRITETV
The string WRIT, considered as an unsigned int.
#define READTV
The string READ, considered as an unsigned int.
#define pointer2cell(pointer)
given a cons_pointer as argument, return the cell.
An indirect pointer to a cons cell.
void debug_dump_object(struct cons_pointer pointer, int level)
Like dump_object, q.v., but protected by the verbosity mechanism.
void debug_printf(int level, wchar_t *format,...)
wprintf adapted for the debug logging system.
#define DEBUG_ALLOC
Print messages debugging memory allocation.
void dump_object(URL_FILE *output, struct cons_pointer pointer)
dump the object at this cons_pointer to this output stream.
int url_fclose(URL_FILE *file)
#define url_fwprintf(f,...)
void free_vso(struct cons_pointer pointer)
for vector space pointers, free the actual vector-space object.