get-compiled-procedure-entry
This commit is contained in:
parent
447038acff
commit
10f46fd515
|
@ -308,7 +308,7 @@ EOF
|
||||||
(define (assemble-op-expression op)
|
(define (assemble-op-expression op)
|
||||||
(cond
|
(cond
|
||||||
[(GetCompiledProcedureEntry? op)
|
[(GetCompiledProcedureEntry? op)
|
||||||
"proc.label"]
|
"MACHINE.proc.label"]
|
||||||
|
|
||||||
[(MakeCompiledProcedure? op)
|
[(MakeCompiledProcedure? op)
|
||||||
(format "new Closure(~a, ~a, [~a], ~s)"
|
(format "new Closure(~a, ~a, [~a], ~s)"
|
||||||
|
|
|
@ -160,9 +160,9 @@
|
||||||
'closureStart
|
'closureStart
|
||||||
(make-GotoStatement (make-Label 'afterLambda))
|
(make-GotoStatement (make-Label 'afterLambda))
|
||||||
'afterLambda
|
'afterLambda
|
||||||
(make-AssignPrimOpStatement 'val (make-MakeCompiledProcedure 'afterLambda 0 '())))
|
(make-AssignPrimOpStatement 'val (make-MakeCompiledProcedure 'closureStart 0 '())))
|
||||||
"MACHINE.val.displayName")
|
"MACHINE.val.displayName")
|
||||||
"afterLambda")
|
"closureStart")
|
||||||
|
|
||||||
|
|
||||||
;; A do-nothing closure with a few values
|
;; A do-nothing closure with a few values
|
||||||
|
@ -175,7 +175,7 @@
|
||||||
(make-Const "hello"))
|
(make-Const "hello"))
|
||||||
(make-AssignImmediateStatement (make-EnvLexicalReference 1)
|
(make-AssignImmediateStatement (make-EnvLexicalReference 1)
|
||||||
(make-Const "world"))
|
(make-Const "world"))
|
||||||
(make-AssignPrimOpStatement 'val (make-MakeCompiledProcedure 'afterLambda 0
|
(make-AssignPrimOpStatement 'val (make-MakeCompiledProcedure 'closureStart 0
|
||||||
(list (make-EnvLexicalReference 0)
|
(list (make-EnvLexicalReference 0)
|
||||||
(make-EnvLexicalReference 1)))))
|
(make-EnvLexicalReference 1)))))
|
||||||
"MACHINE.val.closedVals[1] + ',' + MACHINE.val.closedVals[0]")
|
"MACHINE.val.closedVals[1] + ',' + MACHINE.val.closedVals[0]")
|
||||||
|
@ -194,7 +194,7 @@
|
||||||
(make-Const "hello"))
|
(make-Const "hello"))
|
||||||
(make-AssignImmediateStatement (make-EnvLexicalReference 1)
|
(make-AssignImmediateStatement (make-EnvLexicalReference 1)
|
||||||
(make-Const "world"))
|
(make-Const "world"))
|
||||||
(make-AssignPrimOpStatement 'proc (make-MakeCompiledProcedure 'afterLambdaBody 0
|
(make-AssignPrimOpStatement 'proc (make-MakeCompiledProcedure 'closureStart 0
|
||||||
(list (make-EnvLexicalReference 0)
|
(list (make-EnvLexicalReference 0)
|
||||||
(make-EnvLexicalReference 1))))
|
(make-EnvLexicalReference 1))))
|
||||||
(make-PopEnvironment 2 0)
|
(make-PopEnvironment 2 0)
|
||||||
|
@ -205,6 +205,27 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;; get-compiled-procedure-entry
|
||||||
|
(test (E-many (list (make-GotoStatement (make-Label 'afterLambdaBody))
|
||||||
|
|
||||||
|
'closureStart
|
||||||
|
(make-PerformStatement (make-InstallClosureValues!))
|
||||||
|
(make-GotoStatement (make-Label 'theEnd))
|
||||||
|
|
||||||
|
'afterLambdaBody
|
||||||
|
(make-PushEnvironment 2)
|
||||||
|
(make-AssignImmediateStatement (make-EnvLexicalReference 0)
|
||||||
|
(make-Const "hello"))
|
||||||
|
(make-AssignImmediateStatement (make-EnvLexicalReference 1)
|
||||||
|
(make-Const "world"))
|
||||||
|
(make-AssignPrimOpStatement 'proc (make-MakeCompiledProcedure 'closureStart 0
|
||||||
|
(list (make-EnvLexicalReference 0)
|
||||||
|
(make-EnvLexicalReference 1))))
|
||||||
|
(make-PopEnvironment 2 0)
|
||||||
|
(make-AssignPrimOpStatement 'val (make-GetCompiledProcedureEntry)))
|
||||||
|
"typeof(MACHINE.val) + ',' + (MACHINE.val === MACHINE.proc.label)")
|
||||||
|
"function,true")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user