Skip to content

Commit 7ad5f02

Browse files
authored
Merge pull request #185 from juntuu/removal
Remove few macros
2 parents ea5a9a8 + 00f3444 commit 7ad5f02

File tree

14 files changed

+24
-30
lines changed

14 files changed

+24
-30
lines changed

jsrc/adverbs/ar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ jtredg(J jt, A w, A self) {
278278
// if w happens to be the same virtual block that we passed in as x, we have to clone it before we change the
279279
// pointer
280280
if (a == wfaux) {
281-
RZ(wfaux = virtual(wfaux, 0, AR(a)));
281+
RZ(wfaux = jtvirtual(jt, wfaux, 0, AR(a)));
282282
AN(wfaux) = AN(a);
283283
MCISH(AS(wfaux), AS(a), AR(a));
284284
}
@@ -884,7 +884,7 @@ jtredcatcell(J jt, A w, I r) {
884884
z = w;
885885
AR(z) = (RANKT)(r + 1); // inplace it, install new rank
886886
} else {
887-
RZ(z = virtual(w, 0, r + 1));
887+
RZ(z = jtvirtual(jt, w, 0, r + 1));
888888
AN(z) = AN(w); // create virtual block
889889
}
890890
I m;

jsrc/adverbs/as.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ jtssg(J jt, A w, A self) {
356356
// if result happens to be the same virtual block that we passed in, we have to clone it before we change the
357357
// pointer
358358
else if (a == z) {
359-
RZ(z = virtual(z, 0, AR(a)));
359+
RZ(z = jtvirtual(jt, z, 0, AR(a)));
360360
AN(z) = AN(a);
361361
MCISH(AS(z), AS(a), r - 1);
362362
}

jsrc/conjunctions/cr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,13 +750,13 @@ jtrank2ex0(J jt, AD *RESTRICT a, AD *RESTRICT w, A fs, AF f2) {
750750
if (!AN(a)) {
751751
RZ(virta = jtfiller(jt, a));
752752
} else {
753-
virta = virtual(a, 0, 0);
753+
virta = jtvirtual(jt, a, 0, 0);
754754
AN(virta) = 1;
755755
} // if there are cells, use first atom; else fill atom
756756
if (!AN(w)) {
757757
RZ(virtw = jtfiller(jt, w));
758758
} else {
759-
virtw = virtual(w, 0, 0);
759+
virtw = jtvirtual(jt, w, 0, 0);
760760
AN(virtw) = 1;
761761
}
762762
WITHDEBUGOFF(z = CALL2(f2, virta, virtw, fs);) // normal execution on fill-cell

jsrc/j.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,19 +629,19 @@
629629
// Install new value z into xv[k], where xv is AAV(x). If x has recursive usecount, we must increment the usecount of
630630
// z. This also guarantees that z has recursive usecount whenever x does, and that z is realized
631631
#define INSTALLBOX(x, xv, k, z) \
632-
rifv(z); \
632+
realizeifvirtual(z); \
633633
if ((UCISRECUR(x)) != 0) { \
634634
A zzZ = xv[k]; \
635635
ra(z); \
636636
fa(zzZ); \
637637
} \
638638
xv[k] = z
639639
#define INSTALLBOXNF(x, xv, k, z) \
640-
rifv(z); \
640+
realizeifvirtual(z); \
641641
if ((UCISRECUR(x)) != 0) { ra(z); } \
642642
xv[k] = z // Don't do the free - if we are installing into known 0 or known nonrecursive
643643
#define INSTALLBOXRECUR(xv, k, z) \
644-
rifv(z); \
644+
realizeifvirtual(z); \
645645
{ \
646646
I zzK = (k); \
647647
{ \

jsrc/ja.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
z = (A)(v); \
181181
AC(z) = (c); \
182182
} else { \
183-
RZ(z = virtual((w), 0, (r))); \
183+
RZ(z = jtvirtual(jt, (w), 0, (r))); \
184184
AFLAG(z) |= AFUNINCORPABLE; \
185185
if ((c) != ACUC1) AC(z) = (c); \
186186
} \
@@ -320,7 +320,6 @@
320320
#define minusA(x, y) jtatomic2((J)((I)jt | JTINPLACEA), (x), (y), ds(CMINUS))
321321
#define mmharvest(x0, x1, x2, x3, x4, x5, x6) jtmmharvest(jt, (x0), (x1), (x2), (x3), (x4), (x5), (x6))
322322
#define mmprep(x0, x1, x2, x3, x4, x5) jtmmprep(jt, (x0), (x1), (x2), (x3), (x4), (x5))
323-
#define move(x, y, z) jtmove(jt, (x), (y), (z))
324323
#define movandor(x0, x1, x2, x3) jtmovandor(jt, (x0), (x1), (x2), (x3))
325324
#define movbwneeq(x0, x1, x2, x3) jtmovbwneeq(jt, (x0), (x1), (x2), (x3))
326325
#define movfslash(x, y, z) jtmovfslash(jt, (x), (y), (z))
@@ -434,7 +433,6 @@
434433
{ \
435434
if ((AFLAG(x) & AFVIRTUAL) != 0) RZ((x) = jtrealize(jt, x)); \
436435
}
437-
#define rifv(x) realizeifvirtual(x)
438436
// We have used rifvs liberally through the code to guarantee that all functions can deal with virtual blocks returned.
439437
// In some cases, the call is to an internal routine that we know will not return a virtual block normally, and is in an
440438
// important performance path. We use rifvsdebug for these places. rifvs is called only during debugging. Review them
@@ -520,7 +518,7 @@
520518
// usecount We can have an inplaceable but recursible block, if it was gc'd. We never push a PERMANENT block, so that
521519
// we won't try to free it NOTE that PERMANENT blocks are always marked traversible if they are of traversible type, so
522520
// we will not recur on them internally
523-
#define tpushcommon(x, suffix) \
521+
#define tpush(x) \
524522
{ \
525523
if (!ACISPERM(AC(x))) { \
526524
I tt = AT(x); \
@@ -529,10 +527,8 @@
529527
if (!((I)pushp & (NTSTACKBLOCK - 1))) { RZ(pushp = jttg(jt, pushp)); } \
530528
if (((tt ^ AFLAG(x)) & TRAVERSIBLE) != 0) RZ(pushp = jttpush(jt, (x), tt, pushp)); \
531529
jt->tnextpushp = pushp; \
532-
suffix \
533530
} \
534531
}
535-
#define tpush(x) tpushcommon(x, )
536532
// Internal version, used when the local name pushp is known to hold jt->tnextpushp
537533
#define tpushi(x) \
538534
{ \
@@ -591,8 +587,6 @@
591587
jtvaspeqprep(jt, (x0), (x1), (x2), (x3), (x4), (x5), (x6), (x7), (x8), (x9), (x10), (x11))
592588
#define vec(x, y, z) jtvec(jt, (x), (y), (z))
593589
#define vecb01(x, y, z) jtvecb01(jt, (x), (y), (z))
594-
#define virtual(x, y, z) jtvirtual(jt, (x), (y), (z))
595-
#define virtualip(x, y, z) jtvirtual(jtinplace, (x), (y), (z))
596590
#define wa(x, y, z) jtwa(jt, (x), (y), (z))
597591
#define widthdp(x, y, z) jtwidthdp(jt, (x), (y), (z))
598592
#define words(x) jtwords(jt, (x), ds(CWORDS))

jsrc/m.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ jtcar(J jt, A w) {
13071307
A
13081308
jtclonevirtual(J jt, A w) {
13091309
A z;
1310-
RZ(z = virtual(w, 0, AR(w))); // allocate a new virtual block
1310+
RZ(z = jtvirtual(jt, w, 0, AR(w))); // allocate a new virtual block
13111311
AN(z) = AN(w);
13121312
MCISH(AS(z), AS(w), (I)AR(w)); // copy AN and shape; leave AC alone
13131313
return z;

jsrc/verbs/dyadic/take_drop.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ jttake(J jt, A a, A w) {
266266
PROD(wcellsize, wr - 1, ws + 1); // size of a cell in atoms of w
267267
I offset = woffset * wcellsize; // offset in atoms of the virtual data
268268
// allocate virtual block, passing in the in-place status from w
269-
RZ(s = virtualip(w, offset, wr)); // allocate block
269+
RZ(s = jtvirtual(jtinplace, w, offset, wr)); // allocate block
270270
// fill in shape. Note that s and w may be the same block, so ws is destroyed
271271
I* RESTRICT ss = AS(s);
272272
ss[0] = tkabs;
@@ -343,7 +343,7 @@ jtdrop(J jt, A a, A w) {
343343
PROD(wcellsize, wr - 1, ws + 1); // size of a cell in atoms of w
344344
I offset = woffset * wcellsize; // offset in bytes of the virtual data
345345
// allocate virtual block. May use inplace w
346-
RZ(s = virtualip(w, offset, wr)); // allocate block
346+
RZ(s = jtvirtual(jtinplace, w, offset, wr)); // allocate block
347347
// fill in shape. s and w may be the same block, so ws is destroyed
348348
I* RESTRICT ss = AS(s);
349349
ss[0] = remlen;
@@ -413,7 +413,7 @@ jthead(J jt, A w) {
413413
wcr--;
414414
wcr = (wcr < 0) ? wr : wcr; // wn=#atoms of w, wcr=rank of cell being created
415415
A z;
416-
RZ(z = virtualip(w, 0, wcr)); // allocate the cell. Now fill in shape & #atoms
416+
RZ(z = jtvirtual(jtinplace, w, 0, wcr)); // allocate the cell. Now fill in shape & #atoms
417417
// if w is empty we have to worry about overflow when calculating #atoms
418418
I zn;
419419
PROD(zn, wcr, AS(w) + 1)

jsrc/verbs/v.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jtravel(J jt, A w) {
5757
// Not self-virtual. Create a (noninplace) virtual copy, but not if NJA memory NJAwhy
5858
// If rank 0 were the only thing stopping us from inplacing, we could inherit pristinity
5959
if (!(AFLAG(w) & (AFNJA))) {
60-
RZ(z = virtual(w, 0, 1 + f));
60+
RZ(z = jtvirtual(jt, w, 0, 1 + f));
6161
AN(z) = AN(w);
6262
MCISH(AS(z), AS(w), f) AS(z)[f] = m;
6363
return z;

jsrc/verbs/vcat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ jtapip(J jt, A a, A w) {
738738
// virtual extension. Allocate a virtual block, which will extend past the original block.
739739
// Fill in AN and AS for the block
740740
A oa = a;
741-
RZ(a = virtual(a, 0, ar));
741+
RZ(a = jtvirtual(jt, a, 0, ar));
742742
AN(a) = AN(oa) + wn;
743743
AS(a)[0] = AS(oa)[0] + wm;
744744
MCISH(&AS(a)[1], &AS(oa)[1], AR(oa) - 1);

jsrc/verbs/vf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ jtreshape(J jt, A a, A w) {
556556
// correct if(!(AFLAG(w)&(AFNJA))){RZ(z=virtual(w,0,r+wf)); AN(z)=m; I *zs=AS(z); DO(wf, *zs++=ws[i];);
557557
// DO(r, zs[i]=u[i];) return z;}
558558
if ((SGNIF(AFLAG(w), AFNJAX) | ((t & (DIRECT | RECURSIBLE)) - 1)) >= 0) {
559-
RZ(z = virtual(w, 0, r + wf));
559+
RZ(z = jtvirtual(jt, w, 0, r + wf));
560560
AN(z) = m;
561561
I *RESTRICT zs = AS(z);
562562
MCISH(zs, ws, wf) MCISH(zs + wf, u, r) return z;

0 commit comments

Comments
 (0)