summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-02-16 12:57:46 +0100
committerAndy Wingo <wingo@pobox.com>2017-02-16 13:11:29 +0100
commitd0934df1f2f0e5d3fa9a1a1f15e6f2dec1d15698 (patch)
tree4f15abdb93948be9df6510b8dd9cb658a56fb3ae /module
parentc38b9625c88f4d1760068926273b6d89ffbd4527 (diff)
Stringbufs immutable by default
* libguile/snarf.h (SCM_IMMUTABLE_STRINGBUF): Remove shared flag. Stringbufs are immutable by default. * libguile/strings.c: Rewrite blurb. Change to have stringbufs be immutable by default and mutable only when marked as such. Going mutable means making a private copy. (STRINGBUF_MUTABLE, STRINGBUF_F_MUTABLE): New definitions. (SET_STRINGBUF_SHARED): Remove. (scm_i_print_stringbuf): Simplify to just alias the stringbuf as-is. (substring_with_immutable_stringbuf): New helper. (scm_i_substring, scm_i_substring_read_only, scm_i_substring_copy): use new helper. (scm_i_string_ensure_mutable_x): New helper. (scm_i_substring_shared): Use scm_i_string_ensure_mutable_x. (stringbuf_write_mutex): Remove; yaaaaaaaay. (scm_i_string_start_writing): Use scm_i_string_ensure_mutable_x. No more mutex. (scm_i_string_stop_writing): Now a no-op. (scm_i_make_symbol): Use substring/copy. (scm_sys_string_dump, scm_sys_symbol_dump): Update. * libguile/strings.h (SCM_I_STRINGBUF_F_SHARED): Remove. (SCM_I_STRINGBUF_F_MUTABLE): Add. * module/system/vm/assembler.scm (link-data): Don't add shared flag any more. Existing compiled flags are harmless tho. * test-suite/tests/strings.test ("string internals"): Update.
Diffstat (limited to 'module')
-rw-r--r--module/system/vm/assembler.scm7
1 files changed, 2 insertions, 5 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index 226a2233e..aa803acaf 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -1385,13 +1385,10 @@ should be .data or .rodata), and return the resulting linker object.
(modulo (- alignment (modulo address alignment)) alignment)))
(define tc7-vector 13)
- (define stringbuf-shared-flag #x100)
(define stringbuf-wide-flag #x400)
(define tc7-stringbuf 39)
- (define tc7-narrow-stringbuf
- (+ tc7-stringbuf stringbuf-shared-flag))
- (define tc7-wide-stringbuf
- (+ tc7-stringbuf stringbuf-shared-flag stringbuf-wide-flag))
+ (define tc7-narrow-stringbuf tc7-stringbuf)
+ (define tc7-wide-stringbuf (+ tc7-stringbuf stringbuf-wide-flag))
(define tc7-ro-string (+ 21 #x200))
(define tc7-program 69)
(define tc7-bytevector 77)