diff options
author | Andy Wingo <wingo@pobox.com> | 2009-02-14 22:54:19 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-02-14 22:55:26 +0100 |
commit | 1005628ab59e3761fb3216f147cf4eec65adc3a0 (patch) | |
tree | 43cab65f897858da2df5a1ddcf42f4df7415acc7 | |
parent | b96dac4d0ed1cea031b84966c2563c768180fd74 (diff) | |
download | guile-1005628ab59e3761fb3216f147cf4eec65adc3a0.tar.gz |
better alignment
* module/language/assembly.scm (align-program): Whoops, align programs
properly.
* module/language/glil/compile-assembly.scm (compile-assembly): Start
with addr=-1, for the unserialized load-program byte.
(glil->assembly): Align programs in all cases.
-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 '() |