aboutsummaryrefslogtreecommitdiff
path: root/compiler/elymasGlobalSysTyped.ey
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-10-22 22:53:25 +0200
committerDrahflow <drahflow@gmx.de>2013-10-22 22:53:25 +0200
commit36db2558acb7fee6f4e575963b340bdd76143045 (patch)
tree6e1e3a8169f9a8a090cdaba65922fc31a82e21c8 /compiler/elymasGlobalSysTyped.ey
parent8ab3918f89bc537bdbdf2d400535c97cacf2dbb8 (diff)
Can now retype functions
Diffstat (limited to 'compiler/elymasGlobalSysTyped.ey')
-rw-r--r--compiler/elymasGlobalSysTyped.ey41
1 files changed, 41 insertions, 0 deletions
diff --git a/compiler/elymasGlobalSysTyped.ey b/compiler/elymasGlobalSysTyped.ey
index 5284c69..c604532 100644
--- a/compiler/elymasGlobalSysTyped.ey
+++ b/compiler/elymasGlobalSysTyped.ey
@@ -39,6 +39,47 @@
:retn
]] /eyinputs defv
+ # return the array of output types of a function
+ # 0 -> the function object to analyze
+ # 0 <- the array of output types
+ [[
+ /rbx :popqReg
+
+ /rdx :popqReg
+ 16 /rdx /rdx :movqMemDisp8Reg
+ /rdx /rdx :testqRegReg
+ /typed :jnzLbl8
+
+ # untyped functions, it does not officially produce any objects
+ /rdi /rdi :xorqRegReg
+ ::internalAllocateArray /rax :movqImmReg
+ /rax :callqReg
+ /rax :pushqReg
+ /rbx :pushqReg
+ :retn
+
+ @typed
+ 8 /rdx /rax :movqMemDisp8Reg
+ 16 8 /rax /rdx /rdx :leaqMemIndexScaleDisp8Reg
+ /rdx /rdi :movqMemReg
+ 3 /rdi :shlqImm8Reg
+ 8 /rdx /rsi :leaqMemDisp8Reg
+ /rsi :pushqReg
+ ::internalAllocateArray /rax :movqImmReg
+ /rax :callqReg
+
+ /rsi :popqReg
+ /rax :pushqReg
+
+ 8 /rax /rdi :leaqMemDisp8Reg
+ /rax /ecx :movlMemReg
+ 8 /rcx :subqImm8Reg
+ :reprcx :movsb
+
+ /rbx :pushqReg
+ :retn
+ ]] /eyoutputs defv
+
# return the type of an object
# 0 -> the object to analyze
# 0 <- an integer from 0 - 15