summaryrefslogtreecommitdiff
path: root/libguile/uniform.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-10-30 21:11:03 +0100
committerAndy Wingo <wingo@pobox.com>2013-10-31 12:55:23 +0100
commit7bfbc7b1c50df58a26e3ffb88f809858a03b0e11 (patch)
tree137cb6a32e78e491d861a5839f2bd9be095e6c8a /libguile/uniform.c
parent6a37b7faaf150e9fb7945ef79969cb7671d17367 (diff)
downloadguile-7bfbc7b1c50df58a26e3ffb88f809858a03b0e11.tar.gz
Support serialization of uniform vector literals
* libguile/uniform.h: * libguile/uniform.c (scm_uniform_vector_element_type_code): New interface, returns a type code as an integer. * module/system/vm/assembler.scm (<uniform-vector-backing-store>) (simple-vector?, uniform-array?, statically-allocatable?) (intern-constant, link-data, link-constants): Support uniform arrays, and punt on vectors aren't contiguous from 0. Support for general arrays will come later. * test-suite/tests/rtl.test ("load-constant"): Add tests.
Diffstat (limited to 'libguile/uniform.c')
-rw-r--r--libguile/uniform.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libguile/uniform.c b/libguile/uniform.c
index a58242d81..f8cd2d37b 100644
--- a/libguile/uniform.c
+++ b/libguile/uniform.c
@@ -132,6 +132,25 @@ SCM_DEFINE (scm_uniform_vector_element_type, "uniform-vector-element-type", 1, 0
}
#undef FUNC_NAME
+SCM_DEFINE (scm_uniform_vector_element_type_code,
+ "uniform-vector-element-type-code", 1, 0, 0,
+ (SCM v),
+ "Return the type of the elements in the uniform vector, @var{v},\n"
+ "as an integer code.")
+#define FUNC_NAME s_scm_uniform_vector_element_type_code
+{
+ scm_t_array_handle h;
+ SCM ret;
+
+ if (!scm_is_uniform_vector (v))
+ scm_wrong_type_arg_msg (FUNC_NAME, SCM_ARG1, v, "uniform vector");
+ scm_array_get_handle (v, &h);
+ ret = scm_from_uint16 (h.element_type);
+ scm_array_handle_release (&h);
+ return ret;
+}
+#undef FUNC_NAME
+
SCM_DEFINE (scm_uniform_vector_element_size, "uniform-vector-element-size", 1, 0, 0,
(SCM v),
"Return the number of bytes allocated to each element in the\n"