diff options
author | Andy Wingo <wingo@pobox.com> | 2011-06-02 22:49:33 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-06-02 22:49:33 +0200 |
commit | 46da7909e1f67c13284730344e971d293df890c0 (patch) | |
tree | 5acc96a0834b5d9be7df59ef5a126ccfb8f53a8c /module/language/assembly/compile-bytecode.scm | |
parent | 6fc3eae4772bc2c5dc3e2b377ca481eef9aa52f5 (diff) | |
parent | 715146aa15982b0d38b242f7811ac64addeb7ecc (diff) | |
download | guile-46da7909e1f67c13284730344e971d293df890c0.tar.gz |
Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
meta/Makefile.am
Diffstat (limited to 'module/language/assembly/compile-bytecode.scm')
-rw-r--r-- | module/language/assembly/compile-bytecode.scm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/module/language/assembly/compile-bytecode.scm b/module/language/assembly/compile-bytecode.scm index c31582991..163ffccdc 100644 --- a/module/language/assembly/compile-bytecode.scm +++ b/module/language/assembly/compile-bytecode.scm @@ -20,6 +20,7 @@ (define-module (language assembly compile-bytecode) #:use-module (system base pmatch) + #:use-module (system base target) #:use-module (language assembly) #:use-module (system vm instruction) #:use-module (rnrs bytevectors) @@ -38,7 +39,7 @@ ((_ arg) (begin body body* ...))))))) - (define (fill-bytecode bv) + (define (fill-bytecode bv target-endianness) (let ((pos 0)) (define-inline1 (write-byte b) (bytevector-u8-set! bv pos b) @@ -54,7 +55,7 @@ (bytevector-u32-set! bv pos x (endianness big)) (set! pos (+ pos 4))) (define-inline1 (write-uint32 x) - (bytevector-u32-native-set! bv pos x) + (bytevector-u32-set! bv pos x target-endianness) (set! pos (+ pos 4))) (define-inline1 (write-loader-len len) (bytevector-u8-set! bv pos (ash len -16)) @@ -77,7 +78,7 @@ (bytevector-copy! bv* 0 bv pos len) (set! pos (+ pos len)))) (define-inline1 (write-wide-string s) - (write-bytevector (string->utf32 s (native-endianness)))) + (write-bytevector (string->utf32 s target-endianness))) (define-inline1 (write-break label) (let ((offset (- (assq-ref labels label) (+ (get-addr) 3)))) (cond ((>= offset (ash 1 23)) (error "jump too far forward" offset)) @@ -160,6 +161,7 @@ (fill-bytecode (make-bytevector (+ 4 4 length (if meta (1- (byte-length meta)) - 0))))) - + 0))) + (target-endianness))) + (else (error "bad assembly" assembly)))) |