aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/data.s56
1 files changed, 38 insertions, 18 deletions
diff --git a/include/data.s b/include/data.s
index 575b4ae..4a827e2 100644
--- a/include/data.s
+++ b/include/data.s
@@ -117,14 +117,42 @@ LIST_code:
# FUN objects
# | ptr | thunkptr | args | arg[0] | arg[1] | ... | arg[args] |
FUN_evacuate:
- #TODO
+ mov 020(%rbp), %rbx # rbx = count of arguments
+ mov %rbx, %rcx # rcx = count of arguments for later looping
+ lea 030(%rbp, %rbx, 010), %rdx # rdx = address of the arguments
+ FUN_evacuate_one:
+ sub $1, %rcx
+ jl FUN_evacuate_fini
+ sub $010, %rdx
+ pushq (%rdx)
+ jmp FUN_evacuate_one
+ FUN_evacuate_fini:
+ pushq %rbx
+ pushq 010(%rbp)
+ pushq 000(%rbp)
+ mov %rsp, %rbp
+ jmp _gc_evacuate_ret
FUN_scavenge:
- #TODO
- #mov 020(%rbp), %rax
- #add $3, %rax
- #shl $3, %rax
- #add %rax, %rsi
- #retq
+ mov 020(%rbp), %r13 # r13 = count of arguments (for looping)
+ mov %rbp, %r15 # r15 = scavengee ptr
+ lea 030(%rbp, %r13, 010), %r14 # r14 = address of argument
+
+ FUN_scavenge_one:
+ sub $1, %r13
+ jl FUN_scavenge_fini
+ sub $010, %r14
+ mov (%r14), %rbp
+ mov $FUN_scavenge_one_cont, %rsi
+ jmp _gc_evacuate
+ FUN_scavenge_one_cont:
+ mov %rbp, (%r14)
+ jmp FUN_scavenge_one
+
+ FUN_scavenge_fini:
+ mov %r15, %rbp # restore rbp
+ mov 020(%rbp), %r14
+ lea 030(%rbp, %r14, 010), %rbp
+ jmp _gc_scavenge_ret
# Info tables for FUN objects.
FUN0_info_table:
@@ -168,11 +196,8 @@ FUN4_code:
# args wouldn't need to be here but let's keep them for gc simplicity
THU_evacuate:
mov 010(%rbp), %rbx # rbx = count of arguments
- mov %rbx, %rdx
mov %rbx, %rcx # rcx = count of arguments for later looping
- add $2, %rdx
- shl $3, %rdx
- add %rbp, %rdx # rdx = address of the argument
+ lea 020(%rbp, %rbx, 010), %rdx # rdx = address of the argument
THU_evacuate_one:
sub $1, %rcx
jl THU_evacuate_fini
@@ -187,10 +212,7 @@ THU_evacuate:
THU_scavenge:
mov 010(%rbp), %r13 # r13 = count of arguments (for looping)
mov %rbp, %r15 # r15 = scavengee ptr
- mov %r13,%r14
- add $2, %r14
- shl $3, %r14
- add %r15, %r14 # r14 = address of argument
+ lea 020(%rbp, %r13, 010), %r14 # r14 = address of argument
THU_scavenge_one:
sub $1, %r13
@@ -206,9 +228,7 @@ THU_scavenge:
THU_scavenge_fini:
mov %r15, %rbp # restore rbp
mov 010(%rbp), %r14
- add $2, %r14
- shl $3, %r14 # r14 is size of object
- add %r14, %rbp # move rbp to next rbp
+ lea 020(%rbp, %r14, 010), %rbp
jmp _gc_scavenge_ret
.endif # _data_s_file