summaryrefslogtreecommitdiff
path: root/thread/icompact_rmark.s
blob: f61535fa6bd5f6d59af6d49b8dff9a0aefa686c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
rmark_stack_nodes1:
	movl	(a0),d1
	lea	1(a3),d0
	movl	d1,(a3)
	movl	d0,(a0)

rmark_next_stack_node:
	addl	$4,a3

rmark_stack_nodes:
	cmpl	end_vector_offset(a4),a3
	je	end_rmark_nodes

rmark_more_stack_nodes:
	movl	(a3),a0
	movl	neg_heap_p3_offset(a4),d1
	movl	heap_vector_d4_offset(a4),a2

	addl	a0,d1
	cmpl	heap_size_32_33_offset(a4),d1
	jnc	rmark_next_stack_node

	movl	$31*4,d0
	andl	d1,d0
	shrl	$7,d1
	addl	a2,d1

	movl	bit_set_table(d0),d0
	movl	(,d1,4),a2
	test	d0,a2
	jne	rmark_stack_nodes1

	orl	d0,a2
	movl	a2,(,d1,4)

	movl	(a0),d0
	call	rmark_stack_node

	addl	$4,a3
	cmpl	end_vector_offset(a4),a3
	jne	rmark_more_stack_nodes
	ret

rmark_stack_node:
	subl	$8,sp
	movl	d0,(a3)
	lea	1(a3),a2
	movl	a3,4(sp)
	movl	$-1,d1
	movl	$0,(sp)
	movl	a2,(a0)
	jmp	rmark_no_reverse

rmark_node_d1:
	movl	neg_heap_p3_offset(a4),d0
	movl	heap_vector_d4_offset(a4),a2
	addl	a0,d0
	cmpl	heap_size_32_33_offset(a4),d0
	jnc	rmark_next_node

	jmp	rmark_node_

rmark_hnf_2:
	leal	4(a0),d1
	movl	4(a0),d0
	subl	$8,sp

	movl	a0,a3
	movl	(a0),a0

	movl	d1,4(sp)
	movl	d0,(sp)	

	cmpl	end_stack_offset(a4),sp
	jb	rmark_using_reversal

rmark_node:
	movl	neg_heap_p3_offset(a4),d0
	movl	heap_vector_d4_offset(a4),a2
	addl	a0,d0
	cmpl	heap_size_32_33_offset(a4),d0
	jnc	rmark_next_node

	movl	a3,d1

rmark_node_:
	movl	$31*4,a1
	andl	d0,a1
	shrl	$7,d0
	addl	a2,d0

	movl	bit_set_table(a1),a1
	movl	(,d0,4),a2
	test	a1,a2
	jne	rmark_reverse_and_mark_next_node

	orl	a1,a2
	movl	a2,(,d0,4)

	movl	(a0),d0
rmark_arguments:
	cmpl	d1,a0
	ja	rmark_no_reverse

	lea	1(a3),a2
	movl	d0,(a3)
	movl	a2,(a0)

rmark_no_reverse:
	test	$2,d0
	je	rmark_lazy_node

	movzwl	-2(d0),a2
	test	a2,a2
	je	rmark_hnf_0

	addl	$4,a0

	cmp	$256,a2
	jae	rmark_record

	subl	$2,a2
	je	rmark_hnf_2
	jc	rmark_hnf_1

rmark_hnf_3:
	movl	4(a0),a1
rmark_hnf_3_:
	cmpl	end_stack_offset(a4),sp
	jb	rmark_using_reversal_

	movl	neg_heap_p3_offset(a4),d1
	addl	a1,d1

	movl	$31*4,d0
	andl	d1,d0	
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_set_table(d0),d0
	test	(,d1,4),d0
	jne	rmark_shared_argument_part

	orl	d0,(,d1,4)	

rmark_no_shared_argument_part:
	subl	$8,sp
	movl	a0,4(sp)
	lea	4(a0),a3
	movl	(a0),a0
	lea	(a1,a2,4),a1
	movl	a0,(sp)

rmark_push_hnf_args:
	movl	(a1),d1
	subl	$8,sp
	movl	a1,4(sp)
	subl	$4,a1
	movl	d1,(sp)

	subl	$1,a2
	jg	rmark_push_hnf_args

	movl	(a1),a0

	cmpl	a3,a1
	ja	rmark_no_reverse_argument_pointer

	lea	3(a3),a2
	movl	a0,(a3)
	movl	a2,(a1)

	movl	neg_heap_p3_offset(a4),d0
	movl	heap_vector_d4_offset(a4),a2
	addl	a0,d0
	cmpl	heap_size_32_33_offset(a4),d0
	jnc	rmark_next_node

	movl	a1,d1
	jmp	rmark_node_

rmark_no_reverse_argument_pointer:
	movl	a1,a3
	jmp	rmark_node

rmark_shared_argument_part:
	cmpl	a0,a1
	ja	rmark_hnf_1

	movl	(a1),d1
	leal	4+2+1(a0),d0
	movl	d0,(a1)
	movl	d1,4(a0)
	jmp	rmark_hnf_1

rmark_record:
	subl	$258,a2
	je	rmark_record_2
	jb	rmark_record_1

rmark_record_3:
	movzwl	-2+2(d0),a2
	movl	4(a0),a1
	subl	$1,a2
	jb	rmark_record_3_bb
	je	rmark_record_3_ab
	subl	$1,a2
	je	rmark_record_3_aab
	jmp	rmark_hnf_3_

rmark_record_3_bb:
	subl	$4,a0

	movl	neg_heap_p3_offset(a4),a2
	addl	a1,a2

	movl	$31*4,d0
	andl	a2,d0
	shrl	$7,a2
	addl	heap_vector_d4_offset(a4),a2

	movl	bit_set_table(d0),d0
	orl	d0,(,a2,4)

	cmpl	a0,a1
	ja	rmark_next_node

	add	d0,d0
	jne	rmark_bit_in_same_word1
	inc	a2
	mov	$1,d0
rmark_bit_in_same_word1:
	testl	(,a2,4),d0
	je	rmark_not_yet_linked_bb

	movl	neg_heap_p3_offset(a4),a2
	addl	a0,a2

	addl	$2*4,a2

	movl	$31*4,d0
	andl	a2,d0
	shrl	$7,a2
	addl	heap_vector_d4_offset(a4),a2

	movl	bit_set_table(d0),d0
	orl	d0,(,a2,4)

	movl	(a1),a2
	lea	8+2+1(a0),d0
	movl	a2,8(a0)
	movl	d0,(a1)
	jmp	rmark_next_node

rmark_not_yet_linked_bb:
	orl	d0,(,a2,4)
	movl	(a1),a2
	lea	8+2+1(a0),d0
	movl	a2,8(a0)
	movl	d0,(a1)
	jmp	rmark_next_node

rmark_record_3_ab:
	movl	neg_heap_p3_offset(a4),a2
	addl	a1,a2

	movl	$31*4,d0
	andl	a2,d0
	shrl	$7,a2
	addl	heap_vector_d4_offset(a4),a2

	movl	bit_set_table(d0),d0
	orl	d0,(,a2,4)

	cmpl	a0,a1
	ja	rmark_hnf_1

	add	d0,d0
	jne	rmark_bit_in_same_word2
	inc	a2
	mov	$1,d0
rmark_bit_in_same_word2:
	testl	(,a2,4),d0
	je	rmark_not_yet_linked_ab

	movl	neg_heap_p3_offset(a4),a2
	addl	a0,a2

	addl	$4,a2

	movl	$31*4,d0
	andl	a2,d0
	shrl	$7,a2
	addl	heap_vector_d4_offset(a4),a2

	movl	bit_set_table(d0),d0
	orl	d0,(,a2,4)

	movl	(a1),a2
	lea	4+2+1(a0),d0
	movl	a2,4(a0)
	movl	d0,(a1)
	jmp	rmark_hnf_1

rmark_not_yet_linked_ab:
	orl	d0,(,a2,4)
	movl	(a1),a2
	lea	4+2+1(a0),d0
	movl	a2,4(a0)
	movl	d0,(a1)
	jmp	rmark_hnf_1

rmark_record_3_aab:
	cmpl	end_stack_offset(a4),sp
	jb	rmark_using_reversal_

	movl	neg_heap_p3_offset(a4),a2
	addl	a1,a2

	movl	$31*4,d0
	andl	a2,d0
	shrl	$7,a2
	addl	heap_vector_d4_offset(a4),a2

	movl	bit_set_table(d0),d0
	testl	(,a2,4),d0
	jne	rmark_shared_argument_part

	orl	d0,(,a2,4)

	subl	$8,sp
	movl	a0,4(sp)
	lea	4(a0),a3
	movl	(a0),a0
	movl	a0,(sp)

	movl	(a1),a0

	cmpl	a3,a1
	ja	rmark_no_reverse_argument_pointer

	lea	3(a3),a2
	movl	a0,(a3)
	movl	a2,(a1)

	movl	neg_heap_p3_offset(a4),d0
	movl	heap_vector_d4_offset(a4),a2
	addl	a0,d0
	cmpl	heap_size_32_33_offset(a4),d0
	jnc	rmark_next_node

	movl	a1,d1
	jmp	rmark_node_

rmark_record_2:
	cmpw	$1,-2+2(d0)
	ja	rmark_hnf_2
	je	rmark_hnf_1
	jmp	rmark_next_node

rmark_record_1:
	cmpw	$0,-2+2(d0)
	jne	rmark_hnf_1
	jmp	rmark_next_node

rmark_lazy_node_1:
/ selectors:
	jne	rmark_selector_node_1

rmark_hnf_1:
	movl	a0,a3
	movl	(a0),a0
	jmp	rmark_node

/ selectors
rmark_indirection_node:
	movl	neg_heap_p3_offset(a4),a1

	subl	$4,a0

	addl	a0,a1

	movl	$31*4,a2
	andl	a1,a2
	shrl	$7,a1
	addl	heap_vector_d4_offset(a4),a1

	movl	bit_clear_table(a2),a2
	andl	a2,(,a1,4)

	movl	a0,a1
	cmpl	d1,a0
	movl	4(a0),a0
	movl	a0,(a3)
	ja	rmark_node_d1
	movl	d0,(a1)
	jmp	rmark_node_d1

rmark_selector_node_1:
	addl	$3,a2
	je	rmark_indirection_node

	movl	(a0),a1
	movl	d1,pointer_compare_address

	movl	neg_heap_p3_offset(a4),d1
	addl	a1,d1

	addl	$1,a2
	jle	rmark_record_selector_node_1

	movl	$31*4,a2
	andl	d1,a2
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_set_table(,a2),a2
	movl	(,d1,4),d1
	andl	a2,d1
	jne	rmark_hnf_1

	movl	(a1),d1
	testb	$2,d1b
	je	rmark_hnf_1

	cmpw	$2,-2(d1)
	jbe	rmark_small_tuple_or_record

rmark_large_tuple_or_record:
	movl	8(a1),d1
	addl	neg_heap_p3_offset(a4),d1

	movl	$31*4,a2
	andl	d1,a2
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_set_table(,a2),a2
	movl	(,d1,4),d1
	andl	a2,d1
	jne	rmark_hnf_1

	movl	neg_heap_p3_offset(a4),d1
	lea	-4(a0,d1),d1

	pushl	a0

	movl	-8(d0),d0

	movl	$31*4,a0
	andl	d1,a0
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_clear_table(a0),a0
	andl	a0,(,d1,4)

	movzwl	4(d0),d0
	movl	pointer_compare_address,d1

	cmpl	$8,d0
	jl	rmark_tuple_or_record_selector_node_2
	movl	8(a1),a1
	je	rmark_tuple_selector_node_2
	movl	-12(a1,d0),a0
	pop	a1
	movl	a0,(a3)
	movl	$__indirection,-4(a1)
	movl	a0,(a1)
	jmp	rmark_node_d1

rmark_tuple_selector_node_2:
	movl	(a1),a0
	pop	a1
	movl	a0,(a3)
	movl	$__indirection,-4(a1)
	movl	a0,(a1)
	jmp	rmark_node_d1

rmark_record_selector_node_1:
	je	rmark_strict_record_selector_node_1

	movl	$31*4,a2
	andl	d1,a2
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_set_table(,a2),a2
	movl	(,d1,4),d1
	andl	a2,d1
	jne	rmark_hnf_1

	movl	(a1),d1
	testb	$2,d1b
	je	rmark_hnf_1

	cmpw	$258,-2(d1)
	jbe	rmark_small_tuple_or_record

	movl	8(a1),d1
	addl	neg_heap_p3_offset(a4),d1

	movl	$31*4,a2
	andl	d1,a2
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_set_table(,a2),a2
	movl	(,d1,4),d1
	andl	a2,d1
	jne	rmark_hnf_1

rmark_small_tuple_or_record:
	movl	neg_heap_p3_offset(a4),d1
	lea	-4(a0,d1),d1

	pushl	a0

	movl	-8(d0),d0

	movl	$31*4,a0
	andl	d1,a0
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_clear_table(a0),a0
	andl	a0,(,d1,4)

	movzwl	4(d0),d0
	movl	pointer_compare_address,d1

	cmpl	$8,d0
	jle	rmark_tuple_or_record_selector_node_2
	movl	8(a1),a1
	subl	$12,d0
rmark_tuple_or_record_selector_node_2:
	movl	(a1,d0),a0
	pop	a1
	movl	a0,(a3)
	movl	$__indirection,-4(a1)
	movl	a0,(a1)
	jmp	rmark_node_d1

rmark_strict_record_selector_node_1:
	movl	$31*4,a2
	andl	d1,a2
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_set_table(,a2),a2
	movl	(,d1,4),d1
	andl	a2,d1
	jne	rmark_hnf_1

	movl	(a1),d1
	testb	$2,d1b
	je	rmark_hnf_1

	cmpw	$258,-2(d1)
	jbe	rmark_select_from_small_record

	movl	8(a1),d1
	addl	neg_heap_p3_offset(a4),d1

	movl	$31*4,a2
	andl	d1,a2
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_set_table(a2),a2
	movl	(,d1,4),d1
	andl	a2,d1
	jne	rmark_hnf_1

rmark_select_from_small_record:
	movl	-8(d0),d1
	subl	$4,a0

	cmpl	pointer_compare_address,a0
	ja	rmark_selector_pointer_not_reversed

	movzwl	4(d1),d0
	cmpl	$8,d0
	jle	rmark_strict_record_selector_node_2
	addl	8(a1),d0
	movl	-12(d0),d0
	jmp	rmark_strict_record_selector_node_3
rmark_strict_record_selector_node_2:
	movl	(a1,d0),d0
rmark_strict_record_selector_node_3:
	movl	d0,4(a0)

	movzwl	6(d1),d0
	testl	d0,d0
	je	rmark_strict_record_selector_node_5
	cmpl	$8,d0
	jle	rmark_strict_record_selector_node_4
	movl	8(a1),a1
	subl	$12,d0
rmark_strict_record_selector_node_4:
	movl	(a1,d0),d0
	movl	d0,8(a0)
rmark_strict_record_selector_node_5:

	movl	-4(d1),d0

	addl	$1,a3
	movl	a3,(a0)
	movl	d0,-1(a3)
	jmp	rmark_next_node

rmark_selector_pointer_not_reversed:
	movzwl	4(d1),d0
	cmpl	$8,d0
	jle	rmark_strict_record_selector_node_6
	addl	8(a1),d0
	movl	-12(d0),d0
	jmp	rmark_strict_record_selector_node_7
rmark_strict_record_selector_node_6:
	movl	(a1,d0),d0
rmark_strict_record_selector_node_7:
	movl	d0,4(a0)

	movzwl	6(d1),d0
	testl	d0,d0
	je	rmark_strict_record_selector_node_9
	cmpl	$8,d0
	jle	rmark_strict_record_selector_node_8
	movl	8(a1),a1
	subl	$12,d0
rmark_strict_record_selector_node_8:
	movl	(a1,d0),d0
	movl	d0,8(a0)
rmark_strict_record_selector_node_9:

	movl	-4(d1),d0
	movl	d0,(a0)
	jmp	rmark_next_node

rmark_reverse_and_mark_next_node:
	cmpl	d1,a0
	ja	rmark_next_node

	movl	(a0),d0
	movl	d0,(a3)
	addl	$1,a3
	movl	a3,(a0)

/ a2,d1: free

rmark_next_node:
	movl	(sp),a0
	movl	4(sp),a3
	addl	$8,sp

	cmpl	$1,a0
	ja	rmark_node

rmark_next_node_:
end_rmark_nodes:
	ret

rmark_lazy_node:
	movl	-4(d0),a2
	test	a2,a2
	je	rmark_next_node

	addl	$4,a0

	subl	$1,a2
	jle	rmark_lazy_node_1

	cmpl	$255,a2
	jge	rmark_closure_with_unboxed_arguments

rmark_closure_with_unboxed_arguments_:
	lea	(a0,a2,4),a0

rmark_push_lazy_args:
	movl	(a0),d1
	subl	$8,sp
	movl	a0,4(sp)
	subl	$4,a0
	movl	d1,(sp)
	subl	$1,a2
	jg	rmark_push_lazy_args

	movl	a0,a3
	movl	(a0),a0
	cmpl	end_stack_offset(a4),sp
	jae	rmark_node

	jmp	rmark_using_reversal

rmark_closure_with_unboxed_arguments:
/ (a_size+b_size)+(b_size<<8)
/	addl	$1,a2
	movl	a2,d0
	andl	$255,a2
	shrl	$8,d0
	subl	d0,a2
/	subl	$1,a2
	jg	rmark_closure_with_unboxed_arguments_
	je	rmark_hnf_1
	jmp	rmark_next_node

rmark_hnf_0:
	cmpl	$INT+2,d0
	je	rmark_int_3

	cmpl	$CHAR+2,d0
 	je	rmark_char_3

	jb	rmark_no_normal_hnf_0

	movl	neg_heap_p3_offset(a4),a2
	addl	a0,a2

	movl	$31*4,a1
	andl	a2,a1
	shrl	$7,a2
	addl	heap_vector_d4_offset(a4),a2

	movl	bit_clear_table(a1),a1
	andl	a1,(,a2,4)

	lea	ZERO_ARITY_DESCRIPTOR_OFFSET-2(d0),a1
	movl	a1,(a3)
	cmpl	d1,a0
	ja	rmark_next_node
	movl	d0,(a0)
	jmp	rmark_next_node

rmark_int_3:
	movl	4(a0),a2
	cmpl	$33,a2
	jnc	rmark_next_node

	lea	small_integers(,a2,8),a1
	movl	neg_heap_p3_offset(a4),a2
	movl	a1,(a3)
	addl	a0,a2

	movl	$31*4,a1
	andl	a2,a1
	shrl	$7,a2
	addl	heap_vector_d4_offset(a4),a2

	movl	bit_clear_table(a1),a1
	andl	a1,(,a2,4)

	cmpl	d1,a0
	ja	rmark_next_node
	movl	d0,(a0)
	jmp	rmark_next_node

rmark_char_3:
	movzbl	4(a0),a1
	movl	neg_heap_p3_offset(a4),a2

	lea	static_characters(,a1,8),a1
	addl	a0,a2

	movl	a1,(a3)

	movl	$31*4,a1
	andl	a2,a1
	shrl	$7,a2
	addl	heap_vector_d4_offset(a4),a2

	movl	bit_clear_table(a1),a1
	andl	a1,(,a2,4)

	cmpl	d1,a0
	ja	rmark_next_node
	movl	d0,(a0)
	jmp	rmark_next_node

rmark_no_normal_hnf_0:
	cmpl	$__ARRAY__+2,d0
	jne	rmark_next_node

	movl	8(a0),d0
	test	d0,d0
	je	rmark_lazy_array

	movzwl	-2+2(d0),a1
	test	a1,a1
	je	rmark_b_array

	movzwl	-2(d0),d0
	test	d0,d0
	je	rmark_b_array

	cmpl	end_stack_offset(a4),sp
	jb	rmark_array_using_reversal

	subl	$256,d0
	cmpl	d0,a1
	movl	a1,d1
	je	rmark_a_record_array

rmark_ab_record_array:
	movl	4(a0),a1
	addl	$8,a0
	pushl	a0

	imull	d0,a1
	shl	$2,a1

	subl	d1,d0
	addl	$4,a0
	addl	a0,a1
	call	reorder
	
	popl	a0
	movl	d1,d0
	imull	-4(a0),d0	
	jmp	rmark_lr_array

rmark_b_array:
	movl	neg_heap_p3_offset(a4),a2
	addl	a0,a2

	addl	$4,a2

	movl	$31*4,d0
	andl	a2,d0
	shrl	$7,a2
	addl	heap_vector_d4_offset(a4),a2

	movl	bit_set_table(d0),d0
	orl	d0,(,a2,4)
	jmp	rmark_next_node

rmark_a_record_array:
	movl	4(a0),d0
	addl	$8,a0
	cmpl	$2,d1
	jb	rmark_lr_array

	imull	d1,d0
	jmp	rmark_lr_array

rmark_lazy_array:
	cmpl	end_stack_offset(a4),sp
	jb	rmark_array_using_reversal

	movl	4(a0),d0
	addl	$8,a0

rmark_lr_array:
	movl	neg_heap_p3_offset(a4),a1
	addl	a0,a1
	shrl	$2,a1
	addl	d0,a1

	movl	$31,d1
	andl	a1,d1
	shrl	$5,a1
	addl	heap_vector_d4_offset(a4),a1

	movl	bit_set_table(,d1,4),d1
	orl	d1,(,a1,4)

	cmpl	$1,d0
	jbe	rmark_array_length_0_1
	movl	a0,a1
	lea	(a0,d0,4),a0

	movl	(a0),d0
	movl	(a1),d1
	movl	d0,(a1)
	movl	d1,(a0)

	movl	-4(a0),d0
	subl	$4,a0
	movl	-4(a1),d1
	subl	$4,a1
	movl	d1,(a0)
	movl	d0,(a1)
	pushl	a0
	movl	a1,a3
	jmp	rmark_array_nodes

rmark_array_nodes1:
	cmpl	a3,a0
	ja	rmark_next_array_node

	movl	(a0),d1
	lea	1(a3),d0
	movl	d1,(a3)
	movl	d0,(a0)

rmark_next_array_node:
	addl	$4,a3
	cmpl	(sp),a3
	je	end_rmark_array_node

rmark_array_nodes:
	movl	(a3),a0

	movl	neg_heap_p3_offset(a4),d1
	addl	a0,d1
	cmpl	heap_size_32_33_offset(a4),d1
	jnc	rmark_next_array_node

	movl	$31*4,d0
	andl	d1,d0
	shrl	$7,d1
	addl	heap_vector_d4_offset(a4),d1

	movl	bit_set_table(d0),d0
	movl	(,d1,4),a2
	test	d0,a2
	jne	rmark_array_nodes1

	orl	d0,a2
	movl	a2,(,d1,4)

	movl	(a0),d0
	call	rmark_array_node

	addl	$4,a3
	cmpl	(sp),a3
	jne	rmark_array_nodes

end_rmark_array_node:
	addl	$4,sp
	jmp	rmark_next_node

rmark_array_node:
	subl	$8,sp
	movl	a3,4(sp)
	movl	a3,d1
	movl	$1,(sp)
	jmp	rmark_arguments

rmark_array_length_0_1:
	lea	-8(a0),a0
	jb	rmark_next_node

	movl	12(a0),d1
	movl	8(a0),a2
	movl	a2,12(a0)
	movl	4(a0),a2
	movl	a2,8(a0)
	movl	d1,4(a0)
	addl	$4,a0
	jmp	rmark_hnf_1

	.data
pointer_compare_address:	.long	0
	.text