summaryrefslogtreecommitdiff
path: root/libguile/vm-i-loader.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-06-05 16:31:38 +0200
committerAndy Wingo <wingo@pobox.com>2009-06-05 16:31:38 +0200
commit782a82eed13abb64393f7acad92758ae191ce509 (patch)
tree517a209c703d8810789dbdf3cfc23a835e21e5b1 /libguile/vm-i-loader.c
parenta9b0f876c12bbbca9bdf1890eb014a30f004d9f8 (diff)
downloadguile-782a82eed13abb64393f7acad92758ae191ce509.tar.gz
add ability to compile uniform arrays
* module/rnrs/bytevector.scm (rnrs): * libguile/bytevectors.h: * libguile/bytevectors.c (scm_uniform_array_to_bytevector): New function. * libguile/unif.h: * libguile/unif.c (scm_from_contiguous_typed_array): New function. * libguile/vm-i-loader.c (load-array): New instruction, for loading byte data into uniform vectors. Currently it copies out the data, though in the future we could avoid that. * module/language/assembly.scm (align-code): New exported function, aligns code on some boundary. (align-program): Use align-code. * module/language/assembly/compile-bytecode.scm (write-bytecode): Support the load-array instruction. * module/language/glil/compile-assembly.scm (dump-object): Dump uniform arrays. Neat :)
Diffstat (limited to 'libguile/vm-i-loader.c')
-rw-r--r--libguile/vm-i-loader.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libguile/vm-i-loader.c b/libguile/vm-i-loader.c
index b231d392f..50569e01a 100644
--- a/libguile/vm-i-loader.c
+++ b/libguile/vm-i-loader.c
@@ -15,6 +15,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/* FIXME! Need to check that the fetch is within the current program */
/* This file is included in vm_engine.c */
@@ -143,6 +144,19 @@ VM_DEFINE_LOADER (67, define, "define")
NEXT;
}
+VM_DEFINE_LOADER (68, load_array, "load-array")
+{
+ SCM type, shape;
+ size_t len;
+ FETCH_LENGTH (len);
+ POP (shape);
+ POP (type);
+ SYNC_REGISTER ();
+ PUSH (scm_from_contiguous_typed_array (type, shape, ip, len));
+ ip += len;
+ NEXT;
+}
+
/*
(defun renumber-ops ()
"start from top of buffer and renumber 'VM_DEFINE_FOO (\n' sequences"