OK, the problem is that make_frame fails to put the arguments into the frame.

I do not (yet) know why not, but that is the problem.
This commit is contained in:
Simon Brooke 2026-04-16 12:34:47 +01:00
parent ba985474f6
commit cb3dcb352e
6 changed files with 23 additions and 8 deletions

View file

@ -52,6 +52,7 @@ struct pso_pointer initialise_environment( uint32_t node ) {
object->payload.cons.cdr = nil;
nil = n;
lock_object( nil);
debug_print( L"success\n", DEBUG_BOOTSTRAP, 0);
} else {
result =
@ -72,6 +73,7 @@ struct pso_pointer initialise_environment( uint32_t node ) {
object->payload.cons.cdr = t;
t = n;
lock_object(t);
debug_print( L"success\n", DEBUG_BOOTSTRAP, 0);
} else {
result =
@ -86,6 +88,7 @@ struct pso_pointer initialise_environment( uint32_t node ) {
result = c_bind( c_string_to_lisp_symbol( L"t" ), t, result );
environment_initialised = true;
debug_print( L"\nEnvironment initialised successfully.\n", DEBUG_BOOTSTRAP, 0);
}
return result;

View file

@ -41,9 +41,10 @@ struct pso_pointer nil = ( struct pso_pointer ) { 0, 0, 0 };
/**
* @brief the canonical `t` (true) pointer.
*
* Offset 4, because `t` should be the second pso2 allocated, the offset is
* given in words, and the size of a pso2 should be four words.
*/
struct pso_pointer t = ( struct pso_pointer ) { 0, 0, 1 };
struct pso_pointer t = ( struct pso_pointer ) { 0, 0, 4 };
/**

View file

@ -287,7 +287,7 @@ struct pso_pointer allocate_page( uint8_t size_class ) {
memset( pg, 0, sizeof( union page ) );
pages[npages_allocated] = pg;
debug_printf( DEBUG_ALLOC, 0,
L"Allocated page %d for objects of size class %x.\n",
L"\nAllocated page %d for objects of size class %x.\n",
npages_allocated, size_class );
freelists[size_class] =

View file

@ -15,6 +15,7 @@
*/
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "debug.h"
@ -38,7 +39,8 @@
* @return struct pso_pointer a pointer to the newly allocated object
*/
struct pso_pointer allocate( char *tag, uint8_t size_class ) {
struct pso_pointer result = nil;
// `t`, because if `allocate_page` fails it will be set to `nil`.
struct pso_pointer result = t;
#ifdef DEBUG
debug_printf( DEBUG_ALLOC, 0, L"Allocating object of size class %d with tag `%s`... ", size_class, tag);
@ -49,7 +51,14 @@ struct pso_pointer allocate( char *tag, uint8_t size_class ) {
result = allocate_page( size_class );
}
if ( !exceptionp( result ) ) {
if (nilp(result)) {
fputws( L"FATAL: Page space exhausted\n", stderr );
exit(1); // TODO: we don't want to do this! Somehow, we need to
// recover a workable environment, ideally by throwing a pre-made
// exception.
}
if ( !exceptionp( result ) && !nilp(result)) {
result = freelists[size_class];
struct pso2 *object = pointer_to_object( result );
freelists[size_class] = object->payload.free.next;
@ -69,7 +78,6 @@ struct pso_pointer allocate( char *tag, uint8_t size_class ) {
if ( object->header.count != 0 ) {
// TODO: return an exception instead? Or warn, set it, and continue?
}
}
} // TODO: else throw exception

View file

@ -127,7 +127,7 @@ struct pso_pointer make_keyword( wint_t c, struct pso_pointer tail ) {
* @param tail the symbol which is being built.
*/
struct pso_pointer make_symbol( wint_t c, struct pso_pointer tail ) {
return make_string_like_thing( c, tail, STRINGTAG );
return make_string_like_thing( c, tail, SYMBOLTAG );
}

View file

@ -49,12 +49,15 @@ bool not( struct pso_pointer p ) {
* each is considered equivalent. So we don't check the node when considering
* whether `nil` really is `nil`, or `t` really is `t`.
*
* Note that the offset is 4 because `t` should be the second pso2 allocated,
* the offset is given in words, and the size of a pso2 should be four words
*
* @param p a pointer
* @return true if `p` points to `t`.
* @return false otherwise.
*/
bool truep( struct pso_pointer p ) {
return ( p.page == 0 && p.offset == 1 );
return ( p.page == 0 && p.offset == 4 );
}
/**