From: Matt Birkholz Date: Wed, 1 Feb 2012 18:38:03 +0000 (-0700) Subject: svm: instructions is now a hash table. X-Git-Tag: release-9.2.0~325 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a9b98dfbb5ba96b6f149a779546595e080de32cd;p=mit-scheme.git svm: instructions is now a hash table. --- 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