diff options
-rw-r--r-- | module/language/assembly.scm | 3 | ||||
-rw-r--r-- | module/language/glil/compile-assembly.scm | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/module/language/assembly.scm b/module/language/assembly.scm index fbe3a7153..42fd5f0e1 100644 --- a/module/language/assembly.scm +++ b/module/language/assembly.scm @@ -66,7 +66,8 @@ (define (align-program prog addr) `(,@(make-list (modulo (- *program-alignment* - (modulo addr *program-alignment*)) + (modulo (1+ addr) *program-alignment*)) + ;; plus the one for the load-program inst itself *program-alignment*) '(nop)) ,prog)) diff --git a/module/language/glil/compile-assembly.scm b/module/language/glil/compile-assembly.scm index 5679b6898..797c59653 100644 --- a/module/language/glil/compile-assembly.scm +++ b/module/language/glil/compile-assembly.scm @@ -129,7 +129,7 @@ (define (compile-assembly glil) (receive (code . _) - (glil->assembly glil 0 '() '(()) '() '() #f 0) + (glil->assembly glil 0 '() '(()) '() '() #f -1) (car code))) (define (make-object-table objects) (and (not (null? objects)) @@ -176,7 +176,7 @@ ;; toplevel bytecode isn't loaded by the vm, no way to do ;; object table or closure capture (not in the bytecode, ;; anyway) - (emit-code `(,prog))) + (emit-code (align-program prog addr))) (else (let ((table (dump-object (make-object-table objects) addr)) (closure (if (> closure-level 0) '((make-closure)) '()))) @@ -191,7 +191,8 @@ object-alist))) (else ;; otherwise emit a load directly - (emit-code `(,@table ,prog ,@closure))))))))))) + (emit-code `(,@table ,@(align-program prog (addr+ addr table)) + ,@closure))))))))))) ((<glil-bind> vars) (values '() |