53 lines
1.7 KiB
C
53 lines
1.7 KiB
C
/**
|
|
* payloads/function.h
|
|
*
|
|
* an ordinary Lisp function - one whose arguments are pre-evaluated.
|
|
*
|
|
* (c) 2026 Simon Brooke <simon@journeyman.cc>
|
|
* Licensed under GPL version 2.0, or, at your option, any later version.
|
|
*/
|
|
|
|
#ifndef __psse_payloads_function_h
|
|
#define __psse_payloads_function_h
|
|
|
|
#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.
|
|
*/
|
|
struct function_payload {
|
|
/**
|
|
* 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;
|
|
|
|
#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 pso_pointer frame_pointer );
|
|
#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 );
|
|
#endif
|
|
};
|
|
|
|
#endif
|