From 3ca07eb6ee42b096b289bf051856867c726115c7 Mon Sep 17 00:00:00 2001 From: Joe Marshall Date: Tue, 17 Jan 2012 20:12:35 -0800 Subject: [PATCH] Change instructions alist to a hash table. --- src/compiler/back/syntax.scm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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))) -- 2.25.1