From 95b1e787db0b31834e79c0a5186c1fa571b3c613 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Tue, 19 Jul 2022 15:41:28 +0200 Subject: Simplify the instruction load and execution process This makes the process a little bit lighter, but it doesn't have a huge impact in the performance. Looks like we are avoiding a memory allocation without the `values` call. --- bytepusher.scm | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/bytepusher.scm b/bytepusher.scm index 1be1365..1182f48 100644 --- a/bytepusher.scm +++ b/bytepusher.scm @@ -168,20 +168,11 @@ (bytevector-copy! program 0 memory 0 (bytevector-length program)))))) (define (execute! instruction-addr) - (call-with-values - (lambda () (load-instruction instruction-addr)) - (lambda (a b c) - (set-byte! b (get-byte a)) - c))) - -(define (load-instruction instruction-addr) (let ((a (get-addr (+ 0 instruction-addr))) (b (get-addr (+ 3 instruction-addr))) (c (get-addr (+ 6 instruction-addr)))) - #;(display (string-append "a: " (number->string a 16) " ")) - #;(display (string-append "b: " (number->string b 16) " ")) - #;(display (string-append "c: " (number->string c 16) "\n")) - (values a b c))) + (set-byte! b (get-byte a)) + c)) (define (loop-frame!) (let loop ((count 65536) -- cgit v1.2.3