diff options
author | Andy Wingo <wingo@pobox.com> | 2009-02-14 23:09:10 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-02-17 23:32:39 +0100 |
commit | 3928db008798f42b44bb56a7a3a987efea3ef671 (patch) | |
tree | dfb84c15943e106946bec9df2d66e5cd18abcd65 /module/language/assembly/compile-bytecode.scm | |
parent | 9082ff2d9012aa207f0d3cb62712c6402323f5cb (diff) | |
download | guile-3928db008798f42b44bb56a7a3a987efea3ef671.tar.gz |
lengths written out in native endianness
* module/language/assembly/compile-bytecode.scm (write-bytecode): Write
out the lengths that are mapped to struct scm_objcode using native
endianness.
Diffstat (limited to 'module/language/assembly/compile-bytecode.scm')
-rw-r--r-- | module/language/assembly/compile-bytecode.scm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/module/language/assembly/compile-bytecode.scm b/module/language/assembly/compile-bytecode.scm index 7f1271d2c..a96b56147 100644 --- a/module/language/assembly/compile-bytecode.scm +++ b/module/language/assembly/compile-bytecode.scm @@ -25,6 +25,7 @@ #:use-module (system vm instruction) #:use-module (srfi srfi-4) #:use-module ((srfi srfi-1) #:select (fold)) + #:use-module ((system vm objcode) #:select (byte-order)) #:export (compile-bytecode write-bytecode)) (define (compile-bytecode assembly env . opts) @@ -75,7 +76,11 @@ (write-uint16-be (- (assq-ref labels label) (+ (get-addr) 2)))) (let ((inst (car asm)) - (args (cdr asm))) + (args (cdr asm)) + (write-uint32 (case byte-order + ((1234) write-uint32-le) + ((4321) write-uint32-be) + (else (error "unknown endianness" byte-order))))) (let ((opcode (instruction->opcode inst)) (len (instruction-length inst))) (write-byte opcode) @@ -86,8 +91,8 @@ (write-byte nrest) (write-byte nlocs) (write-byte nexts) - (write-uint32-le length) ;; FIXME! - (write-uint32-le (if meta (1- (byte-length meta)) 0)) ;; FIXME! + (write-uint32 length) + (write-uint32 (if meta (1- (byte-length meta)) 0)) (letrec ((i 0) (write (lambda (x) (set! i (1+ i)) (write-byte x))) (get-addr (lambda () i))) |