Many more ops written, and it compiles. Nothing works yet.

This commit is contained in:
Simon Brooke 2026-04-15 19:50:10 +01:00
parent f5f8e38b91
commit c9f50572ab
17 changed files with 290 additions and 71 deletions

View file

@ -13,29 +13,43 @@
#include "memory/pointer.h"
#include "memory/pso4.h"
/**
* I don't think it's necessary to pass both an unmanaged and a managed
* frame pointer into a function, but it may prove to be more efficient to do
* so. For the present we'll assume not. See state of play for 15042026.
*/
#define MANAGED_POINTER_ONLY TRUE
/**
* @brief Payload of a function cell.
* `source` points to the source from which the function was compiled, or NIL
* if it is a primitive.
* `executable` points to a function which takes a pointer to a stack frame
* (representing its stack frame) and a cons pointer (representing its
* environment) as arguments and returns a cons pointer (representing its
* result).
*/
struct function_payload {
/**
* pointer to metadata (e.g. the source from which the function was compiled).
* pointer to metadata (e.g. the source from which the function was compiled,
* something to help estimate the cost of the function?).
*/
struct pso_pointer meta;
/** pointer to a function which takes a cons pointer (representing
* its argument list) and a cons pointer (representing its environment) and a
* stack frame (representing the previous stack frame) as arguments and returns
* a cons pointer (representing its result).
* \todo check this documentation is current!
#ifdef MANAGED_POINTER_ONLY
/**
* pointer to a C function which takes a managed pointer to the same stack
* frame and a managed pointer to the environment as arguments. Arguments
* to the Lisp function are assumed to be loaded into the frame before
* invocation.
*/
struct pso_pointer ( *executable ) ( struct pso4 *,
struct pso_pointer,
struct pso_pointer );
struct pso_pointer ( *executable ) ( struct pso_pointer frame_pointer,
struct pso_pointer env );
#else
/**
* pointer to a C function which takes an unmanaged pointer to a stack frame,
* a managed pointer to the same stack frame, and a managed pointer to the
* environment as arguments. Arguments to the Lisp function are assumed to be
* loaded into the frame before invocation.
*/
struct pso_pointer ( *executable ) ( struct pso4 * frame,
struct pso_pointer frame_pointer,
struct pso_pointer env );
#endif
};
#endif