diff options
-rw-r--r-- | icompact.s | 114 | ||||
-rw-r--r-- | icopy.s | 61 | ||||
-rw-r--r-- | imark.s | 55 |
3 files changed, 196 insertions, 34 deletions
@@ -283,7 +283,7 @@ mark_stack_nodes: mark_arguments: movl (a0),d0 - testb $2,d0 + testb $2,d0b je mark_lazy_node movzwl -2(d0),a2 @@ -410,7 +410,7 @@ mark_selector_node_1: jc mark_hnf_1 #endif movl (a1),d1 - testb $2,d1 + testb $2,d1b je mark_hnf_1 cmpw $2,-2(d1) @@ -492,7 +492,7 @@ mark_record_selector_node_1: jc mark_hnf_1 #endif movl (a1),d1 - testb $2,d1 + testb $2,d1b je mark_hnf_1 cmpw $258,-2(d1) @@ -519,7 +519,7 @@ mark_strict_record_selector_node_1: jc mark_hnf_1 #endif movl (a1),d1 - testb $2,d1 + testb $2,d1b je mark_hnf_1 cmpw $258,-2(d1) @@ -692,7 +692,7 @@ mark_hnf_0: shrl $2,d1 btr d1,(a4) #endif - lea -2+ZERO_ARITY_DESCRIPTOR_OFFSET(d0),a0 + lea ZERO_ARITY_DESCRIPTOR_OFFSET-2(d0),a0 jmp mark_next_node_after_static mark_int_3: @@ -866,9 +866,6 @@ mark_parent: movl a3,d1 andl $3,d1 -/ xorl d1,a3 -/ test a3,a3 - andl $-4,a3 je mark_stack_nodes2 @@ -899,7 +896,6 @@ argument_part_parent: movl a0,a3 movl a1,a0 -/ movl (a1),a2 skip_upward_pointers: movl a2,d0 andl $3,d0 @@ -907,7 +903,6 @@ skip_upward_pointers: jne no_upward_pointer leal -3(a2),a1 -/ movl (a1),a2 movl -3(a2),a2 jmp skip_upward_pointers @@ -1059,6 +1054,87 @@ end_mark_nodes: / compact the heap compact_heap: + +#ifdef FINALIZERS + movl $finalizer_list,a0 + movl $free_finalizer_list,a1 + + movl (a0),a2 +determine_free_finalizers_after_compact1: + cmpl $__Nil-8,a2 + je end_finalizers_after_compact1 + + movl neg_heap_p3,d0 + addl a2,d0 + movl d0,d1 + andl $31*4,d0 + shrl $7,d1 + movl bit_set_table(d0),a3 + testl (a4,d1,4),a3 + je finalizer_not_used_after_compact1 + + movl (a2),d0 + movl a2,a3 + jmp finalizer_find_descriptor + +finalizer_find_descriptor_lp: + andl $-4,d0 + movl d0,a3 + movl (d0),d0 +finalizer_find_descriptor: + test $1,d0 + jne finalizer_find_descriptor_lp + + movl $e____system__kFinalizerGCTemp+2,(a3) + + cmpl a0,a2 + ja finalizer_no_reverse + + movl (a2),d0 + leal 1(a0),a3 + movl a3,(a2) + movl d0,(a0) + +finalizer_no_reverse: + lea 4(a2),a0 + movl 4(a2),a2 + jmp determine_free_finalizers_after_compact1 + +finalizer_not_used_after_compact1: + movl $e____system__kFinalizerGCTemp+2,(a2) + + movl a2,(a1) + lea 4(a2),a1 + + movl 4(a2),a2 + movl a2,(a0) + + jmp determine_free_finalizers_after_compact1 + +end_finalizers_after_compact1: + movl a2,(a1) + + movl finalizer_list,a0 + cmpl $__Nil-8,a0 + je finalizer_list_empty + testl $3,a0 + jne finalizer_list_already_reversed + movl (a0),d0 + movl $finalizer_list+1,(a0) + movl d0,finalizer_list +finalizer_list_already_reversed: +finalizer_list_empty: + + movl $free_finalizer_list,a2 + cmpl $__Nil-8,(a2) + je free_finalizer_list_empty + + movl $free_finalizer_list+4,end_vector + call mark_stack_nodes + +free_finalizer_list_empty: +#endif + movl heap_size_33,d0 movl d0,d1 shl $5,d1 @@ -1533,7 +1609,7 @@ update_up_list_2: movl (d0),d0 inc d0 movl a4,(a1) - testb $3,d0 + testb $3,d0b jne copy_argument_part_2 subl $4,d0 @@ -1607,7 +1683,7 @@ end_update_list_2: movl d0,(a4) addl $4,a4 - testb $2,d0 + testb $2,d0b je move_lazy_node movzwl -2(d0),d1 @@ -2190,3 +2266,17 @@ move_closure_with_unboxed_arguments_1: jmp find_non_zero_long end_copy: + +#ifdef FINALIZERS + movl finalizer_list,a0 + +restore_finalizer_descriptors: + cmpl $__Nil-8,a0 + je end_restore_finalizer_descriptors + + movl $e____system__kFinalizer+2,(a0) + movl 4(a0),a0 + jmp restore_finalizer_descriptors + +end_restore_finalizer_descriptors: +#endif @@ -56,7 +56,7 @@ copy_lp1: mov (a2),d0 add $4,a2 - testb $2,d0 + testb $2,d0b je not_in_hnf_1 in_hnf_1: movzwl -2(d0),d1 @@ -75,7 +75,7 @@ in_hnf_1: mov 4(a2),d0 - testb $1,d0 + testb $1,d0b jne node_without_arguments_part @@ -300,7 +300,7 @@ copy_lp2: / selectors: continue_after_selector_2: movl (a1),a0 - testb $2,a0 + testb $2,a0b je not_in_hnf_2 in_hnf_2: @@ -361,7 +361,7 @@ copy_hnf_node2_3: add $12-1,a4 mov (a0),a1 - testb $1,a1 + testb $1,a1b jne arguments_already_copied_2 mov a4,-4(a4) @@ -640,7 +640,7 @@ record_arguments_already_copied_2: ret not_in_hnf_2: - testb $1,a0 + testb $1,a0b jne already_copied_2 mov -4(a0),d0 @@ -697,13 +697,13 @@ copy_indirection_2: mov 4(a1),a1 mov (a1),a0 - testb $2,a0 + testb $2,a0b jne in_hnf_2 - testb $1,a0 + testb $1,a0b jne already_copied_2 - cmp $-2,-4(a0) + cmpl $-2,-4(a0) je skip_indirections_2 mov -4(a0),d0 @@ -715,12 +715,12 @@ skip_indirections_2: mov 4(a1),a1 mov (a1),a0 - testb $2,a0 + testb $2,a0b jne update_indirection_list_2 - testb $1,a0 + testb $1,a0b jne update_indirection_list_2 - cmp $-2,-4(a0) + cmpl $-2,-4(a0) je skip_indirections_2 update_indirection_list_2: @@ -740,7 +740,7 @@ copy_selector_2: mov 4(a1),d0 mov (d0),d0 - testb $2,d0 + testb $2,d0b je copy_arity_1_node2_ cmpw $2,-2(d0) @@ -773,7 +773,7 @@ copy_record_selector_2: movl (d0),d0 je copy_strict_record_selector_2 - testb $2,d0 + testb $2,d0b je copy_arity_1_node2_ cmpw $258,-2(d0) @@ -806,7 +806,7 @@ copy_record_selector_2: jmp copy_selector_2_ copy_strict_record_selector_2: - testb $2,d0 + testb $2,d0b je copy_arity_1_node2_ cmpw $258,-2(d0) @@ -848,7 +848,7 @@ copy_strict_record_selector_2_: movl a0,a1 movl (a0),a0 - testb $2,a0 + testb $2,a0b jne in_hnf_2 hlt @@ -1019,6 +1019,37 @@ copy_bool_array_2: end_copy1: mov a3,heap_end_after_gc + +#ifdef FINALIZERS + movl $finalizer_list,a0 + movl $free_finalizer_list,a1 + movl finalizer_list,a2 + +determine_free_finalizers_after_copy: + movl (a2),d0 + testb $1,d0b + je finalizer_not_used_after_copy + + movl 4(a2),a2 + subl $1,d0 + movl d0,(a0) + lea 4(d0),a0 + jmp determine_free_finalizers_after_copy + +finalizer_not_used_after_copy: + cmpl $__Nil-8,a2 + je end_finalizers_after_copy + + movl a2,(a1) + lea 4(a2),a1 + movl 4(a2),a2 + jmp determine_free_finalizers_after_copy + +end_finalizers_after_copy: + movl a2,(a0) + movl a2,(a1) +#endif + lea -32(a3),a2 movl a2,end_heap @@ -177,6 +177,42 @@ restore_array_size_1: jne restore_arrays end_restore_arrays: + +#ifdef FINALIZERS + movl heap_vector,a4 + movl $finalizer_list,a0 + movl $free_finalizer_list,a1 + + movl (a0),a2 +determine_free_finalizers_after_mark: + cmpl $__Nil-8,a2 + je end_finalizers_after_mark + + movl neg_heap_p3,d0 + addl a2,d0 + movl d0,d1 + andl $31*4,d0 + shrl $7,d1 + movl bit_set_table(d0),a3 + testl (a4,d1,4),a3 + je finalizer_not_used_after_mark + + lea 4(a2),a0 + movl 4(a2),a2 + jmp determine_free_finalizers_after_mark + +finalizer_not_used_after_mark: + movl a2,(a1) + lea 4(a2),a1 + + movl 4(a2),a2 + movl a2,(a0) + jmp determine_free_finalizers_after_mark + +end_finalizers_after_mark: + movl a2,(a1) +#endif + call add_garbage_collect_time @@ -282,7 +318,7 @@ no_larger_heap: shrl $5,a2 - testb $31,d0 + testb $31,d0b je no_extra_word movl $0,(a4,a2,4) @@ -322,6 +358,11 @@ no_total_gc_bytes_carry2: addl $4,sp _no_heap_use_message2: + +#ifdef FINALIZERS + call call_finalizers +#endif + movl n_allocated_words,a3 xorl d1,d1 @@ -1118,7 +1159,7 @@ __mark_using_reversal: __mark_arguments: movl (a0),d0 - testb $2,d0 + testb $2,d0b je __mark_lazy_node movzwl -2(d0),a2 @@ -1240,7 +1281,7 @@ __mark_selector_node_1: jne __mark_no_selector_2 movl (a2),d1 - testb $2,d1 + testb $2,d1b je __mark_no_selector_2 cmpw $2,-2(d1) @@ -1283,7 +1324,7 @@ __mark_record_selector_node_1: jne __mark_no_selector_2 movl (a2),d1 - testb $2,d1 + testb $2,d1b je __mark_no_selector_2 cmpw $258,-2(d1) @@ -1301,7 +1342,7 @@ __mark_strict_record_selector_node_1: jne __mark_no_selector_2 movl (a2),d1 - testb $2,d1 + testb $2,d1b je __mark_no_selector_2 cmpw $258,-2(d1) @@ -1417,7 +1458,7 @@ __argument_part_parent: movl (a2),d1 movl d1,-4(a2) movl a1,(a2) - lea (-4)+2(a2),a3 + lea 2-4(a2),a3 jmp __mark_node __mark_lazy_node: @@ -1534,7 +1575,7 @@ __no_char_3: jmp __mark_next_node #endif - lea -2+ZERO_ARITY_DESCRIPTOR_OFFSET(d0),a0 + lea ZERO_ARITY_DESCRIPTOR_OFFSET-2(d0),a0 jmp __mark_next_node __mark_real_file_or_string: |