sudden outbreak of lea, FUN gc

This commit is contained in:
Mirek Kratochvil 2023-10-31 22:13:57 +01:00
parent e8a080f5f6
commit a39e193eb8

View file

@ -117,14 +117,42 @@ LIST_code:
# FUN objects # FUN objects
# | ptr | thunkptr | args | arg[0] | arg[1] | ... | arg[args] | # | ptr | thunkptr | args | arg[0] | arg[1] | ... | arg[args] |
FUN_evacuate: 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: FUN_scavenge:
#TODO mov 020(%rbp), %r13 # r13 = count of arguments (for looping)
#mov 020(%rbp), %rax mov %rbp, %r15 # r15 = scavengee ptr
#add $3, %rax lea 030(%rbp, %r13, 010), %r14 # r14 = address of argument
#shl $3, %rax
#add %rax, %rsi FUN_scavenge_one:
#retq 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. # Info tables for FUN objects.
FUN0_info_table: FUN0_info_table:
@ -168,11 +196,8 @@ FUN4_code:
# args wouldn't need to be here but let's keep them for gc simplicity # args wouldn't need to be here but let's keep them for gc simplicity
THU_evacuate: THU_evacuate:
mov 010(%rbp), %rbx # rbx = count of arguments mov 010(%rbp), %rbx # rbx = count of arguments
mov %rbx, %rdx
mov %rbx, %rcx # rcx = count of arguments for later looping mov %rbx, %rcx # rcx = count of arguments for later looping
add $2, %rdx lea 020(%rbp, %rbx, 010), %rdx # rdx = address of the argument
shl $3, %rdx
add %rbp, %rdx # rdx = address of the argument
THU_evacuate_one: THU_evacuate_one:
sub $1, %rcx sub $1, %rcx
jl THU_evacuate_fini jl THU_evacuate_fini
@ -187,10 +212,7 @@ THU_evacuate:
THU_scavenge: THU_scavenge:
mov 010(%rbp), %r13 # r13 = count of arguments (for looping) mov 010(%rbp), %r13 # r13 = count of arguments (for looping)
mov %rbp, %r15 # r15 = scavengee ptr mov %rbp, %r15 # r15 = scavengee ptr
mov %r13,%r14 lea 020(%rbp, %r13, 010), %r14 # r14 = address of argument
add $2, %r14
shl $3, %r14
add %r15, %r14 # r14 = address of argument
THU_scavenge_one: THU_scavenge_one:
sub $1, %r13 sub $1, %r13
@ -206,9 +228,7 @@ THU_scavenge:
THU_scavenge_fini: THU_scavenge_fini:
mov %r15, %rbp # restore rbp mov %r15, %rbp # restore rbp
mov 010(%rbp), %r14 mov 010(%rbp), %r14
add $2, %r14 lea 020(%rbp, %r14, 010), %rbp
shl $3, %r14 # r14 is size of object
add %r14, %rbp # move rbp to next rbp
jmp _gc_scavenge_ret jmp _gc_scavenge_ret
.endif # _data_s_file .endif # _data_s_file