Skip to content

Commit 1aa00e8

Browse files
committed
32-bit arm alignment crash wip
1 parent 2c41cba commit 1aa00e8

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

jsrc/va1ss.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616
#define SSINGENC(type) ((type)>>INTX)
1717
#define SSINGCASE(id,subtype) (3*(id)+(subtype)) // encode case/args into one branch value
1818

19-
#if !(defined(__aarch32__)||defined(__arm__)||defined(_M_ARM))
20-
#undef NOOPTIMIZE
21-
#define NOOPTIMIZE
22-
#endif
23-
A NOOPTIMIZE jtssingleton1(J jt, A w,I caseno){A z;void *zv;
19+
A jtssingleton1(J jt, A w,I caseno){A z;void *zv;
2420
F2PREFIP;
2521
I ar=AR(w);
2622
// Calculate inplaceability
@@ -30,7 +26,13 @@ A NOOPTIMIZE jtssingleton1(J jt, A w,I caseno){A z;void *zv;
3026
if(wipok){ z=w; zv=voidAV(w); } else if(likely(ar==0)){GAT0(z,FL,1,0); zv=voidAV0(z);} else{GATV1(z,FL,1,ar); zv=voidAVn(z,ar);}
3127

3228
// Start loading everything we will need as values before the pipeline break. Tempting to convert int-to-float as well, but perhaps it will predict right?
33-
I wiv=IAV(w)[0],ziv; D wdv=DAV(w)[0],zdv;
29+
I wiv=IAV(w)[0],ziv;
30+
#if defined(__aarch32__)||defined(__arm__)||defined(_M_ARM)
31+
volatile D wdv=DAV(w)[0]; // avoid bus error
32+
#else
33+
D wdv=DAV(w)[0];
34+
#endif
35+
D zdv;
3436
// Huge switch statement to handle every case.
3537
switch(caseno){
3638

jsrc/va2ss.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,8 @@ static NOINLINE I intforD(J jt, D d){D q;I z; // noinline because it uses so ma
3737

3838
#define SSINGCASE(id,subtype) (9*(id)+(subtype)) // encode case/args into one branch value
3939

40-
#if !(defined(__aarch32__)||defined(__arm__)||defined(_M_ARM))
41-
#undef NOOPTIMIZE
42-
#define NOOPTIMIZE
43-
#endif
4440
// do singleton operation. ipcaserank bits 0-15=rank of result, 16-23=self->lc code for the operation (with comparisons flagged), 24-25=inplace bits, 26-29 types code
45-
A NOOPTIMIZE jtssingleton(J jt, A a,A w,I ipcaserank){A z;I aiv;void *zv;
41+
A jtssingleton(J jt, A a,A w,I ipcaserank){A z;I aiv;void *zv;
4642
z=0; I ac=AC(a); I wc=AC(w);
4743
// see if we can inplace an assignment. That is always a good idea, though rare
4844
if(unlikely(((B)(a==jt->asginfo.zombieval)&((B)(ipcaserank>>(24+JTINPLACEAX)))&(B)1)+((B)(w==jt->asginfo.zombieval)&((B)(ipcaserank>>(24+JTINPLACEWX)))&(B)1))){
@@ -64,7 +60,13 @@ getzv:; // here when we are operating inplace on z
6460
nozv:; // here when we have zv or don't need it
6561
// z is 0 ONLY for comparisons with no rank.
6662
// Start loading everything we will need as values before the pipeline break. Tempting to convert int-to-float as well, but perhaps it will predict right?
67-
aiv=IAV(a)[0]; I wiv=IAV(w)[0],ziv; D adv=DAV(a)[0],wdv=DAV(w)[0],zdv;
63+
aiv=IAV(a)[0]; I wiv=IAV(w)[0],ziv;
64+
#if defined(__aarch32__)||defined(__arm__)||defined(_M_ARM)
65+
volatile D adv=DAV(a)[0],wdv=DAV(w)[0]; // avoid bus error
66+
#else
67+
D adv=DAV(a)[0],wdv=DAV(w)[0];
68+
#endif
69+
D zdv;
6870
// fetch args before the case breaks the pipe
6971
// Huge switch statement to handle every case. Lump all the booleans together at 0
7072
I caseno=((ipcaserank>>RANKTX)&0x7f)-VA2CBW1111; caseno=caseno<0?0:caseno;

0 commit comments

Comments
 (0)