mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 16:20:17 +02:00
allow primcall ops to push 0 values
* libguile/objcodes.c (OBJCODE_COOKIE): Bump the objcode cookie. We'll be doing this on incompatible changes until 2.0. * libguile/vm-i-scheme.c (set_car, set_cdr, slot_set): These instructions don't have natural return values -- so declare them that way, that they push 0 values. * module/language/tree-il/compile-glil.scm (flatten): When compiling primitive calls, check `(instruction-pushes op)' to see how many values that instruction will push, and do something appropriate, instead of just assuming that all primcall ops push 1 value.
This commit is contained in:
parent
a84673a68b
commit
60ed31d28b
3 changed files with 34 additions and 16 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2001, 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -131,20 +131,24 @@ VM_DEFINE_FUNCTION (92, cdr, "cdr", 1)
|
|||
RETURN (SCM_CDR (x));
|
||||
}
|
||||
|
||||
VM_DEFINE_FUNCTION (93, set_car, "set-car!", 2)
|
||||
VM_DEFINE_INSTRUCTION (93, set_car, "set-car!", 0, 2, 0)
|
||||
{
|
||||
ARGS2 (x, y);
|
||||
SCM x, y;
|
||||
POP (y);
|
||||
POP (x);
|
||||
VM_VALIDATE_CONS (x);
|
||||
SCM_SETCAR (x, y);
|
||||
RETURN (SCM_UNSPECIFIED);
|
||||
NEXT;
|
||||
}
|
||||
|
||||
VM_DEFINE_FUNCTION (94, set_cdr, "set-cdr!", 2)
|
||||
VM_DEFINE_INSTRUCTION (94, set_cdr, "set-cdr!", 0, 2, 0)
|
||||
{
|
||||
ARGS2 (x, y);
|
||||
SCM x, y;
|
||||
POP (y);
|
||||
POP (x);
|
||||
VM_VALIDATE_CONS (x);
|
||||
SCM_SETCDR (x, y);
|
||||
RETURN (SCM_UNSPECIFIED);
|
||||
NEXT;
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,13 +267,16 @@ VM_DEFINE_FUNCTION (107, slot_ref, "slot-ref", 2)
|
|||
RETURN (SCM_PACK (SCM_STRUCT_DATA (instance) [slot]));
|
||||
}
|
||||
|
||||
VM_DEFINE_FUNCTION (108, slot_set, "slot-set", 3)
|
||||
VM_DEFINE_INSTRUCTION (108, slot_set, "slot-set", 0, 3, 0)
|
||||
{
|
||||
SCM instance, idx, val;
|
||||
size_t slot;
|
||||
ARGS3 (instance, idx, val);
|
||||
POP (val);
|
||||
POP (idx);
|
||||
POP (instance);
|
||||
slot = SCM_I_INUM (idx);
|
||||
SCM_STRUCT_DATA (instance) [slot] = SCM_UNPACK (val);
|
||||
RETURN (SCM_UNSPECIFIED);
|
||||
NEXT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue