aboutsummaryrefslogtreecommitdiff
path: root/include/data.s
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-08-06 00:25:53 +0200
committerMirek Kratochvil <exa.exa@gmail.com>2023-08-06 00:25:53 +0200
commit74cad993376dc269e8389fbf150be9ecc36890c7 (patch)
tree32a2dbb382836ee0f1853fe5e63036d044fea77d /include/data.s
parent46d84e91ebe48ade19bd3f5e18360bf853b53968 (diff)
downloaduskel-74cad993376dc269e8389fbf150be9ecc36890c7.tar.gz
uskel-74cad993376dc269e8389fbf150be9ecc36890c7.tar.bz2
fibs work
Diffstat (limited to 'include/data.s')
-rw-r--r--include/data.s99
1 files changed, 99 insertions, 0 deletions
diff --git a/include/data.s b/include/data.s
new file mode 100644
index 0000000..8261881
--- /dev/null
+++ b/include/data.s
@@ -0,0 +1,99 @@
+
+.ifndef _data_s_file
+_data_s_file:
+
+# Simple values and boxed machine integers
+# | ptr | value |
+CON_evacuate1:
+ retq
+CON_scavenge1:
+ add $0x10, %rsi
+ retq
+INT_info_table:
+ cell CON_evacuate1
+ cell CON_scavenge1
+ cell 0
+INT_code:
+ continue
+
+# List
+# | ptr | 0 |
+# | ptr | 1 | a | b |
+LIST_evacuate:
+ # [] | a : b
+ retq #TODO
+LIST_scavenge:
+ mov 0x8(%rbp), %rax
+ shl $1, %rax
+ add $2, %rax
+ shl $3, %rax
+ add %rax, %rsi
+ retq
+LIST_info_table:
+ cell LIST_evacuate
+ cell LIST_scavenge
+ cell 0
+LIST_code:
+ continue
+
+# FUN/PAP combo objects
+# | ptr | thunkptr | args | arg[0] | arg[1] | ... | arg[args] |
+FUN_evacuate:
+ retq #TODO
+FUN_scavenge:
+ mov 0x10(%rbp), %rax
+ add $3, %rax
+ shl $3, %rax
+ add %rax, %rsi
+ retq
+
+# Simple info for n-ary functions
+# TODO continue to add as required
+fun1_info_table:
+ cell FUN_evacuate
+ cell FUN_scavenge
+ cell 1
+fun1_code:
+ continue
+
+fun2_info_table:
+ cell FUN_evacuate
+ cell FUN_scavenge
+ cell 2
+fun2_code:
+ continue
+
+fun3_info_table:
+ cell FUN_evacuate
+ cell FUN_scavenge
+ cell 3
+fun3_code:
+ continue
+
+# indirection (Q: how to recognize IND and THUNK on return?)
+# | ptr | indptr |
+IND_evacuate:
+ retq #TODO
+IND_scavenge:
+ add $0x10,%rsi
+ retq
+IND_info:
+ cell IND_evacuate
+ cell IND_scavenge
+ cell 0
+IND_code:
+ enter 0x8(%rbp)
+
+# THU objects (gc implementation only, actual THUs are defined by functions)
+# | ptr | args | arg[0] | arg[1] | ... | arg[args] |
+# args wouldn't need to be here but let's keep them for gc simplicity
+THU_evacuate:
+ retq #TODO
+THU_scavenge:
+ mov 0x8(%rbp), %rax
+ add $2,%rax
+ shl $3,%rax
+ add %rax,%rsi
+ retq
+
+.endif # _data_s_file