guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, boehm-demers-weiser-gc, updated. relea


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, boehm-demers-weiser-gc, updated. release_1-9-2-277-g0665b3f
Date: Sun, 30 Aug 2009 23:18:27 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=0665b3ffcb7ec5232a51ff632a818a638dfd4054

The branch, boehm-demers-weiser-gc has been updated
       via  0665b3ffcb7ec5232a51ff632a818a638dfd4054 (commit)
       via  807e5a6641b2aa37ce4198a6c13f1aaebd3a5f25 (commit)
      from  d6097d1d63a269ce960c47f81902aaaf26d46a64 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0665b3ffcb7ec5232a51ff632a818a638dfd4054
Author: Ludovic Courtès <address@hidden>
Date:   Mon Aug 31 01:07:30 2009 +0200

    Remove the distinction between inline/outline storage for bytevectors.
    
    * libguile/bytevectors.c (SCM_BYTEVECTOR_INLINE_THRESHOLD,
      SCM_BYTEVECTOR_INLINEABLE_SIZE_P, SCM_BYTEVECTOR_SET_CONTENTS,
      SCM_BYTEVECTOR_SET_INLINE): Remove.
      (SCM_BYTEVECTOR_HEADER_BYTES): New macro.
      (SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Adjust to new flag layout.
      (make_bytevector): Remove content inlining machinery; use
      `scm_gc_malloc_pointerless ()' in all cases; special-case zero-sized
      vu8 buffers.
      (make_bytevector_from_buffer): Simplified.
      (scm_c_shrink_bytevector): New, formerly `scm_i_shrink_bytevector ()'.
      Remove buffer inlining machinery.
      (scm_bootstrap_bytevectors): Use `make_bytevector ()' for
      SCM_NULL_BYTEVECTOR.
    
    * libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): New macro.
      (SCM_BYTEVECTOR_CONTENTS): Adjust to new layout.
      (SCM_SET_BYTEVECTOR_FLAGS): Properly cast F.
      (SCM_F_BYTEVECTOR_INLINE, SCM_BYTEVECTOR_INLINE_P): Remove.
      (SCM_BYTEVECTOR_ELEMENT_TYPE): Adjust.
      (scm_c_shrink_bytevector): Remove macro, make a C function
      declaration.

commit 807e5a6641b2aa37ce4198a6c13f1aaebd3a5f25
Author: Ludovic Courtès <address@hidden>
Date:   Sun Aug 30 20:12:09 2009 +0200

    Use a TC7 tag instead of a SMOB for bytevectors.
    
    * libguile/bytevectors.c (scm_tc16_bytevector): Remove.
      (SCM_BYTEVECTOR_SET_LENGTH, SCM_BYTEVECTOR_SET_CONTENTS,
      SCM_BYTEVECTOR_SET_INLINE, SCM_BYTEVECTOR_SET_ELEMENT_TYPE,
      make_bytevector_from_buffer, scm_is_bytevector,
      scm_bootstrap_bytevectors): Adjust to the SMOB->tc7 change.
      (scm_i_print_bytevector): New, formerly `print_bytevector ()'.
      (bytevector_equal_p): Remove.
    
    * libguile/bytevectors.h (SCM_BYTEVECTOR_LENGTH,
      SCM_BYTEVECTOR_CONTENTS, SCM_BYTEVECTOR_P): Adjust to SMOB->tc7
      change.
      (SCM_BYTEVECTOR_FLAGS, SCM_SET_BYTEVECTOR_FLAGS): New macros.
      (scm_tc16_bytevector): Remove declaration.
      (scm_i_print_bytevector): New declaration.
    
    * libguile/eq.c (scm_equal_p): Handle `scm_tc7_bytevector'.
    
    * libguile/evalext.c (scm_self_evaluating_p): Likewise.
    
    * libguile/print.c (iprin1): Likewise.
    
    * libguile/tags.h (scm_tc7_bytevector): New.
      (scm_tc7_unused_8): Remove.
    
    * libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): Adjust.
    
    * test-suite/tests/bytevectors.test ("Datum
      Syntax")["self-evaluating?"]: New test.

-----------------------------------------------------------------------

Summary of changes:
 libguile/bytevectors.c            |  167 +++++++++++++++----------------------
 libguile/bytevectors.h            |   40 ++++-----
 libguile/eq.c                     |    3 +
 libguile/evalext.c                |    1 +
 libguile/print.c                  |    3 +
 libguile/tags.h                   |    2 +-
 libguile/validate.h               |    5 +-
 test-suite/tests/bytevectors.test |    3 +
 8 files changed, 100 insertions(+), 124 deletions(-)

diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index b2e5ec9..4246f01 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -175,19 +175,14 @@
 
 /* Bytevector type.  */
 
-scm_t_bits scm_tc16_bytevector;
+#define SCM_BYTEVECTOR_HEADER_BYTES            \
+  (SCM_BYTEVECTOR_HEADER_SIZE * sizeof (SCM))
 
-#define SCM_BYTEVECTOR_INLINE_THRESHOLD  (2 * sizeof (SCM))
-#define SCM_BYTEVECTOR_INLINEABLE_SIZE_P(_size)        \
-  ((_size) <= SCM_BYTEVECTOR_INLINE_THRESHOLD)
 #define SCM_BYTEVECTOR_SET_LENGTH(_bv, _len)            \
-  SCM_SET_SMOB_DATA ((_bv), (scm_t_bits) (_len))
-#define SCM_BYTEVECTOR_SET_CONTENTS(_bv, _buf)          \
-  SCM_SET_SMOB_DATA_2 ((_bv), (scm_t_bits) (_buf))
-#define SCM_BYTEVECTOR_SET_INLINE(bv)                                   \
-  SCM_SET_SMOB_FLAGS (bv, SCM_SMOB_FLAGS (bv) | SCM_F_BYTEVECTOR_INLINE)
-#define SCM_BYTEVECTOR_SET_ELEMENT_TYPE(bv, hint)                          \
-  SCM_SET_SMOB_FLAGS (bv, (SCM_SMOB_FLAGS (bv) & 0xFF) | (hint << 8))
+  SCM_SET_CELL_WORD_1 ((_bv), (scm_t_bits) (_len))
+
+#define SCM_BYTEVECTOR_SET_ELEMENT_TYPE(bv, hint)      \
+  SCM_SET_BYTEVECTOR_FLAGS ((bv), (hint))
 #define SCM_BYTEVECTOR_TYPE_SIZE(var)                           \
   (scm_i_array_element_type_sizes[SCM_BYTEVECTOR_ELEMENT_TYPE (var)]/8)
 #define SCM_BYTEVECTOR_TYPED_LENGTH(var)                        \
@@ -198,66 +193,65 @@ SCM scm_null_bytevector = SCM_UNSPECIFIED;
 
 
 static inline SCM
-make_bytevector_from_buffer (size_t len, void *contents,
-                             scm_t_array_element_type element_type)
+make_bytevector (size_t len, scm_t_array_element_type element_type)
 {
   SCM ret;
   size_t c_len;
-  
+
   if (SCM_UNLIKELY (element_type > SCM_ARRAY_ELEMENT_TYPE_LAST
                     || scm_i_array_element_type_sizes[element_type] < 8
                     || len >= (SCM_I_SIZE_MAX
                                / 
(scm_i_array_element_type_sizes[element_type]/8))))
     /* This would be an internal Guile programming error */
     abort ();
-  
-  c_len = len * (scm_i_array_element_type_sizes[element_type] / 8);
-  if (!SCM_BYTEVECTOR_INLINEABLE_SIZE_P (c_len))
-    SCM_NEWSMOB2 (ret, scm_tc16_bytevector, c_len, contents);
+
+  if (SCM_UNLIKELY (len == 0 && element_type == SCM_ARRAY_ELEMENT_TYPE_VU8
+                   && SCM_BYTEVECTOR_P (scm_null_bytevector)))
+    ret = scm_null_bytevector;
   else
     {
-      SCM_NEWSMOB2 (ret, scm_tc16_bytevector, c_len, NULL);
-      SCM_BYTEVECTOR_SET_INLINE (ret);
-      if (contents)
-        {
-          memcpy (SCM_BYTEVECTOR_CONTENTS (ret), contents, c_len);
-          scm_gc_free (contents, c_len, SCM_GC_BYTEVECTOR);
-        }
+      c_len = len * (scm_i_array_element_type_sizes[element_type] / 8);
+
+      ret = PTR2SCM (scm_gc_malloc_pointerless (SCM_BYTEVECTOR_HEADER_BYTES + 
c_len,
+                                               SCM_GC_BYTEVECTOR));
+
+      SCM_SET_CELL_TYPE (ret, scm_tc7_bytevector);
+      SCM_BYTEVECTOR_SET_LENGTH (ret, c_len);
+      SCM_BYTEVECTOR_SET_ELEMENT_TYPE (ret, element_type);
     }
-  SCM_BYTEVECTOR_SET_ELEMENT_TYPE (ret, element_type);
+
   return ret;
 }
 
+/* Return a bytevector of LEN elements of type ELEMENT_TYPE, with element
+   values taken from CONTENTS.  */
 static inline SCM
-make_bytevector (size_t len, scm_t_array_element_type element_type)
+make_bytevector_from_buffer (size_t len, void *contents,
+                            scm_t_array_element_type element_type)
 {
-  size_t c_len;
+  SCM ret;
 
-  if (SCM_UNLIKELY (len == 0 && element_type == 0))
-    return scm_null_bytevector;
-  else if (SCM_UNLIKELY (element_type > SCM_ARRAY_ELEMENT_TYPE_LAST
-                         || scm_i_array_element_type_sizes[element_type] < 8
-                         || len >= (SCM_I_SIZE_MAX
-                                    / 
(scm_i_array_element_type_sizes[element_type]/8))))
-    /* This would be an internal Guile programming error */
-    abort ();
+  /* We actually never reuse storage from CONTENTS.  Hans Boehm says in
+     <gc/gc.h> that realloc(3) "shouldn't have been invented" and he may well
+     be right.  */
+  ret = make_bytevector (len, element_type);
 
-  c_len = len * (scm_i_array_element_type_sizes[element_type]/8);
-  if (SCM_BYTEVECTOR_INLINEABLE_SIZE_P (c_len))
+  if (len > 0)
     {
-      SCM ret;
-      SCM_NEWSMOB2 (ret, scm_tc16_bytevector, c_len, NULL);
-      SCM_BYTEVECTOR_SET_INLINE (ret);
-      SCM_BYTEVECTOR_SET_ELEMENT_TYPE (ret, element_type);
-      return ret;
-    }
-  else
-    {
-      void *buf = scm_gc_malloc_pointerless (c_len, SCM_GC_BYTEVECTOR);
-      return make_bytevector_from_buffer (len, buf, element_type);
+      size_t c_len;
+
+      c_len = len * (scm_i_array_element_type_sizes[element_type] / 8);
+      memcpy (SCM_BYTEVECTOR_CONTENTS (ret),
+             contents,
+             c_len);
+
+      scm_gc_free (contents, c_len, SCM_GC_BYTEVECTOR);
     }
+
+  return ret;
 }
 
+
 /* Return a new bytevector of size LEN octets.  */
 SCM
 scm_c_make_bytevector (size_t len)
@@ -288,50 +282,36 @@ scm_c_take_typed_bytevector (signed char *contents, 
size_t len,
 }
 
 /* Shrink BV to C_NEW_LEN (which is assumed to be smaller than its current
-   size) and return BV.  */
+   size) and return the new bytevector (possibly different from BV).  */
 SCM
-scm_i_shrink_bytevector (SCM bv, size_t c_new_len)
+scm_c_shrink_bytevector (SCM bv, size_t c_new_len)
 {
+  SCM new_bv;
+  size_t c_len;
+
   if (SCM_UNLIKELY (c_new_len % SCM_BYTEVECTOR_TYPE_SIZE (bv)))
     /* This would be an internal Guile programming error */
     abort ();
 
-  if (!SCM_BYTEVECTOR_INLINE_P (bv))
-    {
-      size_t c_len;
-      signed char *c_bv, *c_new_bv;
-
-      c_len = SCM_BYTEVECTOR_LENGTH (bv);
-      c_bv = SCM_BYTEVECTOR_CONTENTS (bv);
+  c_len = SCM_BYTEVECTOR_LENGTH (bv);
+  if (SCM_UNLIKELY (c_new_len > c_len))
+    abort ();
 
-      SCM_BYTEVECTOR_SET_LENGTH (bv, c_new_len);
+  SCM_BYTEVECTOR_SET_LENGTH (bv, c_new_len);
 
-      if (SCM_BYTEVECTOR_INLINEABLE_SIZE_P (c_new_len))
-       {
-         /* Copy to the in-line buffer and free the current buffer.  */
-          SCM_BYTEVECTOR_SET_INLINE (bv);
-         c_new_bv = SCM_BYTEVECTOR_CONTENTS (bv);
-         memcpy (c_new_bv, c_bv, c_new_len);
-         scm_gc_free (c_bv, c_len, SCM_GC_BYTEVECTOR);
-       }
-      else
-       {
-         /* Resize the existing buffer.  */
-         c_new_bv = scm_gc_realloc (c_bv, c_len, c_new_len,
-                                    SCM_GC_BYTEVECTOR);
-         SCM_BYTEVECTOR_SET_CONTENTS (bv, c_new_bv);
-       }
-    }
-  else
-    SCM_BYTEVECTOR_SET_LENGTH (bv, c_new_len);
+  /* Resize the existing buffer.  */
+  new_bv = PTR2SCM (scm_gc_realloc (SCM2PTR (bv),
+                                   c_len + SCM_BYTEVECTOR_HEADER_BYTES,
+                                   c_new_len + SCM_BYTEVECTOR_HEADER_BYTES,
+                                   SCM_GC_BYTEVECTOR));
 
-  return bv;
+  return new_bv;
 }
 
 int
 scm_is_bytevector (SCM obj)
 {
-  return SCM_SMOB_PREDICATE (scm_tc16_bytevector, obj);
+  return SCM_BYTEVECTOR_P (obj);
 }
 
 size_t
@@ -384,10 +364,8 @@ scm_c_bytevector_set_x (SCM bv, size_t index, scm_t_uint8 
value)
 
 
 
-
-
-static int
-print_bytevector (SCM bv, SCM port, scm_print_state *pstate SCM_UNUSED)
+int
+scm_i_print_bytevector (SCM bv, SCM port, scm_print_state *pstate SCM_UNUSED)
 {
   ssize_t ubnd, inc, i;
   scm_t_array_handle h;
@@ -409,12 +387,6 @@ print_bytevector (SCM bv, SCM port, scm_print_state 
*pstate SCM_UNUSED)
   return 1;
 }
 
-static SCM
-bytevector_equal_p (SCM bv1, SCM bv2)
-{
-  return scm_bytevector_eq_p (bv1, bv2);
-}
-
 
 /* General operations.  */
 
@@ -2237,16 +2209,11 @@ bytevector_get_handle (SCM v, scm_t_array_handle *h)
 void
 scm_bootstrap_bytevectors (void)
 {
-  /* The SMOB type must be instantiated here because the
-     generalized-vector API may want to access bytevectors even though
-     `(rnrs bytevector)' hasn't been loaded.  */
-  scm_tc16_bytevector = scm_make_smob_type ("bytevector", 0);
-  scm_set_smob_print (scm_tc16_bytevector, print_bytevector);
-  scm_set_smob_equalp (scm_tc16_bytevector, bytevector_equal_p);
-
+  /* This must be instantiated here because the generalized-vector API may
+     want to access bytevectors even though `(rnrs bytevector)' hasn't been
+     loaded.  */
   scm_null_bytevector =
-    scm_gc_protect_object
-    (make_bytevector_from_buffer (0, NULL, SCM_ARRAY_ELEMENT_TYPE_VU8));
+    scm_gc_protect_object (make_bytevector (0, SCM_ARRAY_ELEMENT_TYPE_VU8));
 
 #ifdef WORDS_BIGENDIAN
   scm_i_native_endianness = scm_permanent_object (scm_from_locale_symbol 
("big"));
@@ -2260,9 +2227,9 @@ scm_bootstrap_bytevectors (void)
 
   {
     scm_t_array_implementation impl;
-    
-    impl.tag = scm_tc16_bytevector;
-    impl.mask = 0xffff;
+
+    impl.tag = scm_tc7_bytevector;
+    impl.mask = 0x7f;
     impl.vref = bv_handle_ref;
     impl.vset = bv_handle_set_x;
     impl.get_handle = bytevector_get_handle;
diff --git a/libguile/bytevectors.h b/libguile/bytevectors.h
index e29fe6d..5063126 100644
--- a/libguile/bytevectors.h
+++ b/libguile/bytevectors.h
@@ -26,12 +26,15 @@
 
 /* R6RS bytevectors.  */
 
+/* The size in words of the bytevector header (type tag, flags, and
+   length).  */
+#define SCM_BYTEVECTOR_HEADER_SIZE   2U
+
 #define SCM_BYTEVECTOR_LENGTH(_bv)             \
-  ((size_t) SCM_SMOB_DATA (_bv))
-#define SCM_BYTEVECTOR_CONTENTS(_bv)           \
-  (SCM_BYTEVECTOR_INLINE_P (_bv)                       \
-   ? (signed char *) SCM_SMOB_OBJECT_2_LOC (_bv)       \
-   : (signed char *) SCM_SMOB_DATA_2 (_bv))
+  ((size_t) SCM_CELL_WORD_1 (_bv))
+#define SCM_BYTEVECTOR_CONTENTS(_bv)                                   \
+  ((signed char *) SCM_CELL_OBJECT_LOC ((_bv),                         \
+                                       SCM_BYTEVECTOR_HEADER_SIZE))
 
 
 SCM_API SCM scm_endianness_big;
@@ -112,17 +115,16 @@ SCM_API SCM scm_utf32_to_string (SCM, SCM);
 
 /* Internal API.  */
 
-/* The threshold (in octets) under which bytevectors are stored "in-line",
-   i.e., without allocating memory beside the SMOB itself (a double cell).
-   This optimization is necessary since small bytevectors are expected to be
-   common.  */
-#define SCM_BYTEVECTOR_P(_bv)                   \
-  SCM_SMOB_PREDICATE (scm_tc16_bytevector, _bv)
-#define SCM_F_BYTEVECTOR_INLINE 0x1
-#define SCM_BYTEVECTOR_INLINE_P(_bv)            \
-  (SCM_SMOB_FLAGS (_bv) & SCM_F_BYTEVECTOR_INLINE)
+#define SCM_BYTEVECTOR_P(x)                            \
+  (!SCM_IMP (x) && SCM_TYP7(x) == scm_tc7_bytevector)
+#define SCM_BYTEVECTOR_FLAGS(_bv)              \
+  (SCM_CELL_TYPE (_bv) >> 7UL)
+#define SCM_SET_BYTEVECTOR_FLAGS(_bv, _f)                              \
+  SCM_SET_CELL_TYPE ((_bv),                                            \
+                    scm_tc7_bytevector | ((scm_t_bits)(_f) << 7UL))
+
 #define SCM_BYTEVECTOR_ELEMENT_TYPE(_bv)       \
-  (SCM_SMOB_FLAGS (_bv) >> 8)
+  (SCM_BYTEVECTOR_FLAGS (_bv))
 
 /* Hint that is passed to `scm_gc_malloc ()' and friends.  */
 #define SCM_GC_BYTEVECTOR "bytevector"
@@ -134,16 +136,12 @@ SCM_INTERNAL SCM scm_c_take_typed_bytevector (signed char 
*, size_t,
 SCM_INTERNAL void scm_bootstrap_bytevectors (void);
 SCM_INTERNAL void scm_init_bytevectors (void);
 
-SCM_INTERNAL scm_t_bits scm_tc16_bytevector;
 SCM_INTERNAL SCM scm_i_native_endianness;
 SCM_INTERNAL SCM scm_c_take_bytevector (signed char *, size_t);
 
-#define scm_c_shrink_bytevector(_bv, _len)             \
-  (SCM_BYTEVECTOR_INLINE_P (_bv)                       \
-   ? (_bv)                                             \
-   : scm_i_shrink_bytevector ((_bv), (_len)))
+SCM_INTERNAL int scm_i_print_bytevector (SCM, SCM, scm_print_state *);
 
-SCM_INTERNAL SCM scm_i_shrink_bytevector (SCM, size_t);
+SCM_INTERNAL SCM scm_c_shrink_bytevector (SCM, size_t);
 SCM_INTERNAL void scm_i_bytevector_generalized_set_x (SCM, size_t, SCM);
 SCM_INTERNAL SCM scm_null_bytevector;
 
diff --git a/libguile/eq.c b/libguile/eq.c
index 11dee27..fadd756 100644
--- a/libguile/eq.c
+++ b/libguile/eq.c
@@ -30,6 +30,7 @@
 #include "libguile/smob.h"
 #include "libguile/arrays.h"
 #include "libguile/vectors.h"
+#include "libguile/bytevectors.h"
 
 #include "libguile/struct.h"
 #include "libguile/goops.h"
@@ -239,6 +240,8 @@ SCM_PRIMITIVE_GENERIC_1 (scm_equal_p, "equal?", 
scm_tc7_rpsubr,
     }
   if (SCM_TYP7 (x) == scm_tc7_string && SCM_TYP7 (y) == scm_tc7_string)
     return scm_string_equal_p (x, y);
+  if (SCM_TYP7 (x) == scm_tc7_bytevector && SCM_TYP7 (y) == scm_tc7_bytevector)
+    return scm_bytevector_eq_p (x, y);
   if (SCM_TYP7 (x) == scm_tc7_smob && SCM_TYP16 (x) == SCM_TYP16 (y))
     {
       int i = SCM_SMOBNUM (x);
diff --git a/libguile/evalext.c b/libguile/evalext.c
index b1f185c..78b666f 100644
--- a/libguile/evalext.c
+++ b/libguile/evalext.c
@@ -83,6 +83,7 @@ SCM_DEFINE (scm_self_evaluating_p, "self-evaluating?", 1, 0, 
0,
        case scm_tc7_smob:
        case scm_tc7_pws:
        case scm_tc7_program:
+       case scm_tc7_bytevector:
        case scm_tcs_subrs:
        case scm_tcs_struct:
          return SCM_BOOL_T;
diff --git a/libguile/print.c b/libguile/print.c
index c38eba7..3bb6cb1 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -739,6 +739,9 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate)
            scm_puts ("#w(", port);
          goto common_vector_printer;
 
+       case scm_tc7_bytevector:
+         scm_i_print_bytevector (exp, port, pstate);
+         break;
        case scm_tc7_vector:
          ENTER_NESTED_DATA (pstate, exp, circref);
          scm_puts ("#(", port);
diff --git a/libguile/tags.h b/libguile/tags.h
index e51b865..9a52093 100644
--- a/libguile/tags.h
+++ b/libguile/tags.h
@@ -434,6 +434,7 @@ typedef unsigned long scm_t_bits;
 #define scm_tc7_string         21
 #define scm_tc7_number         23
 #define scm_tc7_stringbuf       39
+#define scm_tc7_bytevector     77
 
 /* Many of the following should be turned
  * into structs or smobs.  We need back some
@@ -448,7 +449,6 @@ typedef unsigned long scm_t_bits;
 #define scm_tc7_unused_5       53
 #define scm_tc7_unused_6       55
 #define scm_tc7_unused_7       71
-#define scm_tc7_unused_8       77
 
 #define scm_tc7_dsubr          61
 #define scm_tc7_gsubr          63
diff --git a/libguile/validate.h b/libguile/validate.h
index b48bec7..8c79469 100644
--- a/libguile/validate.h
+++ b/libguile/validate.h
@@ -151,8 +151,9 @@
     cvar = scm_to_bool (flag); \
   } while (0)
 
-#define SCM_VALIDATE_BYTEVECTOR(_pos, _obj)            \
-  SCM_VALIDATE_SMOB ((_pos), (_obj), bytevector)
+#define SCM_VALIDATE_BYTEVECTOR(_pos, _obj)                    \
+  SCM_ASSERT_TYPE (SCM_BYTEVECTOR_P (_obj), (_obj), (_pos),    \
+                  FUNC_NAME, "bytevector")
 
 #define SCM_VALIDATE_CHAR(pos, scm) SCM_MAKE_VALIDATE_MSG (pos, scm, CHARP, 
"character")
 
diff --git a/test-suite/tests/bytevectors.test 
b/test-suite/tests/bytevectors.test
index 8b336bb..1009fb0 100644
--- a/test-suite/tests/bytevectors.test
+++ b/test-suite/tests/bytevectors.test
@@ -565,6 +565,9 @@
     (equal? (with-input-from-string "#vu8(0 255 127 128)" read)
             (u8-list->bytevector '(0 255 127 128))))
 
+  (pass-if "self-evaluating?"
+    (self-evaluating? (make-bytevector 1)))
+
   (pass-if "self-evaluating"
     (equal? (eval (with-input-from-string "#vu8(1 2 3 4 5)" read)
                   (current-module))


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]