1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 08:40:19 +02:00

allow compilation of #@2(1 2 3)

* libguile/arrays.h:
* libguile/arrays.c (scm_from_contiguous_array): New public function,
  like scm_from_contiguous_typed_array but for arrays of generic Scheme
  values.

* libguile/vm-i-scheme.c (make-struct): Sync regs before making the
  struct, so if we get a GC the regs are on the heap.
  (make-array): New instruction, makes an generic (untyped) Scheme
  array.

* module/language/glil/compile-assembly.scm (dump-object): Correctly
  compile arrays.
This commit is contained in:
Andy Wingo 2010-01-11 21:47:10 +01:00
parent 5a9c6dcbb3
commit 73788ca8be
4 changed files with 71 additions and 3 deletions

View file

@ -580,6 +580,21 @@
(addr+ (addr+ addr type) shape)
8
4))))
((array? x)
;; an array of generic scheme values
(let* ((contents (array-contents x))
(len (vector-length contents)))
(let dump-objects ((i 0) (codes '()) (addr addr))
(if (< i len)
(let ((code (dump-object (vector-ref x i) addr)))
(dump-objects (1+ i) (cons code codes)
(addr+ addr code)))
(fold append
`(,@(dump-object (array-shape x) addr)
(make-array ,(quotient (ash len -16) 256)
,(logand #xff (ash len -8))
,(logand #xff len)))
codes)))))
(else
(error "assemble: unrecognized object" x))))