From: Joe Marshall Date: Wed, 18 Jan 2012 04:14:54 +0000 (-0800) Subject: Change cse-methods alist to a hash-table. X-Git-Tag: release-9.2.0~334^2~17 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a8a33011186c5fa16a0d97a8ce773c229a49b85f;p=mit-scheme.git Change cse-methods alist to a hash-table. --- diff --git a/src/compiler/rtlopt/rcse1.scm b/src/compiler/rtlopt/rcse1.scm index 7fea0eded..28fe66d5a 100644 --- a/src/compiler/rtlopt/rcse1.scm +++ b/src/compiler/rtlopt/rcse1.scm @@ -92,10 +92,10 @@ USA. (let ((rtl (rinst-rtl rinst))) ((if (eq? (rtl:expression-type rtl) 'ASSIGN) cse/assign - (let ((entry (assq (rtl:expression-type rtl) cse-methods))) - (if (not entry) + (let ((method (hash-table/get cse-methods (rtl:expression-type rtl) #f))) + (if (not method) (error "Missing CSE method" (rtl:expression-type rtl))) - (cdr entry))) + method)) rtl)) (if (rinst-next rinst) (loop (rinst-next rinst)))) @@ -131,14 +131,11 @@ USA. (walk-bblock bblock)) (define (define-cse-method type method) - (let ((entry (assq type cse-methods))) - (if entry - (set-cdr! entry method) - (set! cse-methods (cons (cons type method) cse-methods)))) + (hash-table/put! cse-methods type method) type) -(define cse-methods - '()) +(define cse-methods (make-strong-eq-hash-table)) + (define (cse/assign statement) (expression-replace! rtl:assign-expression rtl:set-assign-expression!