History

cons flags: fix wrong alignment on 64-bit platforms

Sigrid Solveig Haflínudóttir committed 3 months ago

Commit fb512ba1 parent 13e6bd84 files · +14 −11Browse files

Unified · Split

4 files
  1. boot/sl.boot +7 −7
  2. src/print.c +2 −2
  3. src/sl.c +2 −2
  4. src/slpriv.h +3 −0
boot/sl.boot+7−7
@@ -706,8 +706,8 @@ caaaar #fn("A180<<<<:" 5) caaadr · 705 unmodified lines
706706 #fn("A180T<:" 5) caar #fn("A180<<:" 5) cadaar
707707 #fn("A180<<T:" 5) cadadr #fn("A180TT:" 5) cadar
708708 #fn("A180<T:" 5) caddar #fn("A180<=T:" 5) cadddr
709−#fn("A180==T:" 5) caddr #7=#fn("A180=T:" 5) call-with-values
710−#fn("A2805086B3B09086<C:08186=z2:818661:" #4=#() #(#6=(*values*)) 7) capture-var! #fn("A2DIb6862086>1_480F3G86<8187E5388;JI0421875180F3228781e152p4:" #(#fn("A381J50D9:8081<C5082:90<8081=82KM63:" index-of 9)
709+#fn("A180==T:" 5) caddr #6=#fn("A180=T:" 5) call-with-values
710+#fn("A2805086B3B09086<C:08186=z2:818661:" #() #(#5=(*values*)) 7) capture-var! #fn("A2DIb6862086>1_480F3G86<8187E5388;JI0421875180F3228781e152p4:" #(#fn("A381J50D9:8081<C5082:90<8081=82KM63:" index-of 9)
711711 #fn(length) #fn(nconc)) 13)
712712 cdaaar #fn("A180<<<=:" 5) cdaadr
713713 #fn("A180T<=:" 5) cdaar #fn("A180<<=:" 5) cdadar
@@ -732,7 +732,7 @@ compile-begin #fn("A483H3?070808182DI64:83=H3@07080818283<64:708081D983<54471802 · 18 unmodified lines
732732 emit pop compile-begin) 9)
733733 compile-builtin-call #fn("A7DI20868580>3?;4217285D9538<3I07383=8<52J=074858<52@40D94858=25CP086El23=0768027F963:7680858663:8=28C708;60:8=29C708;60:8=2:C`086El23;076802;62:86F2l23;076802<62:7680858663:8=2=Cp086El23:07485K62:86Kl23;076802>62:86F2l23;076802?62:7680858663:8=2@CN086El23;076802A62:7680858663:8=2BCM086El23:07485K62:7680858663:8=2CCP086El23=076802D2E63:7680858663:8=2FCY086F2L23;07485F262:7680823702G@402F8663:8=2HCd086F2l23;076802I62:F286L23@076808586F3n63:7485F262:76808562:" #(#fn("A090El23:07091K62:7192919063:" #(argc-error
734734 emit) num-compare 8) #fn(get) arg-counts length= argc-error list emit loade8 < = + load0 add2 -
735−neg sub2 * load1 / vec loadv #4# apply tapply aref aref2) 12)
735+neg sub2 * load1 / vec loadv #() apply tapply aref aref2) 12)
736736 compile-error #fn("r0702180Pz2:" #(error "compile: ") 7) compile-f
737737 #fn("A270218081>22262:" #(call-with-values #fn("A070909162:" #(compile-f-) 7)
738738 #fn("A280:" 4)) 7)
@@ -938,7 +938,7 @@ top-level-value *print-pretty* *print-readably* *print-circle* that #fn("A090I04 · 199 unmodified lines
938938 *print-readably* *print-circle* that) 4) #fn("A0209091524219161:" #(#fn(write)
939939 #fn(io-close)) 7)
940940 #fn("A190504208061:" #(#fn(raise)) 6)) 15)
941−map-int #fn("A2E81L2;3u0480E51D9P8620K81DI898:L23S048987808;51D9PN487=?7^1489KM?9@\b/^251486:" #(#5=#fn("r0DI:" void 4)) 13)
941+map-int #fn("A2E81L2;3u0480E51D9P8620K81DI898:L23S048987808;51D9PN487=?7^1489KM?9@\b/^251486:" #(#4=#fn("r0DI:" void 4)) 13)
942942 max #fn("r1813=07021808163:80:" #(foldl #fn("A28081L235081:80:" 6)) 8) member
943943 #fn("A281<80d35081:813<0708081=62:D9:" #(member) 7) memv #fn("A281<80c35081:813<0708081=62:D9:" #(memv) 7)
944944 min #fn("r1813=07021808163:80:" #(foldl #fn("A28081L235080:81:" 6)) 8) mod
@@ -1078,7 +1078,7 @@ str-trim #fn("w10003000W1000J7070?14W2000J7081?24DIDIb7b88721818087>3_4882282808 · 133 unmodified lines
10781078 subseq #fn("w20003000W2000J70D9?24DIDIb770818252370D9@>071228123825448724828187>3_425808281>3?8480B3<087<808162:80]390887661:2780513=02880818263:7980513D02:8051T882;89>161:D9:" #(<=
10791079 arg-error "start <= end: " " <= " #fn("A281El23g090;38049091n7080865287863H0718786523=072809052@40D94:80B3A092<80=73815162:72809162:" #(copy-list
10801080 length< bounds-error 1-) subseq-l 10) #fn("A120905191;J504858586L23=071908652@;0808692n51229286DI898:L23N0489878;92n908;Gp^1489KM?9@\r/^251487:" #(#fn(length)
1081−bounds-error #5#) subseq-av 15) vec-alloc #fn(str?)
1081+bounds-error #4#) subseq-av 15) vec-alloc #fn(str?)
10821082 #fn(str-sub) arr? #fn(type-of) #fn("A1209080E63:" #(#fn(arr-alloc)) 8)) 11)
10831083 t0_auto42# #:t0_auto42# t0_auto54# #:t0_auto54# table->assoc-list
10841084 #fn("A12021D98063:" #(#fn(table-fold) #fn("A38081P82P:" 6)) 8) table-invert #fn("A12050212285>1D98053485:" #(#fn(table)
@@ -1102,13 +1102,13 @@ type-error #fn("r22021228081825461:" #(#fn(raise) · 17 unmodified lines
11021102 untrace #fn("A12080517172513D02380247251F3G52@40D9^14DI:" #(#fn(top-level-value)
11031103 traced? fn #fn(set-top-level-value!)
11041104 #fn(fn-vals)) 9)
1105−values #fn("r080B3<080=J6080<:9080P:" #4# #(#6#) 6) vars-to-env
1105+values #fn("r080B3<080=J6080<:9080P:" #() #(#5#) 6) vars-to-env
11061106 #fn("A320218182>280722380515163:" #(#fn(map)
11071107 #fn("A2708021809052SS8191M63:" #(vinfo #fn(memq)) 9)
11081108 iota #fn(length)) 10)
11091109 vec->list #fn("A17080z2:" #(list) 6) vinfo
11101110 #fn("A3808182e3:" 7) vinfo:heap? #.cadr vinfo:index
1111−#7# vinfo:sym #.car void
1111+#6# vinfo:sym #.car void
11121112 #3# void? #fn("A180DIQ:" 6) zero?
11131113 #fn("A180El2:" 6) zip #fn("r0707180z3:" #(map list) 7) zip-with
11141114 #fn("r1708081z3:" #(map) 7))
src/print.c+2−2
@@ -13,7 +13,7 @@ enum { · 12 unmodified lines
1313
1414 #define LOG2_10 3.321928094887362347870319429489
1515
16−#define cons_index(c) (ptr(sl_cons, c)-(sl_cons*)slvm.fromspace)
16+#define cons_index(c) (ptr(sl_aligned, c)-(sl_aligned*)slvm.fromspace)
1717 #define ismarked(c) bitvector_get(sl.consflags, cons_index(c))
1818 #define mark_cons(c) bitvector_set(sl.consflags, cons_index(c))
1919 #define unmark_cons(c) bitvector_reset(sl.consflags, cons_index(c))
@@ -1094,7 +1094,7 @@ sl_print(sl_v v) · 1074 unmodified lines
10941094 if(iscons(v) || isvec(v) || isfn(v) || (iscvalue(v) && !isstr(v))){
10951095 htable_reset(&sl.pr.conses, HT_N_INLINE);
10961096 if(sl.pr.circle)
1097− memset(sl.consflags, 0, sizeof(u32int)*bitvector_nwords(slvm.heapsize/sizeof(sl_cons)));
1097+ memset(sl.consflags, 0, sizeof(u32int)*bitvector_nwords(slvm.heapsize/sizeof(sl_aligned)));
10981098 }
10991099 }
11001100
src/sl.c+2−2
@@ -614,7 +614,7 @@ sl_gc(bool mustgrow) · 613 unmodified lines
614614 cthrow(raise(sl_erroom), mustgrow);
615615 }
616616 if(slvm.grew){
617− u64int sz = slvm.heapsize/sizeof(sl_cons);
617+ u64int sz = slvm.heapsize/sizeof(sl_aligned);
618618 if(sl_unlikely(sz < 1))
619619 sz = 1;
620620 temp = bitvector_resize(sl.consflags, sz, sz*2);
@@ -1401,7 +1401,7 @@ failed: · 780 unmodified lines
14011401 if((slvm.gchandles = MEM_ALLOC(slvm.maxgchandles * sizeof(sl_v*))) == nil)
14021402 goto failed;
14031403
1404− if((sl.consflags = bitvector_new(slvm.heapsize/sizeof(sl_cons))) == nil)
1404+ if((sl.consflags = bitvector_new(slvm.heapsize/sizeof(sl_aligned))) == nil)
14051405 goto failed;
14061406 if((htable_new(&sl.pr.conses, HT_N_INLINE)) == nil)
14071407 goto failed;
src/slpriv.h+3−0
@@ -5,6 +5,9 @@ · 4 unmodified lines
55 #include "htable_h.h"
66 HTPROT(ptrhash)
77
8+// all allocations on the heap are 8-byte aligned
9+typedef u64int sl_aligned;
10+
811 #if defined(BITS64)
912 #define FIXNUM_BITS (64-TAG_BITS)
1013 #define UNBOXED_BITS (64-TAG_EXT_BITS)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t