mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
scm_c_make_frame takes struct scm_frame as arg
* libguile/frames.h: * libguile/frames.c (scm_c_make_frame): Adapt to take a const struct scm_frame as the argument. Adapt callers. * libguile/continuations.c: * libguile/stacks.c: Adapt callers.
This commit is contained in:
parent
44d9705464
commit
8de051da47
4 changed files with 25 additions and 23 deletions
|
@ -179,11 +179,15 @@ scm_i_continuation_to_frame (SCM continuation)
|
|||
|
||||
if (scm_is_true (cont->vm_cont))
|
||||
{
|
||||
struct scm_frame frame;
|
||||
struct scm_vm_cont *data = SCM_VM_CONT_DATA (cont->vm_cont);
|
||||
return scm_c_make_frame (SCM_VM_FRAME_KIND_CONT, data,
|
||||
(data->fp + data->reloc) - data->stack_base,
|
||||
(data->sp + data->reloc) - data->stack_base,
|
||||
data->ra);
|
||||
|
||||
frame.stack_holder = data;
|
||||
frame.fp_offset = (data->fp + data->reloc) - data->stack_base;
|
||||
frame.sp_offset = (data->sp + data->reloc) - data->stack_base;
|
||||
frame.ip = data->ra;
|
||||
|
||||
return scm_c_make_frame (SCM_VM_FRAME_KIND_CONT, &frame);
|
||||
}
|
||||
else
|
||||
return SCM_BOOL_F;
|
||||
|
|
|
@ -35,17 +35,15 @@ verify (offsetof (struct scm_vm_frame, dynamic_link) == 0);
|
|||
|
||||
|
||||
SCM
|
||||
scm_c_make_frame (enum scm_vm_frame_kind frame_kind, void *stack_holder,
|
||||
scm_t_ptrdiff fp_offset, scm_t_ptrdiff sp_offset,
|
||||
scm_t_uint32 *ip)
|
||||
scm_c_make_frame (enum scm_vm_frame_kind kind, const struct scm_frame *frame)
|
||||
{
|
||||
struct scm_frame *p = scm_gc_malloc (sizeof (struct scm_frame),
|
||||
"vmframe");
|
||||
p->stack_holder = stack_holder;
|
||||
p->fp_offset = fp_offset;
|
||||
p->sp_offset = sp_offset;
|
||||
p->ip = ip;
|
||||
return scm_cell (scm_tc7_frame | (frame_kind << 8), (scm_t_bits)p);
|
||||
p->stack_holder = frame->stack_holder;
|
||||
p->fp_offset = frame->fp_offset;
|
||||
p->sp_offset = frame->sp_offset;
|
||||
p->ip = frame->ip;
|
||||
return scm_cell (scm_tc7_frame | (kind << 8), (scm_t_bits)p);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -337,8 +335,7 @@ SCM_DEFINE (scm_frame_previous, "frame-previous", 1, 0, 0,
|
|||
if (!scm_c_frame_previous (SCM_VM_FRAME_KIND (frame), &tmp))
|
||||
return SCM_BOOL_F;
|
||||
|
||||
return scm_c_make_frame (kind, tmp.stack_holder, tmp.fp_offset,
|
||||
tmp.sp_offset, tmp.ip);
|
||||
return scm_c_make_frame (kind, &tmp);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
|
|
@ -167,9 +167,8 @@ enum scm_vm_frame_kind
|
|||
SCM_INTERNAL SCM* scm_i_frame_stack_base (SCM frame);
|
||||
SCM_INTERNAL scm_t_ptrdiff scm_i_frame_offset (SCM frame);
|
||||
|
||||
SCM_INTERNAL SCM scm_c_make_frame (enum scm_vm_frame_kind vm_frame_kind,
|
||||
void *stack_holder, scm_t_ptrdiff fp_offset,
|
||||
scm_t_ptrdiff sp_offset, scm_t_uint32 *ip);
|
||||
SCM_INTERNAL SCM scm_c_make_frame (enum scm_vm_frame_kind kind,
|
||||
const struct scm_frame *frame);
|
||||
|
||||
SCM_INTERNAL int scm_c_frame_previous (enum scm_vm_frame_kind kind,
|
||||
struct scm_frame *frame);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* A stack holds a frame chain
|
||||
* Copyright (C) 1996,1997,2000,2001, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation
|
||||
* Copyright (C) 1996,1997,2000,2001, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -254,14 +254,16 @@ SCM_DEFINE (scm_make_stack, "make-stack", 1, 0, 1,
|
|||
{
|
||||
SCM cont;
|
||||
struct scm_vm_cont *c;
|
||||
struct scm_frame tmp;
|
||||
|
||||
cont = scm_i_capture_current_stack ();
|
||||
c = SCM_VM_CONT_DATA (cont);
|
||||
|
||||
frame = scm_c_make_frame (SCM_VM_FRAME_KIND_CONT, c,
|
||||
(c->fp + c->reloc) - c->stack_base,
|
||||
(c->sp + c->reloc) - c->stack_base,
|
||||
c->ra);
|
||||
c = SCM_VM_CONT_DATA (cont);
|
||||
tmp.stack_holder = c;
|
||||
tmp.fp_offset = (c->fp + c->reloc) - c->stack_base;
|
||||
tmp.sp_offset = (c->sp + c->reloc) - c->stack_base;
|
||||
tmp.ip = c->ra;
|
||||
frame = scm_c_make_frame (SCM_VM_FRAME_KIND_CONT, &tmp);
|
||||
}
|
||||
else if (SCM_VM_FRAME_P (obj))
|
||||
frame = obj;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue