1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-22 03:30:22 +02:00

Remove the distinction between inline/outline storage for stringbufs.

* libguile/strings.c (STRINGBUF_HEADER_SIZE, STRINGBUF_HEADER_BYTES):
  New macros.
  (STRINGBUF_F_INLINE, STRINGBUF_INLINE, STRINGBUF_OUTLINE_CHARS,
  STRINGBUF_OUTLINE_LENGTH, STRINGBUF_INLINE_CHARS,
  STRINGBUF_INLINE_LENGTH, STRINGBUF_MAX_INLINE_LEN): Remove.
  (STRINGBUF_CHARS, STRINGBUF_WIDE_CHARS): Adjust to return a fixed
  location.
  (STRINGBUF_LENGTH): Get the length from word 1.
  (make_stringbuf, make_wide_stringbuf): Adjust to use a contiguous
  memory region.
  (wide_stringbuf): Renamed from `widen_stringbuf'.  Adjust similarly.
  Return the new stringbuf.  Callers updated.
  (narrow_stringbuf): Likewise.
  (scm_sys_string_dump, scm_sys_symbol_dump): Remove `stringbuf-inline'
  pair.

* test-suite/tests/strings.test ("string internals")["null strings are
  inlined", "short Latin-1 encoded strings are inlined", "long Latin-1
  encoded strings are not inlined", "short UCS-4 encoded strings are not
  inlined", "long UCS-4 encoded strings are not inlined"]: Remove.

* test-suite/tests/symbols.test ("symbol internals")["null symbols are
  inlined", "short Latin-1 encoded symbols are inlined", "long Latin-1
  encoded symbols are not inlined", "short UCS-4 encoded symbols are not
  inlined", "long UCS-4 encoded symbols are not inlined"]: Remove.
This commit is contained in:
Ludovic Courtès 2009-09-01 02:02:43 +02:00
parent 13a9455669
commit ba54a2026b
3 changed files with 91 additions and 169 deletions

View file

@ -63,26 +63,6 @@
(let ((s (substring/read-only "zyx" 0)))
(assq-ref (%string-dump s) 'read-only)))
(pass-if "null strings are inlined"
(let ((s ""))
(assq-ref (%string-dump s) 'stringbuf-inline)))
(pass-if "short Latin-1 encoded strings are inlined"
(let ((s "m"))
(assq-ref (%string-dump s) 'stringbuf-inline)))
(pass-if "long Latin-1 encoded strings are not inlined"
(let ((s "0123456789012345678901234567890123456789"))
(not (assq-ref (%string-dump s) 'stringbuf-inline))))
(pass-if "short UCS-4 encoded strings are not inlined"
(let ((s "\u0100"))
(not (assq-ref (%string-dump s) 'stringbuf-inline))))
(pass-if "long UCS-4 encoded strings are not inlined"
(let ((s "\u010012345678901234567890123456789"))
(not (assq-ref (%string-dump s) 'stringbuf-inline))))
(pass-if "new Latin-1 encoded strings are not shared"
(let ((s "abc"))
(not (assq-ref (%string-dump s) 'stringbuf-shared))))

View file

@ -49,25 +49,6 @@
(string=? (symbol->string s)
(assq-ref (%symbol-dump s) 'stringbuf-chars))))
(pass-if "the null symbol is inlined"
(let ((s '#{}#))
(assq-ref (%symbol-dump s) 'stringbuf-inline)))
(pass-if "short Latin-1-encoded symbols are inlined"
(let ((s 'm))
(assq-ref (%symbol-dump s) 'stringbuf-inline)))
(pass-if "long Latin-1-encoded symbols are not inlined"
(let ((s 'x0123456789012345678901234567890123456789))
(not (assq-ref (%symbol-dump s) 'stringbuf-inline))))
(pass-if "short UCS-4-encoded symbols are not inlined"
(let ((s (string->symbol "\u0100")))
(not (assq-ref (%symbol-dump s) 'stringbuf-inline))))
(pass-if "long UCS-4-encoded symbols are not inlined"
(let ((s (string->symbol "\u010012345678901234567890123456789")))
(not (assq-ref (%symbol-dump s) 'stringbuf-inline))))
(with-test-prefix "hashes"