... |
... |
@@ -407,7 +407,7 @@ asm_word(lispobj* ptr, lispobj object, FILE* f) |
407
|
407
|
{
|
408
|
408
|
unsigned long val = (unsigned long) object;
|
409
|
409
|
|
410
|
|
- fprintf(f, "\t.4byte\t0x%lx\t# %ld\n", val, val);
|
|
410
|
+ fprintf(f, "\t.4byte\t0x%08lx\t# %ld\n", val, val);
|
411
|
411
|
}
|
412
|
412
|
|
413
|
413
|
void
|
... |
... |
@@ -419,8 +419,12 @@ asm_lispobj(lispobj* ptr, lispobj object, FILE* f) |
419
|
419
|
fprintf(f, "0x%lx\t# fixnum %ld\n",
|
420
|
420
|
(long) object,
|
421
|
421
|
((long) object) >> 2);
|
|
422
|
+ } else if ((object & 7) == 2 ||
|
|
423
|
+ (object & 7) == 6) {
|
|
424
|
+ /* Other immediates */
|
|
425
|
+ fprintf(f, "0x%08lx\n", object);
|
422
|
426
|
} else {
|
423
|
|
- fprintf(f, "L%lx + %lu\n", PTR(object), LowtagOf(object));
|
|
427
|
+ fprintf(f, "L%08lx + %lu\n", PTR(object), LowtagOf(object));
|
424
|
428
|
}
|
425
|
429
|
}
|
426
|
430
|
|
... |
... |
@@ -564,6 +568,22 @@ asm_closure_header(lispobj* ptr, lispobj object, FILE* f) |
564
|
568
|
return asm_boxed(ptr, object, f);
|
565
|
569
|
}
|
566
|
570
|
|
|
571
|
+int
|
|
572
|
+asm_symbol_header(lispobj* ptr, lispobj object, FILE* f)
|
|
573
|
+{
|
|
574
|
+ struct symbol* sym = (struct symbol*) ptr;
|
|
575
|
+
|
|
576
|
+ asm_label(ptr, object, f);
|
|
577
|
+ asm_header_word(ptr, object, f, "symbol header");
|
|
578
|
+ asm_lispobj(&sym->value, sym->value, f);
|
|
579
|
+ asm_lispobj(&sym->hash, sym->hash, f);
|
|
580
|
+ asm_lispobj(&sym->plist, sym->plist, f);
|
|
581
|
+ asm_lispobj(&sym->name, sym->name, f);
|
|
582
|
+ asm_lispobj(&sym->package, sym->package, f);
|
|
583
|
+
|
|
584
|
+ return 1 + HeaderValue(object);
|
|
585
|
+}
|
|
586
|
+
|
567
|
587
|
int
|
568
|
588
|
asm_complex_vector(lispobj* ptr, lispobj object, FILE* f)
|
569
|
589
|
{
|
... |
... |
@@ -578,6 +598,8 @@ asm_code_header(lispobj* ptr, lispobj object, FILE* f) |
578
|
598
|
int ncode_words;
|
579
|
599
|
int nwords;
|
580
|
600
|
int k;
|
|
601
|
+ lispobj fheaderl;
|
|
602
|
+ struct function *fheaderp;
|
581
|
603
|
|
582
|
604
|
code = (struct code *) ptr;
|
583
|
605
|
ncode_words = fixnum_value(code->code_size);
|
... |
... |
@@ -597,12 +619,66 @@ asm_code_header(lispobj* ptr, lispobj object, FILE* f) |
597
|
619
|
asm_lispobj(ptr + k + 1, ptr[k + 1], f);
|
598
|
620
|
}
|
599
|
621
|
|
600
|
|
- fprintf(f, "# Code bytes?\n");
|
601
|
|
-
|
602
|
|
- for (; k < nwords; ++k) {
|
603
|
|
- fprintf(f, "\t.4byte\t0x%lx\n", ptr[k + 1]);
|
|
622
|
+ fheaderl = code->entry_points;
|
|
623
|
+ while (fheaderl != NIL) {
|
|
624
|
+ int code_words;
|
|
625
|
+ int fheader_len;
|
|
626
|
+
|
|
627
|
+ fheaderp = (struct function *) PTR(fheaderl);
|
|
628
|
+ fheader_len = HeaderValue(fheaderp->header);
|
|
629
|
+#if 0
|
|
630
|
+ fprintf(f, "# fheaderp %p\n", (void*) fheaderp);
|
|
631
|
+ fprintf(f, "# ->header 0x%lx\n", fheaderp->header);
|
|
632
|
+ fprintf(f, "# ->self 0x%lx\n", fheaderp->self);
|
|
633
|
+ fprintf(f, "# ->next 0x%lx\n", fheaderp->next);
|
|
634
|
+ fprintf(f, "# ->name 0x%lx\n", fheaderp->name);
|
|
635
|
+ fprintf(f, "# ->arglist 0x%lx\n", fheaderp->arglist);
|
|
636
|
+ fprintf(f, "# ->type 0x%lx\n", fheaderp->type);
|
|
637
|
+ fprintf(f, "# ->code %p\n", &fheaderp->code);
|
|
638
|
+#endif
|
|
639
|
+ asm_label((lispobj*)fheaderp, *((lispobj*)fheaderp), f);
|
|
640
|
+ asm_header_word(&fheaderp->header, fheaderp->header, f, "function header");
|
|
641
|
+ fprintf(f, "\t.4byte\tL%lx\n", fheaderp->self);
|
|
642
|
+ asm_lispobj(&fheaderp->next, fheaderp->next, f);
|
|
643
|
+ asm_lispobj(&fheaderp->name, fheaderp->name, f);
|
|
644
|
+ asm_lispobj(&fheaderp->arglist, fheaderp->arglist, f);
|
|
645
|
+ asm_lispobj(&fheaderp->type, fheaderp->type, f);
|
|
646
|
+ asm_label((lispobj*)fheaderp->code, 0, f);
|
|
647
|
+
|
|
648
|
+ /* We've sent out 6 of the total code words */
|
|
649
|
+ ncode_words -= fheader_len;
|
|
650
|
+
|
|
651
|
+ /*
|
|
652
|
+ * TODO: Adopt trans_code or apply_code_fixups to process the code
|
|
653
|
+ * here so we can relocate everthing.
|
|
654
|
+ */
|
|
655
|
+ fprintf(f, "# Code bytes\n");
|
|
656
|
+
|
|
657
|
+ /* Dump out code between here and the next function header */
|
|
658
|
+ if (fheaderp->next != NIL) {
|
|
659
|
+ code_words = (fheaderp->next - fheaderl) / 4 - fheader_len;
|
|
660
|
+ } else {
|
|
661
|
+ code_words = ncode_words;
|
|
662
|
+ }
|
|
663
|
+
|
|
664
|
+ fprintf(f, "# fheaderp->next %p code words %d ncode_words %d\n",
|
|
665
|
+ (void*)fheaderp->next, code_words, ncode_words);
|
|
666
|
+
|
|
667
|
+ {
|
|
668
|
+ uint32_t* code_data = (uint32_t*) fheaderp->code;
|
|
669
|
+
|
|
670
|
+ for (k = 0; k < code_words; ++k) {
|
|
671
|
+ fprintf(f, "\t.4byte\t0x%08x\t# %p\n", code_data[k],
|
|
672
|
+ fheaderp->code + 4*k);
|
|
673
|
+ }
|
|
674
|
+ }
|
|
675
|
+
|
|
676
|
+ ncode_words -= code_words;
|
|
677
|
+
|
|
678
|
+ fheaderl = fheaderp->next;
|
604
|
679
|
}
|
605
|
|
-
|
|
680
|
+
|
|
681
|
+ asm_align(f);
|
606
|
682
|
return nwords;
|
607
|
683
|
}
|
608
|
684
|
|
... |
... |
@@ -659,9 +735,42 @@ asm_simple_string(lispobj* where, lispobj object, FILE* f) |
659
|
735
|
return nwords;
|
660
|
736
|
}
|
661
|
737
|
|
|
738
|
+int
|
|
739
|
+asm_vector_bit(lispobj* ptr, lispobj object, FILE* f)
|
|
740
|
+{
|
|
741
|
+ struct vector *vector;
|
|
742
|
+ int length, nwords;
|
|
743
|
+ unsigned long* data;
|
|
744
|
+ int k;
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+ vector = (struct vector *) ptr;
|
|
748
|
+ length = fixnum_value(vector->length);
|
|
749
|
+#ifdef __x86_64
|
|
750
|
+ nwords = CEILING(NWORDS(length, 64) + 2, 2);
|
|
751
|
+#else
|
|
752
|
+ nwords = CEILING(NWORDS(length, 32) + 2, 2);
|
|
753
|
+#endif
|
|
754
|
+
|
|
755
|
+ asm_label(ptr, object, f);
|
|
756
|
+ asm_header_word(ptr, object, f, "simple bit-vector");
|
|
757
|
+ asm_lispobj(ptr + 1, ptr[1], f);
|
|
758
|
+
|
|
759
|
+ data = vector->data;
|
|
760
|
+
|
|
761
|
+ for (k = 0; k < nwords - 2; ++k) {
|
|
762
|
+ fprintf(f, "\t.4byte\t0x%lx\n", data[k]);
|
|
763
|
+ }
|
|
764
|
+
|
|
765
|
+ return nwords;
|
|
766
|
+
|
|
767
|
+}
|
|
768
|
+
|
|
769
|
+
|
662
|
770
|
void
|
663
|
771
|
print_float(FILE* f, float value)
|
664
|
772
|
{
|
|
773
|
+#if 0
|
665
|
774
|
if (isfinite(value)) {
|
666
|
775
|
fprintf(f, "\t.float\t%.15g\n", value);
|
667
|
776
|
} else {
|
... |
... |
@@ -674,6 +783,17 @@ print_float(FILE* f, float value) |
674
|
783
|
val.f = value;
|
675
|
784
|
fprintf(f, "\t.4byte\t0x%x\n", val.a);
|
676
|
785
|
}
|
|
786
|
+#else
|
|
787
|
+ union
|
|
788
|
+ {
|
|
789
|
+ uint32_t a;
|
|
790
|
+ float f;
|
|
791
|
+ } val;
|
|
792
|
+
|
|
793
|
+ val.f = value;
|
|
794
|
+ fprintf(f, "\t.4byte\t0x%x\t# %lg\n", val.a, value);
|
|
795
|
+#endif
|
|
796
|
+
|
677
|
797
|
}
|
678
|
798
|
|
679
|
799
|
int
|
... |
... |
@@ -684,7 +804,6 @@ asm_single_float(lispobj* ptr, lispobj object, FILE* f) |
684
|
804
|
asm_label(ptr, object, f);
|
685
|
805
|
asm_header_word(ptr, object, f, "single float");
|
686
|
806
|
print_float(f, obj->value);
|
687
|
|
-
|
688
|
807
|
|
689
|
808
|
return 2;
|
690
|
809
|
}
|
... |
... |
@@ -692,8 +811,9 @@ asm_single_float(lispobj* ptr, lispobj object, FILE* f) |
692
|
811
|
void
|
693
|
812
|
print_double(FILE* f, double value)
|
694
|
813
|
{
|
|
814
|
+#if 0
|
695
|
815
|
if (isfinite(value)) {
|
696
|
|
- fprintf(f, "\t.double\t%.15g\n", value);
|
|
816
|
+ fprintf(f, "\t.double\t%.16lg\n", value);
|
697
|
817
|
} else {
|
698
|
818
|
union
|
699
|
819
|
{
|
... |
... |
@@ -706,6 +826,18 @@ print_double(FILE* f, double value) |
706
|
826
|
fprintf(f, "\t.4byte\t0x%x\n", val.a[0]);
|
707
|
827
|
fprintf(f, "\t.4byte\t0x%x\n", val.a[1]);
|
708
|
828
|
}
|
|
829
|
+#else
|
|
830
|
+ union
|
|
831
|
+ {
|
|
832
|
+ uint32_t a[2];
|
|
833
|
+ double d;
|
|
834
|
+ } val;
|
|
835
|
+
|
|
836
|
+ val.d = value;
|
|
837
|
+ fprintf(f, "\t.4byte\t0x%x\t# %.18lg\n", val.a[0], value);
|
|
838
|
+ fprintf(f, "\t.4byte\t0x%x\n", val.a[1]);
|
|
839
|
+
|
|
840
|
+#endif
|
709
|
841
|
}
|
710
|
842
|
|
711
|
843
|
int
|
... |
... |
@@ -751,9 +883,41 @@ asm_complex_single_float(lispobj* ptr, lispobj object, FILE* f) |
751
|
883
|
return CEILING(1 + HeaderValue(object), 2);
|
752
|
884
|
}
|
753
|
885
|
|
|
886
|
+int
|
|
887
|
+asm_complex_double_float(lispobj* ptr, lispobj object, FILE* f)
|
|
888
|
+{
|
|
889
|
+ struct complex_double_float* obj = (struct complex_double_float*) ptr;
|
|
890
|
+
|
|
891
|
+ asm_label(ptr, object, f);
|
|
892
|
+ asm_header_word(ptr, object, f, "complex double-float");
|
|
893
|
+ asm_lispobj(&obj->filler, obj->filler, f);
|
|
894
|
+
|
|
895
|
+ print_double(f, obj->real);
|
|
896
|
+ print_double(f, obj->imag);
|
754
|
897
|
|
|
898
|
+ return CEILING(1 + HeaderValue(object), 2);
|
|
899
|
+}
|
|
900
|
+
|
755
|
901
|
int
|
756
|
|
-asm_vector_unsigned_byte_8(lispobj* ptr, lispobj object, FILE* f)
|
|
902
|
+asm_complex_double_double_float(lispobj* ptr, lispobj object, FILE* f)
|
|
903
|
+{
|
|
904
|
+ struct complex_double_double_float* obj = (struct complex_double_double_float*) ptr;
|
|
905
|
+
|
|
906
|
+ asm_label(ptr, object, f);
|
|
907
|
+ asm_header_word(ptr, object, f, "complex double-float");
|
|
908
|
+ asm_lispobj(&obj->filler, obj->filler, f);
|
|
909
|
+
|
|
910
|
+ print_double(f, obj->real_hi);
|
|
911
|
+ print_double(f, obj->real_lo);
|
|
912
|
+ print_double(f, obj->imag_hi);
|
|
913
|
+ print_double(f, obj->imag_lo);
|
|
914
|
+
|
|
915
|
+ return CEILING(1 + HeaderValue(object), 2);
|
|
916
|
+}
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+int
|
|
920
|
+asm_vector_unsigned_byte_2(lispobj* ptr, lispobj object, FILE* f)
|
757
|
921
|
{
|
758
|
922
|
struct vector *vector;
|
759
|
923
|
int length, nwords;
|
... |
... |
@@ -763,12 +927,12 @@ asm_vector_unsigned_byte_8(lispobj* ptr, lispobj object, FILE* f) |
763
|
927
|
vector = (struct vector *) ptr;
|
764
|
928
|
length = fixnum_value(vector->length);
|
765
|
929
|
#ifdef __x86_64
|
766
|
|
- nwords = CEILING(NWORDS(length, 8) + 2, 2);
|
|
930
|
+ nwords = CEILING(NWORDS(length, 32) + 2, 2);
|
767
|
931
|
#else
|
768
|
|
- nwords = CEILING(NWORDS(length, 4) + 2, 2);
|
|
932
|
+ nwords = CEILING(NWORDS(length, 16) + 2, 2);
|
769
|
933
|
#endif
|
770
|
934
|
asm_label(ptr, object, f);
|
771
|
|
- asm_header_word(ptr, object, f, "vector unsigned_byte 8");
|
|
935
|
+ asm_header_word(ptr, object, f, "vector unsigned_byte 2");
|
772
|
936
|
asm_lispobj(ptr + 1, ptr[1], f);
|
773
|
937
|
|
774
|
938
|
data = vector->data;
|
... |
... |
@@ -777,12 +941,14 @@ asm_vector_unsigned_byte_8(lispobj* ptr, lispobj object, FILE* f) |
777
|
941
|
for (k = 0; k < nwords - 2; ++k) {
|
778
|
942
|
fprintf(f, "\t.4byte\t0x%lx\n", data[k]);
|
779
|
943
|
}
|
|
944
|
+
|
|
945
|
+ asm_align(f);
|
780
|
946
|
|
781
|
947
|
return nwords;
|
782
|
948
|
}
|
783
|
949
|
|
784
|
950
|
int
|
785
|
|
-asm_vector_unsigned_byte_32(lispobj* ptr, lispobj object, FILE* f)
|
|
951
|
+asm_vector_unsigned_byte_4(lispobj* ptr, lispobj object, FILE* f)
|
786
|
952
|
{
|
787
|
953
|
struct vector *vector;
|
788
|
954
|
int length, nwords;
|
... |
... |
@@ -792,13 +958,12 @@ asm_vector_unsigned_byte_32(lispobj* ptr, lispobj object, FILE* f) |
792
|
958
|
vector = (struct vector *) ptr;
|
793
|
959
|
length = fixnum_value(vector->length);
|
794
|
960
|
#ifdef __x86_64
|
795
|
|
- nwords = CEILING(NWORDS(length, 2) + 2, 2);
|
|
961
|
+ nwords = CEILING(NWORDS(length, 16) + 2, 2);
|
796
|
962
|
#else
|
797
|
|
- nwords = CEILING(length + 2, 2);
|
|
963
|
+ nwords = CEILING(NWORDS(length, 8) + 2, 2);
|
798
|
964
|
#endif
|
799
|
|
-
|
800
|
965
|
asm_label(ptr, object, f);
|
801
|
|
- asm_header_word(ptr, object, f, "vector unsigned_byte 32");
|
|
966
|
+ asm_header_word(ptr, object, f, "vector unsigned_byte 4");
|
802
|
967
|
asm_lispobj(ptr + 1, ptr[1], f);
|
803
|
968
|
|
804
|
969
|
data = vector->data;
|
... |
... |
@@ -807,113 +972,186 @@ asm_vector_unsigned_byte_32(lispobj* ptr, lispobj object, FILE* f) |
807
|
972
|
for (k = 0; k < nwords - 2; ++k) {
|
808
|
973
|
fprintf(f, "\t.4byte\t0x%lx\n", data[k]);
|
809
|
974
|
}
|
|
975
|
+
|
|
976
|
+ asm_align(f);
|
810
|
977
|
|
811
|
978
|
return nwords;
|
812
|
979
|
}
|
813
|
980
|
|
814
|
981
|
int
|
815
|
|
-asm_bignum(lispobj* ptr, lispobj object, FILE* f)
|
|
982
|
+asm_vector_unsigned_byte_8(lispobj* ptr, lispobj object, FILE* f)
|
816
|
983
|
{
|
817
|
|
- int len = 1 + HeaderValue(object);
|
|
984
|
+ struct vector *vector;
|
|
985
|
+ int length, nwords;
|
|
986
|
+ unsigned long* data;
|
818
|
987
|
int k;
|
819
|
|
-
|
820
|
|
- len = CEILING(len, 2);
|
821
|
988
|
|
|
989
|
+ vector = (struct vector *) ptr;
|
|
990
|
+ length = fixnum_value(vector->length);
|
|
991
|
+#ifdef __x86_64
|
|
992
|
+ nwords = CEILING(NWORDS(length, 8) + 2, 2);
|
|
993
|
+#else
|
|
994
|
+ nwords = CEILING(NWORDS(length, 4) + 2, 2);
|
|
995
|
+#endif
|
822
|
996
|
asm_label(ptr, object, f);
|
823
|
|
- asm_header_word(ptr, object, f, "bignum");
|
|
997
|
+ asm_header_word(ptr, object, f, "vector unsigned_byte 8");
|
|
998
|
+ asm_lispobj(ptr + 1, ptr[1], f);
|
824
|
999
|
|
825
|
|
- for (k = 1; k < len; ++k) {
|
826
|
|
- fprintf(f, "\t.4byte\t0x%lx\t# %lu\n", ptr[k], ptr[k]);
|
827
|
|
- }
|
|
1000
|
+ data = vector->data;
|
828
|
1001
|
|
829
|
|
- return len;
|
|
1002
|
+ /* Minus 2 for the header and length words */
|
|
1003
|
+ for (k = 0; k < nwords - 2; ++k) {
|
|
1004
|
+ fprintf(f, "\t.4byte\t0x%lx\n", data[k]);
|
|
1005
|
+ }
|
|
1006
|
+
|
|
1007
|
+ return nwords;
|
830
|
1008
|
}
|
831
|
1009
|
|
832
|
1010
|
int
|
833
|
|
-asm_sap(lispobj* ptr, lispobj object, FILE* f)
|
|
1011
|
+asm_vector_unsigned_byte_16(lispobj* ptr, lispobj object, FILE* f)
|
834
|
1012
|
{
|
|
1013
|
+ struct vector *vector;
|
|
1014
|
+ int length, nwords;
|
|
1015
|
+ uint16_t* data;
|
|
1016
|
+ int k;
|
|
1017
|
+
|
|
1018
|
+ vector = (struct vector *) ptr;
|
|
1019
|
+ length = fixnum_value(vector->length);
|
|
1020
|
+#ifdef __x86_64
|
|
1021
|
+ nwords = CEILING(NWORDS(length, 4) + 2, 2);
|
|
1022
|
+#else
|
|
1023
|
+ nwords = CEILING(NWORDS(length, 2) + 2, 2);
|
|
1024
|
+#endif
|
835
|
1025
|
asm_label(ptr, object, f);
|
836
|
|
- asm_header_word(ptr, object, f, "sap");
|
837
|
|
- /* Just print out the raw value of the address */
|
838
|
|
- fprintf(f, "\t.4byte\t0x%lx\n", ptr[1]);
|
|
1026
|
+ asm_header_word(ptr, object, f, "vector unsigned_byte 16");
|
|
1027
|
+ asm_lispobj(ptr + 1, ptr[1], f);
|
|
1028
|
+
|
|
1029
|
+ data = (uint16_t*) vector->data;
|
839
|
1030
|
|
840
|
|
- return 2;
|
841
|
|
-}
|
|
1031
|
+ /* Minus 2 for the header and length words */
|
|
1032
|
+ for (k = 0; k < length; ++k) {
|
|
1033
|
+ fprintf(f, "\t.4byte\t0x%x\n", data[k]);
|
|
1034
|
+ }
|
|
1035
|
+
|
|
1036
|
+ asm_align(f);
|
842
|
1037
|
|
843
|
|
-#if 0
|
844
|
|
-int
|
845
|
|
-asm_catch_block(lispobj* ptr, lispobj object, FILE* f)
|
846
|
|
-{
|
847
|
|
- return asm_boxed(ptr, object, f);
|
|
1038
|
+ return nwords;
|
848
|
1039
|
}
|
849
|
1040
|
|
850
|
1041
|
int
|
851
|
|
-asm_catch_block(lispobj* ptr, lispobj object, FILE* f)
|
|
1042
|
+asm_vector_unsigned_byte_32(lispobj* ptr, lispobj object, FILE* f)
|
852
|
1043
|
{
|
853
|
|
- return asm_boxed(ptr, object, f);
|
854
|
|
-}
|
|
1044
|
+ struct vector *vector;
|
|
1045
|
+ int length, nwords;
|
|
1046
|
+ unsigned long* data;
|
|
1047
|
+ int k;
|
|
1048
|
+
|
|
1049
|
+ vector = (struct vector *) ptr;
|
|
1050
|
+ length = fixnum_value(vector->length);
|
|
1051
|
+#ifdef __x86_64
|
|
1052
|
+ nwords = CEILING(NWORDS(length, 2) + 2, 2);
|
|
1053
|
+#else
|
|
1054
|
+ nwords = CEILING(length + 2, 2);
|
|
1055
|
+#endif
|
855
|
1056
|
|
856
|
|
-int
|
857
|
|
-asm_closure(lispobj* ptr, lispobj object, FILE* f)
|
858
|
|
-{
|
859
|
|
- return asm_boxed(ptr, object, f);
|
860
|
|
-}
|
|
1057
|
+ asm_label(ptr, object, f);
|
|
1058
|
+ asm_header_word(ptr, object, f, "vector unsigned_byte 32");
|
|
1059
|
+ asm_lispobj(ptr + 1, ptr[1], f);
|
|
1060
|
+
|
|
1061
|
+ data = vector->data;
|
861
|
1062
|
|
862
|
|
-int
|
863
|
|
-asm_code(lispobj* ptr, lispobj object, FILE* f)
|
864
|
|
-{
|
865
|
|
- return asm_boxed(ptr, object, f);
|
|
1063
|
+ /* Minus 2 for the header and length words */
|
|
1064
|
+ for (k = 0; k < nwords - 2; ++k) {
|
|
1065
|
+ fprintf(f, "\t.4byte\t0x%lx\n", data[k]);
|
|
1066
|
+ }
|
|
1067
|
+
|
|
1068
|
+ return nwords;
|
866
|
1069
|
}
|
867
|
1070
|
|
868
|
1071
|
int
|
869
|
|
-asm_complex(lispobj* ptr, lispobj object, FILE* f)
|
|
1072
|
+asm_vector_double_float(lispobj* ptr, lispobj object, FILE* f)
|
870
|
1073
|
{
|
871
|
|
- return asm_boxed(ptr, object, f);
|
872
|
|
-}
|
|
1074
|
+ struct vector *vector;
|
|
1075
|
+ int length, nwords;
|
|
1076
|
+ const double* data;
|
|
1077
|
+ int k;
|
|
1078
|
+
|
|
1079
|
+ vector = (struct vector *) ptr;
|
|
1080
|
+ length = fixnum_value(vector->length);
|
|
1081
|
+#ifdef __x86_64
|
|
1082
|
+ nwords = CEILING(length + 2, 2);
|
|
1083
|
+#else
|
|
1084
|
+ nwords = length * 2 + 2; /* alignment guaranteed */
|
|
1085
|
+#endif
|
873
|
1086
|
|
874
|
|
-int
|
875
|
|
-asm_complex_double_double_float(lispobj* ptr, lispobj object, FILE* f)
|
876
|
|
-{
|
877
|
1087
|
asm_label(ptr, object, f);
|
878
|
|
- asm_lispobj(ptr, object, f);
|
|
1088
|
+ asm_header_word(ptr, object, f, "vector double-float");
|
879
|
1089
|
asm_lispobj(ptr + 1, ptr[1], f);
|
880
|
|
-
|
881
|
|
- double* d = (double*) (ptr + 2);
|
882
|
1090
|
|
883
|
|
- for (k = 0; k < 4; ++k) {
|
884
|
|
- fprintf(f, "\t.double\t%.15lg\n", d[k]);
|
|
1091
|
+ data = (const double*) vector->data;
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+ for (k = 0; k < length; ++k) {
|
|
1095
|
+ print_double(f, data[k]);
|
885
|
1096
|
}
|
886
|
1097
|
|
887
|
|
- return HeaderValue(object);
|
|
1098
|
+ return nwords;
|
888
|
1099
|
}
|
889
|
1100
|
|
890
|
1101
|
int
|
891
|
|
-asm_complex_double_float(lispobj* ptr, lispobj object, FILE* f)
|
|
1102
|
+asm_vector_double_double_float(lispobj* ptr, lispobj object, FILE* f)
|
892
|
1103
|
{
|
|
1104
|
+ struct vector *vector;
|
|
1105
|
+ int length, nwords;
|
|
1106
|
+ const double* data;
|
|
1107
|
+ int k;
|
|
1108
|
+
|
|
1109
|
+ vector = (struct vector *) ptr;
|
|
1110
|
+ length = fixnum_value(vector->length);
|
|
1111
|
+ nwords = CEILING(length * 4 + 2, 2);
|
|
1112
|
+
|
893
|
1113
|
asm_label(ptr, object, f);
|
894
|
|
- asm_lispobj(ptr, object, f);
|
|
1114
|
+ asm_header_word(ptr, object, f, "vector double-float");
|
895
|
1115
|
asm_lispobj(ptr + 1, ptr[1], f);
|
|
1116
|
+
|
|
1117
|
+ data = (const double*) vector->data;
|
896
|
1118
|
|
897
|
|
- double* d = ptr + 2;
|
898
|
|
- fprintf(f, "\t.double\t%.15lg, %.15lg\n", d[0], d[1]);
|
|
1119
|
+ for (k = 0; k < 2*length; ++k) {
|
|
1120
|
+ print_double(f, data[k]);
|
|
1121
|
+ }
|
899
|
1122
|
|
900
|
|
- return HeaderValue(object);
|
|
1123
|
+ return nwords;
|
901
|
1124
|
}
|
902
|
1125
|
|
903
|
1126
|
int
|
904
|
|
-asm_complex_double_float(lispobj* ptr, lispobj object, FILE* f)
|
|
1127
|
+asm_bignum(lispobj* ptr, lispobj object, FILE* f)
|
905
|
1128
|
{
|
906
|
|
- asm_label(ptr, object, f);
|
907
|
|
- asm_lispobj(ptr, object, f);
|
|
1129
|
+ int len = 1 + HeaderValue(object);
|
|
1130
|
+ int k;
|
908
|
1131
|
|
909
|
|
- double* d = ptr + 2;
|
910
|
|
- fprintf(f, "\t.double\t%.15lg, %.15lg\n", d[0], d[1]);
|
|
1132
|
+ len = CEILING(len, 2);
|
|
1133
|
+
|
|
1134
|
+ asm_label(ptr, object, f);
|
|
1135
|
+ asm_header_word(ptr, object, f, "bignum");
|
|
1136
|
+
|
|
1137
|
+ for (k = 1; k < len; ++k) {
|
|
1138
|
+ fprintf(f, "\t.4byte\t0x%lx\t# %lu\n", ptr[k], ptr[k]);
|
|
1139
|
+ }
|
911
|
1140
|
|
912
|
|
- return HeaderValue(object);
|
|
1141
|
+ return len;
|
913
|
1142
|
}
|
914
|
1143
|
|
915
|
|
-#endif
|
|
1144
|
+int
|
|
1145
|
+asm_sap(lispobj* ptr, lispobj object, FILE* f)
|
|
1146
|
+{
|
|
1147
|
+ asm_label(ptr, object, f);
|
|
1148
|
+ asm_header_word(ptr, object, f, "sap");
|
|
1149
|
+ /* Just print out the raw value of the address */
|
|
1150
|
+ fprintf(f, "\t.4byte\t0x%lx\n", ptr[1]);
|
916
|
1151
|
|
|
1152
|
+ return 2;
|
|
1153
|
+}
|
|
1154
|
+
|
917
|
1155
|
void
|
918
|
1156
|
init_asmtab(void)
|
919
|
1157
|
{
|
... |
... |
@@ -941,11 +1179,19 @@ init_asmtab(void) |
941
|
1179
|
asmtab[type_DoubleDoubleFloat] = asm_double_double_float;
|
942
|
1180
|
asmtab[type_Complex] = asm_boxed;
|
943
|
1181
|
asmtab[type_ComplexSingleFloat] = asm_complex_single_float;
|
|
1182
|
+ asmtab[type_ComplexDoubleFloat] = asm_complex_double_float;
|
|
1183
|
+ asmtab[type_ComplexDoubleDoubleFloat] = asm_complex_double_double_float;
|
944
|
1184
|
asmtab[type_SimpleArray] = asm_boxed;
|
945
|
1185
|
asmtab[type_SimpleString] = asm_simple_string;
|
|
1186
|
+ asmtab[type_SimpleBitVector] = asm_vector_bit;
|
946
|
1187
|
asmtab[type_SimpleVector] = asm_simple_vector;
|
|
1188
|
+ asmtab[type_SimpleArrayUnsignedByte2] = asm_vector_unsigned_byte_2;
|
|
1189
|
+ asmtab[type_SimpleArrayUnsignedByte4] = asm_vector_unsigned_byte_4;
|
947
|
1190
|
asmtab[type_SimpleArrayUnsignedByte8] = asm_vector_unsigned_byte_8;
|
|
1191
|
+ asmtab[type_SimpleArrayUnsignedByte16] = asm_vector_unsigned_byte_16;
|
948
|
1192
|
asmtab[type_SimpleArrayUnsignedByte32] = asm_vector_unsigned_byte_32;
|
|
1193
|
+ asmtab[type_SimpleArrayDoubleFloat] = asm_vector_double_float;
|
|
1194
|
+ asmtab[type_SimpleArrayDoubleDoubleFloat] = asm_vector_double_double_float;
|
949
|
1195
|
asmtab[type_ComplexString] = asm_boxed;
|
950
|
1196
|
asmtab[type_ComplexVector] = asm_boxed;
|
951
|
1197
|
asmtab[type_CodeHeader] = asm_code_header;
|
... |
... |
@@ -953,7 +1199,7 @@ init_asmtab(void) |
953
|
1199
|
asmtab[type_FuncallableInstanceHeader] = asm_closure_header;
|
954
|
1200
|
/* Just use asm_boxed or have a special version for a value cell? */
|
955
|
1201
|
asmtab[type_ValueCellHeader] = asm_boxed;
|
956
|
|
- asmtab[type_SymbolHeader] = asm_boxed;
|
|
1202
|
+ asmtab[type_SymbolHeader] = asm_symbol_header;
|
957
|
1203
|
asmtab[type_BaseChar] = asm_immediate;
|
958
|
1204
|
asmtab[type_Sap] = asm_sap;
|
959
|
1205
|
asmtab[type_InstanceHeader] = asm_boxed;
|
... |
... |
@@ -966,6 +1212,9 @@ write_asm_object(const char *dir, int id, os_vm_address_t start, os_vm_address_t |
966
|
1212
|
char asm_file[PATH_MAX];
|
967
|
1213
|
FILE* f;
|
968
|
1214
|
|
|
1215
|
+ printf("write_asm_object space %d start %p end %p\n",
|
|
1216
|
+ id, start, end);
|
|
1217
|
+
|
969
|
1218
|
snprintf(asm_file, PATH_MAX, "%s/space-%d.s", dir, id);
|
970
|
1219
|
f = fopen(asm_file, "w");
|
971
|
1220
|
|