From a9b98dfbb5ba96b6f149a779546595e080de32cd Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 1 Feb 2012 11:38:03 -0700 Subject: [PATCH] svm: instructions is now a hash table. --- src/compiler/machines/svm/assembler-runtime.scm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/compiler/machines/svm/assembler-runtime.scm b/src/compiler/machines/svm/assembler-runtime.scm index 6162c6033..d6ead44ba 100644 --- a/src/compiler/machines/svm/assembler-runtime.scm +++ b/src/compiler/machines/svm/assembler-runtime.scm @@ -125,19 +125,17 @@ USA. ;;(define-import instructions (compiler lap-syntaxer)) (define (add-instruction! keyword assemblers) - (let ((entry (assq keyword instructions))) - (if (pair? entry) - (set-cdr! entry assemblers) - (set! instructions (cons (cons keyword assemblers) instructions))))) + (hash-table/put! instructions keyword assemblers) + keyword) (define (add-instruction-assembler! keyword assembler) - (let ((entry (assq keyword instructions))) - (if entry - (set-cdr! entry (cons assembler (cdr entry))) - (set! instructions (cons (list keyword assembler) instructions))))) + (let ((assemblers (hash-table/get instructions keyword #f))) + (if assemblers + (hash-table/put! instructions keyword (cons assembler assemblers)) + (hash-table/put! instructions keyword (list assembler))))) (define (clear-instructions!) - (set! instructions '())) + (hash-table/clear! instructions)) (define (init-assembler-instructions!) ;; Initialize the assembler's instruction database using the -- 2.25.1