Right in the middle of getting global references to work.
This commit is contained in:
parent
cd5e6ee180
commit
35d154345b
|
@ -448,9 +448,16 @@
|
|||
(make-EnvPrefixReference (ToplevelRef-depth exp)
|
||||
(ToplevelRef-pos exp)
|
||||
#t))])]
|
||||
[(GlobalBucket? prefix-element)
|
||||
(append-instruction-sequences
|
||||
(if (ToplevelRef-check-defined? exp)
|
||||
(make-Perform (make-CheckGlobalBound! (GlobalBucket-name prefix-element)))
|
||||
empty-instruction-sequence)
|
||||
(make-AssignImmediate
|
||||
target
|
||||
(make-GlobalsReference (GlobalBucket-name prefix-element))))]
|
||||
[(or (eq? prefix-element #f)
|
||||
(symbol? prefix-element)
|
||||
(GlobalBucket? prefix-element))
|
||||
(symbol? prefix-element))
|
||||
(append-instruction-sequences
|
||||
(if (ToplevelRef-check-defined? exp)
|
||||
(make-Perform (make-CheckToplevelBound!
|
||||
|
@ -487,9 +494,13 @@
|
|||
(ToplevelSet-pos exp)
|
||||
#t)
|
||||
next-linkage/expects-single)]
|
||||
[(GlobalBucket? prefix-element)
|
||||
(compile (ToplevelSet-value exp)
|
||||
cenv
|
||||
(make-GlobalsReference (GlobalBucket-name prefix-element))
|
||||
next-linkage/expects-single)]
|
||||
[(or (eq? prefix-element #f)
|
||||
(symbol? prefix-element)
|
||||
(GlobalBucket? prefix-element))
|
||||
(symbol? prefix-element))
|
||||
(compile (ToplevelSet-value exp)
|
||||
cenv
|
||||
(make-EnvPrefixReference (ToplevelSet-depth exp)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
ModulePredicate
|
||||
PrimitiveKernelValue
|
||||
VariableReference
|
||||
GlobalsReference
|
||||
))
|
||||
|
||||
|
||||
|
@ -46,6 +47,7 @@
|
|||
EnvLexicalReference
|
||||
EnvPrefixReference
|
||||
PrimitivesReference
|
||||
GlobalsReference
|
||||
ControlFrameTemporary
|
||||
ModulePrefixTarget
|
||||
))
|
||||
|
@ -152,6 +154,10 @@
|
|||
(define-struct: PrimitivesReference ([name : Symbol])
|
||||
#:transparent)
|
||||
|
||||
(define-struct: GlobalsReference ([name : Symbol])
|
||||
#:transparent)
|
||||
|
||||
|
||||
;; Produces the entry point of the module.
|
||||
(define-struct: ModuleEntry ([name : ModuleLocator])
|
||||
#:transparent)
|
||||
|
@ -313,6 +319,7 @@
|
|||
|
||||
ModuleVariable
|
||||
PrimitivesReference
|
||||
GlobalsReference
|
||||
|
||||
MakeBoxedEnvironmentValue
|
||||
|
||||
|
@ -398,6 +405,12 @@
|
|||
[pos : Natural])
|
||||
#:transparent)
|
||||
|
||||
;; Check that the global can be defined.
|
||||
;; If not, raise an error and stop evaluation.
|
||||
(define-struct: CheckGlobalBound! ([name : Symbol])
|
||||
#:transparent)
|
||||
|
||||
|
||||
;; Check the closure procedure value in 'proc and make sure it's a closure
|
||||
;; that can accept the right arguments (stored as a number in the argcount register.).
|
||||
(define-struct: CheckClosureAndArity! ()
|
||||
|
@ -511,6 +524,7 @@
|
|||
|
||||
(define-type PrimitiveCommand (U
|
||||
CheckToplevelBound!
|
||||
CheckGlobalBound!
|
||||
CheckClosureAndArity!
|
||||
CheckPrimitiveArity!
|
||||
|
||||
|
|
|
@ -147,7 +147,9 @@
|
|||
|
||||
[(PrimitivesReference? op)
|
||||
op]
|
||||
))
|
||||
|
||||
[(GlobalsReference? op)
|
||||
op]))
|
||||
|
||||
|
||||
(: rewrite-primcmd (PrimitiveCommand -> PrimitiveCommand))
|
||||
|
|
Loading…
Reference in New Issue
Block a user