1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 05:50:26 +02:00

Move assemble-program to test cases.

* module/system/vm/assembler.scm (assemble-program): Remove.
* test-suite/tests/rtl.test (assemble-program): Move here.
This commit is contained in:
Andy Wingo 2013-11-08 17:36:45 +01:00
parent b77a5215c7
commit 4dfae1bf50
2 changed files with 11 additions and 11 deletions

View file

@ -48,7 +48,6 @@
#:use-module (system vm dwarf)
#:use-module (system vm elf)
#:use-module (system vm linker)
#:use-module (system vm objcode)
#:use-module (rnrs bytevectors)
#:use-module (ice-9 binary-ports)
#:use-module (ice-9 vlist)
@ -59,8 +58,7 @@
#:use-module (srfi srfi-11)
#:export (make-assembler
emit-text
link-assembly
assemble-program))
link-assembly))
@ -1991,11 +1989,3 @@ The result is a bytevector, by default linked so that read-only and
writable data are on separate pages. Pass @code{#:page-aligned? #f} to
disable this behavior."
(link-elf (link-objects asm) #:page-aligned? page-aligned?))
(define (assemble-program instructions)
"Take the sequence of instructions @var{instructions}, assemble them
into RTL code, link an image, and load that image from memory. Returns
a procedure."
(let ((asm (make-assembler)))
(emit-text asm instructions)
(load-thunk-from-memory (link-assembly asm #:page-aligned? #f))))

View file

@ -20,8 +20,18 @@
#:use-module (test-suite lib)
#:use-module (system vm assembler)
#:use-module (system vm program)
#:use-module (system vm objcode)
#:use-module (system vm linker)
#:use-module (system vm debug))
(define (assemble-program instructions)
"Take the sequence of instructions @var{instructions}, assemble them
into RTL code, link an image, and load that image from memory. Returns
a procedure."
(let ((asm (make-assembler)))
(emit-text asm instructions)
(load-thunk-from-memory (link-assembly asm #:page-aligned? #f))))
(define-syntax-rule (assert-equal val expr)
(let ((x val))
(pass-if (object->string x) (equal? expr x))))