aboutsummaryrefslogtreecommitdiff
path: root/compiler/elymasGlobalSys.ey
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-09-28 21:54:36 +0200
committerDrahflow <drahflow@gmx.de>2013-09-28 21:54:36 +0200
commit99e0fad4803fa1b36b3b65ad5dfa1f2abdd3b418 (patch)
tree00fe8b524e578ac7380586a6240af11ab2a117b7 /compiler/elymasGlobalSys.ey
parent55cb8cb3c9c768f9f088dabe47e8939b2b8d4d1b (diff)
Rewriting * when types are predictable
Diffstat (limited to 'compiler/elymasGlobalSys.ey')
-rw-r--r--compiler/elymasGlobalSys.ey30
1 files changed, 30 insertions, 0 deletions
diff --git a/compiler/elymasGlobalSys.ey b/compiler/elymasGlobalSys.ey
index 1f95e0b..912d5c0 100644
--- a/compiler/elymasGlobalSys.ey
+++ b/compiler/elymasGlobalSys.ey
@@ -81,6 +81,36 @@
8 /r15 :addqImm8Reg
:retn
]] /eyresolveInfo defv
+
+ # return information about the captured scope of a function
+ # 0 -> function object
+ # 0 <- any scope captured
+ # 1 <- if any scope was caputered, that scope
+ [[
+ 8 /r15 :subqImm8Reg
+ /r15 :popqMem
+
+ /rsi :popqReg
+ 8 /rsi /rsi :movqMemDisp8Reg
+ /rsi /rsi :testqRegReg
+ /noScopeCaptured :jzLbl8
+
+ /rsi :pushqReg # push scope
+ 1 /rax :movqImmReg
+ 63 /rax :btsqImm8Reg
+ /rax :pushqReg
+
+ /done :jmpLbl8
+
+ @noScopeCaptured
+ 63 /rsi :btsqImm8Reg
+ /rsi :pushqReg
+
+ @done
+ /r15 :pushqMem
+ 8 /r15 :addqImm8Reg
+ :retn
+ ]] /eycapturedScope defv
> _ ==globalFunctions { defv }' ::allocateOffsetStruct
[