Commit adb3e449 authored by John van Groningen's avatar John van Groningen
Browse files

in the compacting garbage collector for 64 bit AMD/Intel mark and copy arrays...

in the compacting garbage collector for 64 bit AMD/Intel mark and copy arrays without reordering records with both pointers and non pointers and swapping the length and element descriptor with the last two elements of arrays with pointers (same as previous commit for the 32 bit version)
parent 2dd75d2d
......@@ -895,6 +895,7 @@ cp_s_arg_lp3:
add rcx,8
mov qword ptr [rdi],rbx
add rdi,8
st_cp_s_arg_lp3:
sub rax,1
jnc cp_s_arg_lp3
......@@ -908,178 +909,69 @@ move_array:
cmp rax,r9
jb move_normal_hnf_0
endif
test rsi,rsi
push rcx
jne bsf_and_end_array_bit
skip_zeros_a:
sub r12,1
mov esi,dword ptr [r8]
add r8,4
test rsi,rsi
je skip_zeros_a
mov rbp,qword ptr neg_heap_vector_plus_4+0
add rbp,r8
shl rbp,6
add rbp,qword ptr heap_p3+0
bsf_and_end_array_bit:
mov rax,rsi
ifdef PIC
lea r9,first_one_bit_table+0
endif
mov rdx,rsi
and rax,0ffh
jne a_found_bit1
and rdx,0ff00h
jne a_found_bit2
mov rax,rsi
mov rdx,rsi
and rax,0ff0000h
jne a_found_bit3
shr rdx,24
ifdef PIC
movzx rcx,byte ptr [r9+rdx*1]
else
movzx rcx,byte ptr first_one_bit_table[rdx*1]
endif
add rcx,24
jmp end_array_bit
a_found_bit3:
shr rax,16
ifdef PIC
movzx rcx,byte ptr [r9+rax*1]
else
movzx rcx,byte ptr first_one_bit_table[rax*1]
endif
mov rbx,qword ptr [rcx]
mov qword ptr [rdi],rbx
mov rdx,qword ptr 8[rcx]
mov qword ptr 8[rdi],rdx
add rcx,16
jmp end_array_bit
a_found_bit2:
shr rdx,8
ifdef PIC
movzx rcx,byte ptr [r9+rdx*1]
else
movzx rcx,byte ptr first_one_bit_table[rdx*1]
endif
add rcx,8
jmp end_array_bit
a_found_bit1:
ifdef PIC
movzx rcx,byte ptr [r9+rax*1]
else
movzx rcx,byte ptr first_one_bit_table[rax*1]
endif
end_array_bit:
lea rbx,[rbp+rcx*8]
shr esi,1
lea rbp,8[rbp+rcx*8]
shr esi,cl
pop rcx
cmp rcx,rbx
jne move_a_array
add rdi,16
move_b_array:
mov rdx,qword ptr [rcx]
mov qword ptr [rdi],rdx
mov rbx,qword ptr 8[rcx]
add rcx,8
test rdx,rdx
je st_move_array_lp
movzx rax,word ptr (-2)[rbx]
add rdi,8
movzx rax,word ptr (-2)[rdx]
test rax,rax
je move_strict_basic_array
movzx rdx,word ptr (-2+2)[rdx]
sub rax,256
imul rdx,rax
mov rax,rdx
jmp cp_s_arg_lp3
test rdx,rdx
je move_b_record_array
sub rax,rdx
je move_a_record_array
push rdx
push rax
push rbx
jmp st_move_array_lp_ab
move_strict_basic_array:
mov rax,rdx
mov rax,rbx
ifdef PIC
lea r9,dINT+2+0
cmp rbx,r9
cmp rdx,r9
else
cmp rbx,offset dINT+2
cmp edx,offset dINT+2
endif
jle cp_s_arg_lp3
jle st_cp_s_arg_lp3
ifdef PIC
lea r9,BOOL+2+0
cmp rbx,r9
cmp rdx,r9
else
cmp rbx,offset BOOL+2
cmp edx,offset BOOL+2
endif
je move_bool_array
move_int32_or_real32_array:
add rax,1
shr rax,1
jmp cp_s_arg_lp3
jmp st_cp_s_arg_lp3
move_bool_array:
add rax,7
shr rax,3
jmp cp_s_arg_lp3
move_a_array:
mov rdx,rbx
sub rbx,rcx
shr rbx,3
push rsi
sub rbx,1
jb end_array
mov rsi,qword ptr [rcx]
mov rax,qword ptr (-8)[rdx]
mov qword ptr (-8)[rdx],rsi
mov qword ptr [rdi],rax
mov rax,qword ptr [rdx]
mov rsi,qword ptr 8[rcx]
add rcx,16
mov qword ptr [rdx],rsi
mov qword ptr 8[rdi],rax
add rdi,16
test rax,rax
je st_move_array_lp
movzx rsi,word ptr (-2+2)[rax]
movzx rax,word ptr (-2)[rax]
sub rax,256
cmp rax,rsi
je st_move_array_lp
move_array_ab:
push rcx
mov rdx,qword ptr (-16)[rdi]
mov rbx,rsi
imul rdx,rax
shl rdx,3
sub rax,rbx
add rdx,rcx
call reorder
jmp st_cp_s_arg_lp3
pop rcx
sub rbx,1
sub rax,1
move_b_record_array:
imul rax,rbx
jmp st_cp_s_arg_lp3
push rbx
push rax
push (-16)[rdi]
jmp st_move_array_lp_ab
move_a_record_array:
imul rbx,rdx
jmp st_move_array_lp
move_array_ab_lp1:
mov rax,qword ptr 16[rsp]
......@@ -1093,7 +985,7 @@ move_array_ab_a_elements:
jnc move_array_element_ab
mov rdx,rbx
mov rbx,qword ptr [rdx]
mov rbx,qword ptr [rbx]
inc rdi
mov qword ptr [rdx],rdi
dec rdi
......@@ -1101,7 +993,7 @@ move_array_element_ab:
mov qword ptr [rdi],rbx
add rdi,8
sub rax,1
jnc move_array_ab_a_elements
jne move_array_ab_a_elements
mov rax,qword ptr 8[rsp]
move_array_ab_b_elements:
......@@ -1110,7 +1002,7 @@ move_array_ab_b_elements:
mov qword ptr [rdi],rbx
add rdi,8
sub rax,1
jnc move_array_ab_b_elements
jne move_array_ab_b_elements
st_move_array_lp_ab:
sub qword ptr [rsp],1
......@@ -1129,11 +1021,10 @@ move_array_lp1:
cmp rax,qword ptr end_heap_p3+0
jnc move_array_element
mov rsi,qword ptr [rax]
mov rdx,rax
mov qword ptr (-8)[rdi],rsi
lea rax,(-8+1)[rdi]
mov qword ptr [rdx],rax
mov rdx,qword ptr [rax]
mov qword ptr (-8)[rdi],rdx
lea rdx,(-8+1)[rdi]
mov qword ptr [rax],rdx
sub rbx,1
jnc move_array_lp1
......@@ -1147,8 +1038,6 @@ st_move_array_lp:
jnc move_array_lp1
end_array:
pop rsi
test rsi,rsi
jne bsf_and_copy_nodes
jmp find_non_zero_long
......
......@@ -45,6 +45,12 @@ rmark_more_stack_nodes:
ret
rmark_stack_node:
ifdef TEST_COMPACT_RMARKR
push -1
push rsi
mov rsi,3
jmp rmarkr_arguments_
else
sub rsp,16
mov qword ptr [rsi],rax
lea rbp,1[rsi]
......@@ -53,7 +59,7 @@ rmark_stack_node:
mov qword ptr [rsp],0
mov qword ptr [rcx],rbp
jmp rmark_no_reverse
endif
rmark_node_d1:
mov rax,qword ptr neg_heap_p3+0
add rax,rcx
......@@ -928,62 +934,95 @@ rmark_no_normal_hnf_0:
movzx rdx,word ptr (-2+2)[rax]
test rdx,rdx
je rmark_b_array
je rmark_next_node
movzx rax,word ptr (-2)[rax]
test rax,rax
je rmark_b_array
je rmark_next_node
cmp rsp,qword ptr end_stack+0
jb rmark_array_using_reversal
sub rax,256
cmp rdx,rax
mov rbx,rdx
je rmark_a_record_array
rmark_ab_record_array:
mov rdx,qword ptr 8[rcx]
add rcx,16
push rcx
mov rbx,qword ptr 8[rcx]
imul rbx,rax
imul rdx,rax
shl rdx,3
shl rax,3
sub rax,rbx
add rcx,8
add rdx,rcx
call reorder
pop rcx
mov rax,rbx
imul rax,qword ptr (-8)[rcx]
jmp rmark_lr_array
lea rsi,24[rcx]
lea rcx,24[rcx+rbx*8]
push rcx
push rax
sub rax,rdx
add rdx,rsi
push rax
push rdx
jmp rmark_array_ab_nodes
rmark_array_ab_node_mark:
or rbp,rax
mov dword ptr [rdi+rbx*4],ebp
mov rax,qword ptr [rcx]
call rmark_array_node
rmark_next_array_ab_node:
add rsi,8
cmp rsi,qword ptr [rsp]
je rmark_array_ab_end_as
rmark_array_ab_next_a:
mov rcx,qword ptr [rsi]
rmark_b_array:
mov rax,qword ptr neg_heap_p3+0
add rax,rcx
add rax,8
mov rbp,rax
cmp rax,qword ptr heap_size_64_65+0
jnc rmark_next_array_ab_node
mov rbx,rax
and rax,31*8
shr rbp,8
shr rbx,8
ifdef PIC
lea r9,bit_set_table2+0
mov eax,dword ptr [r9+rax]
else
mov eax,dword ptr (bit_set_table2)[rax]
endif
or dword ptr [rdi+rbp*4],eax
mov ebp,dword ptr [rdi+rbx*4]
test rbp,rax
je rmark_array_ab_node_mark
cmp rcx,rsi
ja rmark_next_array_ab_node
mov rbx,qword ptr [rcx]
lea rax,1[rsi]
mov qword ptr [rsi],rbx
mov qword ptr [rcx],rax
jmp rmark_next_array_ab_node
rmark_array_ab_end_as:
mov rcx,rsi
add rsi,qword ptr 8[rsp]
add rcx,qword ptr 16[rsp]
mov qword ptr [rsp],rcx
rmark_array_ab_nodes:
cmp rsi,qword ptr 24[rsp]
jne rmark_array_ab_next_a
end_rmark_array_ab_node:
add rsp,32
jmp rmark_next_node
rmark_a_record_array:
mov rax,qword ptr 8[rcx]
add rcx,16
cmp rbx,2
jb rmark_lr_array
imul rax,rbx
imul rax,rdx
jmp rmark_lr_array
rmark_lazy_array:
......@@ -991,63 +1030,27 @@ rmark_lazy_array:
jb rmark_array_using_reversal
mov rax,qword ptr 8[rcx]
add rcx,16
rmark_lr_array:
mov rbx,qword ptr neg_heap_p3+0
add rbx,rcx
shr rbx,3
add rbx,rax
mov rdx,rbx
and rbx,31
shr rdx,5
ifdef PIC
lea r9,bit_set_table+0
mov ebx,dword ptr [r9+rbx*4]
else
mov ebx,dword ptr (bit_set_table)[rbx*4]
endif
or dword ptr [rdi+rdx*4],ebx
cmp rax,1
jbe rmark_array_length_0_1
mov rdx,rcx
lea rcx,[rcx+rax*8]
mov rax,qword ptr [rcx]
mov rbx,qword ptr [rdx]
mov qword ptr [rdx],rax
mov qword ptr [rcx],rbx
mov rax,qword ptr (-8)[rcx]
sub rcx,8
mov rbx,qword ptr (-8)[rdx]
sub rdx,8
mov qword ptr [rcx],rbx
test rax,rax
je rmark_next_node
mov qword ptr [rdx],rax
lea rsi,24[rcx]
lea rcx,24[rcx+rax*8]
push rcx
mov rsi,rdx
jmp rmark_array_nodes
jmp rmark_st_array_nodes
rmark_array_nodes1:
cmp rcx,rsi
ja rmark_next_array_node
rmark_array_node_mark:
or rbp,rax
mov dword ptr [rdi+rbx*4],ebp
mov rbx,qword ptr [rcx]
lea rax,1[rsi]
mov qword ptr [rsi],rbx
mov qword ptr [rcx],rax
mov rax,qword ptr [rcx]
call rmark_array_node
rmark_next_array_node:
add rsi,8
rmark_st_array_nodes:
cmp rsi,qword ptr [rsp]
je end_rmark_array_node
......@@ -1071,21 +1074,16 @@ rmark_array_nodes:
endif
mov ebp,dword ptr [rdi+rbx*4]
test rbp,rax
jne rmark_array_nodes1
or rbp,rax
mov dword ptr [rdi+rbx*4],ebp
mov rax,qword ptr [rcx]
call rmark_array_node
je rmark_array_node_mark
add rsi,8
cmp rsi,qword ptr [rsp]
jne rmark_array_nodes
cmp rcx,rsi
ja rmark_next_array_node
end_rmark_array_node:
add rsp,8
jmp rmark_next_node
mov rbx,qword ptr [rcx]
lea rax,1[rsi]
mov qword ptr [rsi],rbx
mov qword ptr [rcx],rax
jmp rmark_next_array_node
rmark_array_node:
sub rsp,16
......@@ -1094,18 +1092,9 @@ rmark_array_node:
mov qword ptr [rsp],1
jmp rmark_arguments
rmark_array_length_0_1:
lea rcx,-16[rcx]
jb rmark_next_node
mov rbx,qword ptr 24[rcx]
mov rbp,qword ptr 16[rcx]
mov qword ptr 24[rcx],rbp
mov rbp,qword ptr 8[rcx]
mov qword ptr 16[rcx],rbp
mov qword ptr 8[rcx],rbx
add rcx,8
jmp rmark_hnf_1
end_rmark_array_node:
add rsp,8
jmp rmark_next_node
_TEXT ends
_DATA segment
......
......@@ -2,7 +2,7 @@
rmark_using_reversal:
push rsi
push rsi
mov rsi,1
mov rsi,3
jmp rmarkr_node
rmark_using_reversal_:
......@@ -14,7 +14,7 @@ rmark_using_reversal_:
mov qword ptr [rsi],rcx
mov qword ptr [rcx],rax
rmark_no_undo_reverse_1:
mov rsi,1
mov rsi,3
jmp rmarkr_arguments
rmark_array_using_reversal:
......@@ -30,7 +30,7 @@ rmark_array_using_reversal:
mov qword ptr [rcx],offset __ARRAY__+2
endif
rmark_no_undo_reverse_2:
mov rsi,1
mov rsi,3
jmp rmarkr_arguments
rmarkr_hnf_2:
......@@ -67,6 +67,9 @@ rmarkr_node:
rmarkr_arguments:
mov rax,qword ptr [rcx]
ifdef TEST_COMPACT_RMARKR
rmarkr_arguments_:
endif
test al,2
je rmarkr_lazy_node
......@@ -642,13 +645,14 @@ rmarkr_next_node:
mov rbx,3
and rbx,rbp
mov rax,qword ptr [rsi]
sub rsi,8
cmp rbx,3
je rmarkr_argument_part_cycle1
mov rdx,qword ptr 8[rsi]
mov qword ptr [rsi],rdx
mov qword ptr [rsi],rax
rmarkr_c_argument_part_cycle1:
cmp rcx,rsi
......@@ -806,134 +810,112 @@ rmarkr_no_normal_hnf_0:
test rax,rax
je rmarkr_lazy_array
movzx rbx,word ptr (-2+2)[rax]
movzx rbx,word ptr (-2)[rax]
test rbx,rbx
je rmarkr_b_array
je rmarkr_next_node
movzx rax,word ptr (-2)[rax]
movzx rax,word ptr (-2+2)[rax]
test rax,rax
je rmarkr_b_array
je rmarkr_next_node
sub rax,256
cmp rbx,rax
sub rbx,256
cmp rax,rbx
je rmarkr_a_record_array
rmarkr_ab_record_array:
mov rdx,qword ptr 8[rcx]
add rcx,16
push rcx
test rdx,rdx
je rmarkr_next_node
imul rdx,rax
shl rdx,3
imul rdx,rbx
sub rdx,rbx
sub rax,rbx
add rcx,8
add rdx,rcx
call reorder
pop rcx
mov rax,rbx
imul rax,qword ptr (-8)[rcx]
jmp rmarkr_lr_array