ripping out getlexical because it's superfluous

This commit is contained in:
Danny Yoo 2011-03-10 12:50:52 -05:00
parent fd25182d42
commit 5b406543bc
5 changed files with 14 additions and 31 deletions

View File

@ -117,8 +117,6 @@ EOF
(list (MakeCompiledProcedure-label op))]
[(ApplyPrimitiveProcedure? op)
(list (ApplyPrimitiveProcedure-label op))]
[(LookupLexicalAddress? op)
empty]
[(LookupToplevelAddress? op)
empty]
[(GetControlStackLabel? op)
@ -328,10 +326,6 @@ EOF
(ApplyPrimitiveProcedure-arity op)
(ApplyPrimitiveProcedure-label op))]
[(LookupLexicalAddress? op)
(format "MACHINE.env[MACHINE.env.length - 1 - ~a][~a]"
(LookupLexicalAddress-depth op))]
[(LookupToplevelAddress? op)
(format "MACHINE.env[MACHINE.env.length - 1 - ~a][~a]"
(LookupToplevelAddress-depth op)

View File

@ -142,9 +142,9 @@
(end-with-linkage linkage
cenv
(make-instruction-sequence
`(,(make-AssignPrimOpStatement
`(,(make-AssignImmediateStatement
target
(make-LookupLexicalAddress (LocalAddress-depth lexical-pos))))))]
(make-EnvLexicalReference (LocalAddress-depth lexical-pos))))))]
[(PrefixAddress? lexical-pos)
(end-with-linkage linkage
cenv

View File

@ -16,8 +16,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; An operation can refer to the following:
;; An operation can refer to the following arguments:
(define-type OpArg (U Const ;; an constant
Label ;; an label
Reg ;; an register
@ -25,6 +24,12 @@
EnvWholePrefixReference ;; a reference into a toplevel prefix in the stack.
))
;; Targets: these are the allowable lhs's for an assignment.
(define-type Target (U AtomicRegisterSymbol EnvLexicalReference))
(define-struct: Label ([name : Symbol])
#:transparent)
(define-struct: Reg ([name : AtomicRegisterSymbol])
@ -36,15 +41,13 @@
(define-struct: EnvWholePrefixReference ([depth : Natural])
#:transparent)
;; An environment reference
;; An environment reference is either lexical or referring to a whole prefix.
(define-type EnvReference (U EnvLexicalReference
EnvWholePrefixReference))
;; instruction sequences
(define-type UnlabeledStatement (U
AssignImmediateStatement
@ -58,6 +61,7 @@
PushEnvironment
PushControlFrame
PopControlFrame))
(define-type Statement (U UnlabeledStatement
Symbol ;; label
))
@ -105,7 +109,6 @@
(define-type PrimitiveOperator (U GetCompiledProcedureEntry
MakeCompiledProcedure
ApplyPrimitiveProcedure
LookupLexicalAddress
LookupToplevelAddress
GetControlStackLabel))
@ -131,10 +134,6 @@
[label : Symbol])
#:transparent)
;; Gets the value stored at the given depth in the environment.
(define-struct: LookupLexicalAddress ([depth : Natural])
#:transparent)
;; Looks up the value in the prefix installed in the environment.
(define-struct: LookupToplevelAddress ([depth : Natural]
[pos : Natural]
@ -218,8 +217,6 @@
;; Targets: these are the allowable lhs's for an assignment.
(define-type Target (U AtomicRegisterSymbol EnvLexicalReference))
;; Linkage

View File

@ -241,14 +241,6 @@
[else
(error 'apply-primitive-procedure)]))]
[(LookupLexicalAddress? op)
(let: ([a-val : SlotValue (env-ref m (LookupLexicalAddress-depth op))])
(cond
[(toplevel? a-val)
(error 'lookup-lexical-address)]
[else
(target-updater m a-val)]))]
[(LookupToplevelAddress? op)
(let: ([a-top : SlotValue (env-ref m (LookupToplevelAddress-depth op))])
(cond

View File

@ -398,7 +398,7 @@
,(make-AssignImmediateStatement (make-EnvLexicalReference 1) (make-Const 'curly))
,(make-AssignImmediateStatement (make-EnvLexicalReference 2) (make-Const 'moe))
,(make-AssignPrimOpStatement 'val (make-LookupLexicalAddress 0))))])
,(make-AssignImmediateStatement 'val (make-EnvLexicalReference 0))))])
(test (machine-val (run m))
'larry))
;; Another lexical lookup test
@ -408,7 +408,7 @@
,(make-AssignImmediateStatement (make-EnvLexicalReference 1) (make-Const 'curly))
,(make-AssignImmediateStatement (make-EnvLexicalReference 2) (make-Const 'moe))
,(make-AssignPrimOpStatement 'val (make-LookupLexicalAddress 1))))])
,(make-AssignImmediateStatement 'val (make-EnvLexicalReference 1))))])
(test (machine-val (run m))
'curly))