diff options
author | Andy Wingo <wingo@pobox.com> | 2009-07-24 10:12:01 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-07-24 10:12:01 +0200 |
commit | ccf77d955c875ce95473098af96da9e1bec0b7eb (patch) | |
tree | 5099763a4862add99f8fecb4c999689bb2c29bc3 /module/language/assembly/compile-bytecode.scm | |
parent | 476e35728136b2d504855f3e2e4922ed72a41101 (diff) | |
download | guile-ccf77d955c875ce95473098af96da9e1bec0b7eb.tar.gz |
nlocs is now 16 bits wide
* libguile/objcodes.h (struct scm_objcode): Remove the "unused" field --
the old "nexts" -- and expand nlocs to 16 bits.
* module/language/assembly/compile-bytecode.scm (write-bytecode): Write
the nlocs as a uint16.
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
Decompile 16-bit nlocs. It seems this decompilation is little-endian
:-/
* test-suite/tests/asm-to-bytecode.test: Fix up to understand nlocs as a
little-endian value. The test does the right thing regarding
endianness.
Diffstat (limited to 'module/language/assembly/compile-bytecode.scm')
-rw-r--r-- | module/language/assembly/compile-bytecode.scm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/module/language/assembly/compile-bytecode.scm b/module/language/assembly/compile-bytecode.scm index 0a1489845..d17e00f2f 100644 --- a/module/language/assembly/compile-bytecode.scm +++ b/module/language/assembly/compile-bytecode.scm @@ -81,6 +81,10 @@ (let ((inst (car asm)) (args (cdr asm)) + (write-uint16 (case byte-order + ((1234) write-uint16-le) + ((4321) write-uint16-be) + (else (error "unknown endianness" byte-order)))) (write-uint32 (case byte-order ((1234) write-uint32-le) ((4321) write-uint32-be) @@ -92,8 +96,7 @@ ((load-program ,nargs ,nrest ,nlocs ,labels ,length ,meta . ,code) (write-byte nargs) (write-byte nrest) - (write-byte nlocs) - (write-byte 0) ;; what used to be nexts + (write-uint16 nlocs) (write-uint32 length) (write-uint32 (if meta (1- (byte-length meta)) 0)) (letrec ((i 0) |