aboutsummaryrefslogtreecommitdiff
path: root/include/data.s
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-08-11 22:30:22 +0200
committerMirek Kratochvil <exa.exa@gmail.com>2023-08-11 22:30:22 +0200
commit5184299c7dfddeba4d2d2ba95d390040368f9736 (patch)
treee3debfdc11073435a5459266d6dcec61b1fc30b1 /include/data.s
parent74cad993376dc269e8389fbf150be9ecc36890c7 (diff)
downloaduskel-5184299c7dfddeba4d2d2ba95d390040368f9736.tar.gz
uskel-5184299c7dfddeba4d2d2ba95d390040368f9736.tar.bz2
ap aps
Diffstat (limited to 'include/data.s')
-rw-r--r--include/data.s49
1 files changed, 39 insertions, 10 deletions
diff --git a/include/data.s b/include/data.s
index 8261881..51f31dc 100644
--- a/include/data.s
+++ b/include/data.s
@@ -5,10 +5,18 @@ _data_s_file:
# Simple values and boxed machine integers
# | ptr | value |
CON_evacuate1:
- retq
+ retq # TODO
CON_scavenge1:
add $0x10, %rsi
retq
+
+# Format of the info tables:
+# - code
+# ----- code pointer
+# - 8B helper information for eval/apply (generally this is 0, and only gets used for FUN/PAP)
+# - 8B pointer to scavenge
+# - 8B pointer to evacuate
+
INT_info_table:
cell CON_evacuate1
cell CON_scavenge1
@@ -36,7 +44,7 @@ LIST_info_table:
LIST_code:
continue
-# FUN/PAP combo objects
+# FUN objects
# | ptr | thunkptr | args | arg[0] | arg[1] | ... | arg[args] |
FUN_evacuate:
retq #TODO
@@ -47,29 +55,44 @@ FUN_scavenge:
add %rax, %rsi
retq
-# Simple info for n-ary functions
-# TODO continue to add as required
-fun1_info_table:
+# Info tables for FUN objects.
+FUN0_info_table:
+ cell FUN_evacuate
+ cell FUN_scavenge
+ cell 0
+FUN0_code:
+ continue
+
+FUN1_info_table:
cell FUN_evacuate
cell FUN_scavenge
cell 1
-fun1_code:
+FUN1_code:
continue
-fun2_info_table:
+FUN2_info_table:
cell FUN_evacuate
cell FUN_scavenge
cell 2
-fun2_code:
+FUN2_code:
continue
-fun3_info_table:
+FUN3_info_table:
cell FUN_evacuate
cell FUN_scavenge
cell 3
-fun3_code:
+FUN3_code:
continue
+FUN4_info_table:
+ cell FUN_evacuate
+ cell FUN_scavenge
+ cell 4
+FUN4_code:
+ continue
+
+# TODO: add more funN here as needed
+
# indirection (Q: how to recognize IND and THUNK on return?)
# | ptr | indptr |
IND_evacuate:
@@ -97,3 +120,9 @@ THU_scavenge:
retq
.endif # _data_s_file
+
+# evacuate and scavenge:
+# - evacuate just copies the object
+# - scavenge evacuates all children (to the new location IF they are in the old
+# location), changes the pointer, and moves the scavenge pointer to the next
+# object (because everything needs to be scavenged)