summaryrefslogtreecommitdiff
path: root/libguile/frames.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-11-21 10:32:33 +0100
committerAndy Wingo <wingo@pobox.com>2015-12-01 15:42:19 +0100
commit8bf77f7192dd319cf5391639310abb35b9e627d7 (patch)
tree7cc17b7847a1de7ec736268eafe2041d96dcd3f8 /libguile/frames.c
parentf34688ad25c8e4cb1ebc97734f255d36518d763f (diff)
downloadguile-8bf77f7192dd319cf5391639310abb35b9e627d7.tar.gz
Add support for unboxed s64 values
* libguile/frames.c (enum stack_item_representation): (scm_to_stack_item_representation): (scm_frame_local_ref, scm_frame_local_set_x): Support for S64 representations. * libguile/frames.h (union scm_vm_stack_element): Add signed 64-bit integer field. * libguile/vm-engine.c (scm->s64, s64->scm, load-s64): New instructions. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/cse.scm (compute-equivalent-subexpressions): * module/language/cps/effects-analysis.scm: * module/language/cps/slot-allocation.scm (compute-var-representations) (compute-needs-slot, allocate-slots): * module/language/cps/utils.scm (compute-constant-values): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Add support for new primcalls. * module/language/cps/types.scm (&s64): New type. (&s64-min, &s64-max, &u64-max): New convenience definitions. (&range-min, &range-max): Use &s64-min and &u64-max names. (scm->s64, load-s64, s64->scm): Add support for new primcalls. * module/system/vm/assembler.scm (emit-scm->s64, emit-s64->scm) (emit-load-s64): New exports. * module/system/vm/assembler.scm (write-arities): Support for s64 slots. * module/system/vm/debug.scm (arity-definitions): Support for s64 slots.
Diffstat (limited to 'libguile/frames.c')
-rw-r--r--libguile/frames.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libguile/frames.c b/libguile/frames.c
index e70b25212..e1d7cf872 100644
--- a/libguile/frames.c
+++ b/libguile/frames.c
@@ -242,7 +242,8 @@ enum stack_item_representation
{
STACK_ITEM_SCM = 0,
STACK_ITEM_F64 = 1,
- STACK_ITEM_U64 = 2
+ STACK_ITEM_U64 = 2,
+ STACK_ITEM_S64 = 3
};
static enum stack_item_representation
@@ -254,6 +255,8 @@ scm_to_stack_item_representation (SCM x, const char *subr, int pos)
return STACK_ITEM_F64;
if (scm_is_eq (x, scm_from_latin1_symbol ("u64")))
return STACK_ITEM_U64;
+ if (scm_is_eq (x, scm_from_latin1_symbol ("s64")))
+ return STACK_ITEM_S64;
scm_wrong_type_arg (subr, pos, x);
return 0; /* Not reached. */
@@ -286,6 +289,8 @@ SCM_DEFINE (scm_frame_local_ref, "frame-local-ref", 3, 0, 0,
return scm_from_double (item->as_f64);
case STACK_ITEM_U64:
return scm_from_uint64 (item->as_u64);
+ case STACK_ITEM_S64:
+ return scm_from_int64 (item->as_s64);
default:
abort();
}
@@ -326,6 +331,9 @@ SCM_DEFINE (scm_frame_local_set_x, "frame-local-set!", 4, 0, 0,
case STACK_ITEM_U64:
item->as_u64 = scm_to_uint64 (val);
break;
+ case STACK_ITEM_S64:
+ item->as_s64 = scm_to_int64 (val);
+ break;
default:
abort();
}