Print is less badly broken. Read is less badly broken. GC is too aggressive.
This commit is contained in:
parent
22b0160a26
commit
63906fe817
19 changed files with 489 additions and 303 deletions
|
|
@ -8,9 +8,12 @@
|
|||
*/
|
||||
|
||||
#include "memory/node.h"
|
||||
#include "memory/pointer.h"
|
||||
#include "memory/pso2.h"
|
||||
#include "memory/pso4.h"
|
||||
#include "memory/tags.h"
|
||||
|
||||
#include "payloads/cons.h"
|
||||
#include "payloads/stack.h"
|
||||
|
||||
/**
|
||||
|
|
@ -54,3 +57,25 @@ struct pso_pointer fetch_env( struct pso_pointer frame_pointer ) {
|
|||
return stackp( frame_pointer ) ?
|
||||
pointer_to_pso4( frame_pointer )->payload.stack_frame.env : nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a binding (and therefore a reference) for this `local` onto the
|
||||
* stack_frame indicated by this `frame_pointer`, thereby protecting the
|
||||
* `local` from garbage collection until the frame itself is disposed of.
|
||||
*
|
||||
* This is a hack. For Lisp functions, where the stack frames are set up
|
||||
* and torn down by eval/apply, it shouldn't be necessary.
|
||||
*/
|
||||
struct pso_pointer push_local( struct pso_pointer frame_pointer,
|
||||
struct pso_pointer local ) {
|
||||
if ( stackp( frame_pointer ) ) {
|
||||
struct pso4 *frame = pointer_to_pso4( frame_pointer );
|
||||
|
||||
struct pso_pointer l =
|
||||
make_cons( frame_pointer, local,
|
||||
frame->payload.stack_frame.locals );
|
||||
frame->payload.stack_frame.locals = l;
|
||||
}
|
||||
|
||||
return local;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue