summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-05-14 09:48:34 +0200
committerAndy Wingo <wingo@pobox.com>2013-05-14 09:48:34 +0200
commit20f96f18e1c6a7c1d40de40bd2fb4cf7aa568a49 (patch)
tree75406012fa29a3059c24fca4d8f28038958a5ef7
parent7dc8d8aaaacf748db8140ad1b666f746e9ba34c0 (diff)
downloadguile-20f96f18e1c6a7c1d40de40bd2fb4cf7aa568a49.tar.gz
assembler refactor
* module/system/vm/assembler.scm (assembler, cache-current-module!) (emit-text): Reset the asm-start after writing opcodes instead of beforehand. (reset-asm-start!): Use asm-pos helper.
-rw-r--r--module/system/vm/assembler.scm6
1 files changed, 2 insertions, 4 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index 7c7fb488c..ef04d6637 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -151,7 +151,7 @@
(list type label base word))
(define-inlinable (reset-asm-start! asm)
- (set-asm-start! asm (+ (asm-idx asm) (asm-written asm))))
+ (set-asm-start! asm (asm-pos asm)))
(define (emit-exported-label asm label)
(set-asm-labels! asm (acons label (asm-start asm) (asm-labels asm))))
@@ -282,7 +282,7 @@
(unless (asm? asm) (error "not an asm"))
code0 ...
code* ... ...
- ))))))
+ (reset-asm-start! asm)))))))
(define assemblers (make-hash-table))
@@ -449,7 +449,6 @@
(define-macro-assembler (cache-current-module! asm tmp scope)
(let ((mod-label (emit-module-cache-cell asm scope)))
(emit-current-module asm tmp)
- (reset-asm-start! asm)
(emit-static-set! asm tmp mod-label 0)))
(define-macro-assembler (cached-toplevel-ref asm dst scope sym)
@@ -480,7 +479,6 @@
(define (emit-text asm instructions)
(for-each (lambda (inst)
- (reset-asm-start! asm)
(apply (or (hashq-ref assemblers (car inst))
(error 'bad-instruction inst))
asm