From: Joe Marshall Date: Wed, 18 Jan 2012 04:12:35 +0000 (-0800) Subject: Change instructions alist to a hash table. X-Git-Tag: release-9.2.0~334^2~19 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=3ca07eb6ee42b096b289bf051856867c726115c7;p=mit-scheme.git Change instructions alist to a hash table. --- diff --git a/src/compiler/back/syntax.scm b/src/compiler/back/syntax.scm index 388fb4344..91665016e 100644 --- a/src/compiler/back/syntax.scm +++ b/src/compiler/back/syntax.scm @@ -69,20 +69,17 @@ USA. (match-result)))) (define (instruction-lookup instruction) - (pattern-lookup - (cdr (or (assq (car instruction) instructions) - (error "INSTRUCTION-LOOKUP: Unknown keyword" (car instruction)))) - (cdr instruction))) + (let ((pattern (hash-table/get instructions (car instruction) #f))) + (if pattern + (pattern-lookup pattern (cdr instruction)) + (error "INSTRUCTION-LOOKUP: Unknown keyword" (car instruction))))) (define (add-instruction! keyword lookup) - (let ((entry (assq keyword instructions))) - (if entry - (set-cdr! entry lookup) - (set! instructions (cons (cons keyword lookup) instructions)))) + (hash-table/put! instructions keyword lookup) keyword) (define instructions - '()) + (make-strong-eq-hash-table)) (define (integer-syntaxer expression environment coercion-type size) (let ((name (make-coercion-name coercion-type size)))