summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
Diffstat (limited to 'libguile')
-rw-r--r--libguile/continuations.c12
-rw-r--r--libguile/frames.c17
-rw-r--r--libguile/frames.h5
-rw-r--r--libguile/stacks.c14
4 files changed, 25 insertions, 23 deletions
diff --git a/libguile/continuations.c b/libguile/continuations.c
index f28d59afc..62a9b7f1a 100644
--- a/libguile/continuations.c
+++ b/libguile/continuations.c
@@ -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;
diff --git a/libguile/frames.c b/libguile/frames.c
index 3a2d01b6f..685e06d8b 100644
--- a/libguile/frames.c
+++ b/libguile/frames.c
@@ -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
diff --git a/libguile/frames.h b/libguile/frames.h
index bc3cca956..e4a75458b 100644
--- a/libguile/frames.h
+++ b/libguile/frames.h
@@ -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);
diff --git a/libguile/stacks.c b/libguile/stacks.c
index 360b35f7b..8837a7fe2 100644
--- a/libguile/stacks.c
+++ b/libguile/stacks.c
@@ -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;