add code for writing out metadata to the end of a program
* libguile/objcodes.c (make_objcode_by_mmap, scm_c_make_objcode_slice):
Verify the lengths with the meta-length.
(scm_objcode_meta): New procedure, for getting at the meta-info of an
objcode.
(scm_objcode_to_bytecode):
(scm_write_objcode): Write bytecode with the metadata too.
* module/system/vm/objcode.scm: Export object-meta.
* module/language/assembly.scm (byte-length):
* module/language/assembly/compile-bytecode.scm (write-bytecode):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/disassemble.scm (disassemble-load-program):
* module/language/glil/compile-assembly.scm (glil->assembly):
* test-suite/tests/asm-to-bytecode.test ("compiler"): Change to
load-program format to have meta-or-#f instead of meta-length, so that
we can serialize the meta as objcode without a load-program byte. Add a
test for writing out the meta.
This commit is contained in:
parent
9aeaabdc45
commit
1f1ec13b5c
9 changed files with 65 additions and 23 deletions
|
|
@ -77,7 +77,20 @@
|
|||
(char->integer #\x)))
|
||||
|
||||
;; fixme: little-endian test.
|
||||
(comp-test '(load-program 3 2 1 0 '() 3 0 (make-int8 3) (return))
|
||||
(comp-test '(load-program 3 2 1 0 () 3 #f (make-int8 3) (return))
|
||||
(vector 'load-program 3 2 1 0 3 0 0 0 0 0 0 0
|
||||
(instruction->opcode 'make-int8) 3
|
||||
(instruction->opcode 'return)))
|
||||
|
||||
;; fixme: little-endian test.
|
||||
(comp-test '(load-program 3 2 1 0 () 3
|
||||
(load-program 3 2 1 0 () 3
|
||||
#f
|
||||
(make-int8 3) (return))
|
||||
(make-int8 3) (return))
|
||||
(vector 'load-program 3 2 1 0 3 0 0 0 (+ 3 12) 0 0 0
|
||||
(instruction->opcode 'make-int8) 3
|
||||
(instruction->opcode 'return)
|
||||
3 2 1 0 3 0 0 0 0 0 0 0
|
||||
(instruction->opcode 'make-int8) 3
|
||||
(instruction->opcode 'return)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue