mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-18 18:40:22 +02:00
Translation from Scheme to GHIL, and compilation to GLIL work.
* src/*.c: Removed calls to `scm_must_malloc', `SCM_MUST_MALLOC' and `scm_must_free'. Same for `SCM_INUMP', `SCM_INUM', `SCM_STRING_CHARS', and the likes. * module/system/base/syntax.scm: Do not import `(ice-9 match)' and do not re-export `match', do not export `syntax-error' which was not defined here. * module/system/base/compile.scm (call-with-compile-error-catch): Use the `catch' form instead of `try'. * src/instructions.c: Use `scm_from_char ()' instead of the deprecated macro `SCM_MAKINUM ()'. * src/instructions.h (scm_instruction): Made `npop' a signed char. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-2
This commit is contained in:
parent
f9e8c09d42
commit
d8eeb67c89
12 changed files with 111 additions and 79 deletions
31
src/vm.c
31
src/vm.c
|
@ -68,10 +68,10 @@ scm_t_bits scm_tc16_vm_cont;
|
|||
static SCM
|
||||
capture_vm_cont (struct scm_vm *vp)
|
||||
{
|
||||
struct scm_vm *p = scm_must_malloc (sizeof (*p), "capture_vm_cont");
|
||||
struct scm_vm *p = scm_gc_malloc (sizeof (*p), "capture_vm_cont");
|
||||
p->stack_size = vp->stack_limit - vp->sp;
|
||||
p->stack_base = scm_must_malloc (p->stack_size * sizeof (SCM),
|
||||
"capture_vm_cont");
|
||||
p->stack_base = scm_gc_malloc (p->stack_size * sizeof (SCM),
|
||||
"capture_vm_cont");
|
||||
p->stack_limit = p->stack_base + p->stack_size - 2;
|
||||
p->ip = vp->ip;
|
||||
p->sp = (SCM *) (vp->stack_limit - vp->sp);
|
||||
|
@ -110,10 +110,11 @@ static scm_sizet
|
|||
vm_cont_free (SCM obj)
|
||||
{
|
||||
struct scm_vm *p = SCM_VM_CONT_VP (obj);
|
||||
int size = sizeof (struct scm_vm) + p->stack_size * sizeof (SCM);
|
||||
scm_must_free (p->stack_base);
|
||||
scm_must_free (p);
|
||||
return size;
|
||||
|
||||
scm_gc_free (p->stack_base, p->stack_size * sizeof (SCM), "stack-base");
|
||||
scm_gc_free (p, sizeof (struct scm_vm), "vm");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -232,9 +233,11 @@ make_vm (void)
|
|||
#define FUNC_NAME "make_vm"
|
||||
{
|
||||
int i;
|
||||
struct scm_vm *vp = SCM_MUST_MALLOC (sizeof (struct scm_vm));
|
||||
struct scm_vm *vp = scm_gc_malloc (sizeof (struct scm_vm), "vm");
|
||||
|
||||
vp->stack_size = VM_DEFAULT_STACK_SIZE;
|
||||
vp->stack_base = SCM_MUST_MALLOC (vp->stack_size * sizeof (SCM));
|
||||
vp->stack_base = scm_gc_malloc (vp->stack_size * sizeof (SCM),
|
||||
"stack-base");
|
||||
vp->stack_limit = vp->stack_base + vp->stack_size - 3;
|
||||
vp->ip = NULL;
|
||||
vp->sp = vp->stack_base - 1;
|
||||
|
@ -272,10 +275,12 @@ static scm_sizet
|
|||
vm_free (SCM obj)
|
||||
{
|
||||
struct scm_vm *vp = SCM_VM_DATA (obj);
|
||||
int size = (sizeof (struct scm_vm) + vp->stack_size * sizeof (SCM));
|
||||
scm_must_free (vp->stack_base);
|
||||
scm_must_free (vp);
|
||||
return size;
|
||||
|
||||
scm_gc_free (vp->stack_base, vp->stack_size * sizeof (SCM),
|
||||
"stack-base");
|
||||
scm_gc_free (vp, sizeof (struct scm_vm), "vm");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SCM_SYMBOL (sym_debug, "debug");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue