summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-01-06 17:06:47 +0100
committerLudovic Courtès <ludo@gnu.org>2023-01-17 17:49:05 +0100
commitd439a3f671da8880c14044d0b7cd106b9ebbc391 (patch)
treee5f898cacc29784af3894ad3ff164ac32cce20d4
parent13e2d5b66b94d8a9f70937a2889e27d6f4196723 (diff)
downloadguile-d439a3f671da8880c14044d0b7cd106b9ebbc391.tar.gz
assembler: Separate effectful part of 'link-docstrs'.
* module/system/vm/assembler.scm (link-docstrs): Define 'write-docstrings!' and use it.
-rw-r--r--module/system/vm/assembler.scm23
1 files changed, 13 insertions, 10 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index 872cc31c6..e82eb953a 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -2684,16 +2684,19 @@ procedure with label @var{rw-init}. @var{rw-init} may be false. If
(docstrings (find-docstrings))
(strtab (make-string-table))
(bv (make-bytevector (* (length docstrings) docstr-size) 0)))
- (fold (lambda (pair pos)
- (match pair
- ((pc . string)
- (bytevector-u32-set! bv pos pc endianness)
- (bytevector-u32-set! bv (+ pos 4)
- (string-table-intern! strtab string)
- endianness)
- (+ pos docstr-size))))
- 0
- docstrings)
+ (define (write-docstrings! bv offset)
+ (fold (lambda (pair pos)
+ (match pair
+ ((pc . string)
+ (bytevector-u32-set! bv pos pc endianness)
+ (bytevector-u32-set! bv (+ pos 4)
+ (string-table-intern! strtab string)
+ endianness)
+ (+ pos docstr-size))))
+ offset
+ docstrings))
+
+ (write-docstrings! bv 0)
(let ((strtab (make-object asm '.guile.docstrs.strtab
(link-string-table! strtab)
'() '()