From f5c77a356b00547f04cda11eb029670107a2dff0 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 16 Oct 2016 12:35:23 +0000 Subject: Maybe Fix for having the LSB on 1, by flipping its meaning in the garbage collector --- thumb2copy.s | 75 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 36 deletions(-) (limited to 'thumb2copy.s') diff --git a/thumb2copy.s b/thumb2copy.s index ece06e1..5ce2ac8 100644 --- a/thumb2copy.s +++ b/thumb2copy.s @@ -16,10 +16,10 @@ COPY_RECORDS_WITHOUT_POINTERS_TO_END_OF_HEAP = 1 add r9,r10,r4 -@ r0 = INT+2 -@ r1 = CHAR+2 - laol r0,INT+2,INT_o_2,6 - laol r1,CHAR+2,CHAR_o_2,2 +@ r0 = INT+3 +@ r1 = CHAR+3 + laol r0,INT+3,INT_o_2,6 + laol r1,CHAR+3,CHAR_o_2,2 otoa r0,INT_o_2,6 otoa r1,CHAR_o_2,2 @@ -110,8 +110,8 @@ end_finalizers_after_copy: lto heap_p2,9 lto heap_size_129,4 lto semi_space_size,0 - ltol INT+2,INT_o_2,6 - ltol CHAR+2,CHAR_o_2,2 + ltol INT+3,INT_o_2,6 + ltol CHAR+3,CHAR_o_2,2 .if WRITE_HEAP ltol heap2_begin_and_end+4,heap2_begin_and_end_o_4,0 .endif @@ -145,7 +145,8 @@ copy_lp2_: @ selectors: continue_after_selector_2: ldr r6,[r7] - bic r6,r6,#1 @ TODO temporary fix + orr r6,r6,#1 + @bic r6,r6,#1 @ TODO temporary fix tst r6,#2 beq not_in_hnf_2 @@ -205,7 +206,7 @@ copy_hnf_node2_3: ldr r7,[r6] tst r7,#1 - bne arguments_already_copied_2 + beq arguments_already_copied_2 str r10,[r10,#-4] @@ -234,17 +235,17 @@ arguments_already_copied_2: b copy_lp1 copy_arity_0_node2: - cmp r6,r0 @ INT+2 + cmp r6,r0 @ INT+3 blo copy_real_file_or_string_2 - cmp r6,r1 @ CHAR+2 + cmp r6,r1 @ CHAR+3 bhi copy_normal_hnf_0_2 copy_int_bool_or_char_2: ldr r4,[r7,#4] beq copy_char_2 - cmp r6,r0 @ INT+2 + cmp r6,r0 @ INT+3 bne no_small_int_or_char_2 copy_int_2: @@ -282,10 +283,10 @@ copy_record_node2_1_b: str r6,[r9,#-8] str r4,[r9,#-4] - sub r9,r9,#7 + sub r9,r9,#8 str r9,[r7] - sub r9,r9,#1 + add r9,r9,#1 str r9,[r5] @@ -304,7 +305,7 @@ copy_normal_hnf_0_2: b copy_lp1 copy_real_file_or_string_2: - laol r12,__STRING__+2,__STRING___o_2,7 + laol r12,__STRING__+3,__STRING___o_2,7 otoa r12,__STRING___o_2,7 cmp r6,r12 bls copy_string_or_array_2 @@ -331,7 +332,7 @@ copy_real_or_file_2: b copy_lp1 already_copied_2: - sub r6,r6,#1 + add r6,r6,#1 subs r3,r3,#1 str r6,[r5] @@ -353,7 +354,7 @@ copy_record_2: str r10,[r5] str r6,[r10] - add r6,r10,#1 + add r6,r10,#0 ldr r4,[r7,#4] str r6,[r7] @@ -378,7 +379,7 @@ copy_record_node2_1: str r10,[r5] str r6,[r10] - add r6,r10,#1 + add r6,r10,#0 str r4,[r10,#4] str r6,[r7] @@ -394,7 +395,7 @@ copy_record_node2_3: bls copy_record_node2_3_ab_or_b str r4,[sp,#-4]! - add r4,r10,#1 + add r4,r10,#0 str r4,[r7] ldr r4,[r7,#8] @@ -408,7 +409,7 @@ copy_record_node2_3: ldr r12,[r4] mov r6,r4 tst r12,#1 - bne record_arguments_already_copied_2 + beq record_arguments_already_copied_2 add r7,r10,#12 @@ -453,7 +454,7 @@ copy_record_node2_3_ab_or_b: copy_record_node2_3_ab: str r4,[sp,#-4]! - add r4,r10,#1 + add r4,r10,#0 lao r12,heap_p1,9 @@ -592,7 +593,7 @@ record_arguments_already_copied_3_b: ldr r7,[r6] ldr r4,[sp],#4 - sub r7,r7,#1 + add r7,r7,#1 str r7,[r9,#8] subs r3,r3,#1 @@ -602,7 +603,7 @@ record_arguments_already_copied_3_b: not_in_hnf_2: tst r6,#1 - bne already_copied_2 + beq already_copied_2 ldr r4,[r6,#-4] cmp r4,#0 @@ -662,7 +663,7 @@ copy_indirection_2: bne in_hnf_2 tst r6,#1 - bne already_copied_2 + beq already_copied_2 ldr r12,[r6,#-4] cmp r12,#-2 @@ -679,7 +680,7 @@ skip_indirections_2: tst r6,#2 bne update_indirection_list_2 tst r6,#1 - bne update_indirection_list_2 + beq update_indirection_list_2 ldr r12,[r6,#-4] cmp r12,#-2 @@ -967,8 +968,10 @@ copy_arity_0_node2_: blt copy_selector_2 str r6,[r9,#-12]! - str r9,[r5] add r4,r9,#1 + str r4,[r5] + sub r4,r4,#1 + @mov r4,r9 str r4,[r7] @@ -980,7 +983,7 @@ copy_arity_0_node2_: copy_string_or_array_2: .ifdef DLL beq copy_string_2 - laol r12,__ARRAY__+2,__ARRAY___o_2,15 + laol r12,__ARRAY__+3,__ARRAY___o_2,15 otoa r12,__ARRAY___o_2,15 cmp r6,r12 blo copy_normal_hnf_0_2 @@ -1016,7 +1019,7 @@ copy_string_2: str r3,[r9,#-8]! str r9,[r5] - add r7,r9,#1 + sub r7,r9,#1 str r7,[r6,#-4] add r7,r9,#4 @@ -1074,20 +1077,20 @@ copy_array_a3: str r4,[r7] - add r4,r7,#1 + sub r4,r7,#1 add r7,r7,#4 str r4,[r6],#4 - add r4,r3,#1 + sub r4,r3,#1 b cp_s_arg_lp2 copy_strict_basic_array_2: ldr r3,[r6,#4] - cmp r4,r0 @ INT+2 + cmp r4,r0 @ INT+3 beq copy_int_array_2 - laol r12,BOOL+2,BOOL_o_2,4 + laol r12,BOOL+3,BOOL_o_2,4 otoa r12,BOOL_o_2,4 cmp r4,r12 beq copy_bool_array_2 @@ -1104,12 +1107,12 @@ copy_int_array_2: mov r9,r7 str r4,[r7] - add r4,r7,#1 + sub r4,r7,#1 add r7,r7,#4 str r4,[r6],#4 - add r4,r3,#1 + sub r4,r3,#1 b cp_s_arg_lp2 copy_bool_array_2: @@ -1306,7 +1309,7 @@ copy_array_21_lp_ab_next: .ifdef PIC lto small_integers,1 lto static_characters,1 - ltol __STRING__+2,__STRING___o_2,7 + ltol __STRING__+3,__STRING___o_2,7 lto heap_p1,9 lto heap_copied_vector,4 lto heap_p1,10 @@ -1319,13 +1322,13 @@ copy_array_21_lp_ab_next: lto heap_p1,12 lto heap_copied_vector,7 .ifdef DLL - ltol __ARRAY__+2,__ARRAY___o_2,15 + ltol __ARRAY__+3,__ARRAY___o_2,15 .endif lto heap_p1,13 lto semi_space_size,1 lto heap_p1,14 lto semi_space_size,2 - ltol BOOL+2,BOOL_o_2,4 + ltol BOOL+3,BOOL_o_2,4 .endif .ltorg -- cgit v1.2.3