~ chicken-core (chicken-5) b755bbf2647a00ec9301fea472344327d21587ff
commit b755bbf2647a00ec9301fea472344327d21587ff
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Nov 12 08:37:23 2010 -0500
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Fri Nov 12 08:37:23 2010 -0500
internal unboxing support for ints
diff --git a/c-backend.scm b/c-backend.scm
index 85e38498..9df76d5c 100644
--- a/c-backend.scm
+++ b/c-backend.scm
@@ -733,6 +733,7 @@
((flonum) "double")
((char) "char")
((pointer) "void *")
+ ((int) "int")
((bool) "int")
(else (bomb "invalid unboxed type" t))))
diff --git a/srfi-18.scm b/srfi-18.scm
index 46fca8e1..67aefdca 100644
--- a/srfi-18.scm
+++ b/srfi-18.scm
@@ -216,7 +216,7 @@
(define (thread-suspend! thread)
(##sys#check-structure thread 'thread 'thread-suspend!)
(##sys#setslot thread 3 'suspended)
- (when (eq? thread ##sys#current-thread)
+ (when (eq? thread ##sys#current-thread) ;XXX what if thread is ready or blocked?
(##sys#call-with-current-continuation
(lambda (return)
(##sys#setslot thread 1 (lambda () (return (##core#undefined))))
@@ -224,7 +224,7 @@
(define (thread-resume! thread)
(##sys#check-structure thread 'thread 'thread-resume!)
- (when (eq? (##sys#slot thread 3) 'suspended)
+ (when (eq? (##sys#slot thread 3) 'suspended) ;XXX what if thread is ready or blocked?
(##sys#setslot thread 3 'ready)
(##sys#add-to-ready-queue thread) ) )
diff --git a/unboxing.scm b/unboxing.scm
index fc0ff825..91a44f59 100644
--- a/unboxing.scm
+++ b/unboxing.scm
@@ -117,6 +117,10 @@
(make-node
'##core#inline_allocate (list "C_a_i_flonum" 4) ; hardcoded size
(list (make-node '##core#unboxed_ref (list tmp rtype) '()))))
+ ((int)
+ (make-node
+ '##core#inline_allocate (list "C_a_int_to_num" 4) ; hardcoded size
+ (list (make-node '##core#unboxed_ref (list tmp rtype) '()))))
((pointer)
(make-node
'##core#inline_allocate (list "C_a_i_mpointer" 2) ; hardcoded size
@@ -151,6 +155,7 @@
((char) "C_character_code")
((fixnum) "C_unfix")
((flonum) "C_flonum_magnitude")
+ ((int) "C_num_to_int")
((pointer) "C_pointer_address")
((bool) "C_truep")
((*) "C_id")
Trap