mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
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.
This commit is contained in:
parent
9082ff2d90
commit
3928db0087
1 changed files with 8 additions and 3 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue