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

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.
This commit is contained in:
Andy Wingo 2013-10-30 21:11:03 +01:00
parent 6a37b7faaf
commit 7bfbc7b1c5
4 changed files with 81 additions and 7 deletions

View file

@ -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"