From 3107e638f88f3bfcce3b382759295ecd9d87efe5 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 22 Nov 1989 13:38:37 +0000 Subject: [PATCH] some more speed-up changes --- util/int/ChangeLog | 3 + util/int/data.c | 90 ++++++++++++++++- util/int/do_array.c | 6 +- util/int/do_comp.c | 8 +- util/int/do_conv.c | 36 +++---- util/int/do_fpar.c | 14 +-- util/int/do_incdec.c | 60 +++++------ util/int/do_intar.c | 26 ++--- util/int/do_load.c | 42 ++++---- util/int/do_logic.c | 20 ++-- util/int/do_misc.c | 40 ++++---- util/int/do_ptrar.c | 4 +- util/int/do_sets.c | 8 +- util/int/do_store.c | 38 +++---- util/int/do_unsar.c | 22 ++-- util/int/dump.c | 2 +- util/int/mem.h | 17 +++- util/int/moncalls.c | 2 +- util/int/read.c | 6 +- util/int/rsb.c | 6 +- util/int/stack.c | 233 +++++++++++++++++++++++++++++++++++++------ 21 files changed, 475 insertions(+), 208 deletions(-) diff --git a/util/int/ChangeLog b/util/int/ChangeLog index 759ded400..be39ed3ef 100644 --- a/util/int/ChangeLog +++ b/util/int/ChangeLog @@ -1,3 +1,6 @@ +22-Nov-89 Ceriel Jacobs (ceriel) at ceriel + Some more speed-up changes, resulting in another 5%. + 13-Nov-89 Ceriel Jacobs (ceriel) at ceriel Many changes for speed-up (resulting speed-up: 20-25%). Also fixed serious problem in floating point handling: the existing diff --git a/util/int/data.c b/util/int/data.c index 9b3e1fa89..77a090539 100644 --- a/util/int/data.c +++ b/util/int/data.c @@ -94,6 +94,7 @@ newHP(ap) * * * dt_stdp(addr, p) - STore Data Pointer. * * dt_stn(addr, l, n) - STore N byte integer. * + * dt_stw(addr, l) - STore wsize byte integer. * * dt_stf(addr, f, n) - STore n byte Floating point number. * * * ************************************************************************/ @@ -159,6 +160,30 @@ dt_stn(addr, al, n) } } +dt_stw(addr, al) + register ptr addr; + long al; +{ + register int i; + register long l = al; +#ifdef LOGGING + /* a psize zero is ambiguous */ + int sh_flags = (l == 0 && wsize == psize) ? (SH_INT|SH_DATAP) : SH_INT; +#endif LOGGING + + LOG(("@g6 dt_stw(%lu, %lu)", addr, l)); + ch_in_data(addr, wsize); + ch_wordaligned(addr); + for (i = (int) wsize; i > 0; i--, addr++) { + ch_dt_prot(addr); + data_loc(addr) = (char) l; +#ifdef LOGGING + dt_sh(addr) = sh_flags; +#endif LOGGING + l = l>>8; + } +} + #ifndef NOFLOAT dt_stf(addr, f, n) register ptr addr; @@ -191,7 +216,9 @@ dt_stf(addr, f, n) * dt_lddp(addr) - LoaD Data Pointer from data. * * dt_ldip(addr) - LoaD Instruction Pointer from data. * * dt_ldu(addr, n) - LoaD n Unsigned bytes from data. * + * dt_lduw(addr) - LoaD wsize Unsigned bytes from data. * * dt_lds(addr, n) - LoaD n Signed bytes from data. * + * dt_ldsw(addr) - LoaD wsize Signed bytes from data. * * * ************************************************************************/ @@ -255,13 +282,39 @@ unsigned long dt_ldu(addr, n) } #endif LOGGING - for (i = (int) n-1; i >= 0; i--) { - u = (u<<8) | btou(data_loc(addr + i)); + addr += n-1; + for (i = (int) n-1; i >= 0; i--, addr--) { + u = (u<<8) | btou(data_loc(addr)); } LOG(("@g6 dt_ldu() returns %lu", u)); return (u); } +unsigned long dt_lduw(addr) + register ptr addr; +{ + register int i; + register unsigned long u = 0; + + LOG(("@g6 dt_lduw(%lu)", addr)); + + ch_in_data(addr, wsize); + ch_wordaligned(addr); +#ifdef LOGGING + if (!is_dt_set(addr, wsize, SH_INT)) { + warning(WGIEXP); + warn_dtbits(addr, wsize); + } +#endif LOGGING + + addr += wsize-1; + for (i = (int) wsize-1; i >= 0; i--, addr--) { + u = (u<<8) | btou(data_loc(addr)); + } + LOG(("@g6 dt_lduw() returns %lu", u)); + return (u); +} + long dt_lds(addr, n) register ptr addr; size n; @@ -280,14 +333,41 @@ long dt_lds(addr, n) } #endif LOGGING - l = btos(data_loc(addr + n - 1)); - for (i = n - 2; i >= 0; i--) { - l = (l<<8) | btol(data_loc(addr + i)); + addr += n-2; + l = btos(data_loc(addr + 1)); + for (i = n - 2; i >= 0; i--, addr--) { + l = (l<<8) | btol(data_loc(addr)); } LOG(("@g6 dt_lds() returns %lu", l)); return (l); } +long dt_ldsw(addr) + register ptr addr; +{ + register int i; + register long l; + + LOG(("@g6 dt_ldsw(%lu)", addr)); + + ch_in_data(addr, wsize); + ch_wordaligned(addr); +#ifdef LOGGING + if (!is_dt_set(addr, wsize, SH_INT)) { + warning(WGIEXP); + warn_dtbits(addr, wsize); + } +#endif LOGGING + + addr += wsize-2; + l = btos(data_loc(addr + 1)); + for (i = wsize - 2; i >= 0; i--, addr--) { + l = (l<<8) | btol(data_loc(addr)); + } + LOG(("@g6 dt_ldsw() returns %lu", l)); + return (l); +} + /************************************************************************ * Data move division * ************************************************************************ diff --git a/util/int/do_array.c b/util/int/do_array.c index a7bfa01a6..81123b9f8 100644 --- a/util/int/do_array.c +++ b/util/int/do_array.c @@ -39,7 +39,7 @@ DoLARm(arg) DoLARz() { /* LAR w: Load array element, descriptor contains integers of size w */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@A6 DoLARz(%ld)", l)); arr(LAR, arg_wi(l)); @@ -66,7 +66,7 @@ DoSARm(arg) DoSARz() { /* SAR w: Store array element */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@A6 DoSARz(%ld)", l)); arr(SAR, arg_wi(l)); @@ -93,7 +93,7 @@ DoAARm(arg) DoAARz() { /* AAR w: Load address of array element */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@A6 DoAARz(%ld)", l)); arr(AAR, arg_wi(l)); diff --git a/util/int/do_comp.c b/util/int/do_comp.c index bccd57755..483e4747e 100644 --- a/util/int/do_comp.c +++ b/util/int/do_comp.c @@ -51,7 +51,7 @@ DoCMIm(arg) DoCMIz() { /* CMI w: Compare w byte integers, Push negative, zero, positive for <, = or > */ - register size l = upop(wsize); + register size l = uwpop(); register long t = spop(arg_wi(l)); register long s = spop(l); @@ -102,7 +102,7 @@ DoCMFz() { /* CMF w: Compare w byte reals */ #ifndef NOFLOAT - register size l = upop(wsize); + register size l = uwpop(); double t = fpop(arg_wf(l)); double s = fpop(l); @@ -130,7 +130,7 @@ DoCMUl2(arg) DoCMUz() { /* CMU w: Compare w byte unsigneds */ - register size l = upop(wsize); + register size l = uwpop(); register unsigned long t = upop(arg_wi(l)); register unsigned long s = upop(l); @@ -165,7 +165,7 @@ DoCMSs(hob, wfac) DoCMSz() { /* CMS w: Compare w byte values, can only be used for bit for bit equality test */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@T6 DoCMSz(%ld)", l)); spoilFRA(); diff --git a/util/int/do_conv.c b/util/int/do_conv.c index ce6ef2f5d..c4797a753 100644 --- a/util/int/do_conv.c +++ b/util/int/do_conv.c @@ -21,12 +21,12 @@ extern double fpop(); DoCIIz() { /* CII -: Convert integer to integer (*) */ - register int newsize = spop(wsize); + register int newsize = swpop(); register long s; LOG(("@C6 DoCIIz()")); spoilFRA(); - switch ((int)(10 * spop(wsize) + newsize)) { + switch ((int)(10 * swpop() + newsize)) { case 12: if (wsize == 4) { wtrap(WILLCONV, EILLINS); @@ -65,12 +65,12 @@ DoCIIz() DoCUIz() { /* CUI -: Convert unsigned to integer (*) */ - register int newsize = spop(wsize); + register int newsize = swpop(); register unsigned long u; LOG(("@C6 DoCUIz()")); spoilFRA(); - switch ((int)(10 * spop(wsize) + newsize)) { + switch ((int)(10 * swpop() + newsize)) { case 22: if (wsize == 4) { wtrap(WILLCONV, EILLINS); @@ -116,12 +116,12 @@ DoCFIz() { /* CFI -: Convert floating to integer (*) */ #ifndef NOFLOAT - register int newsize = spop(wsize); + register int newsize = swpop(); double f; LOG(("@C6 DoCFIz()")); spoilFRA(); - switch ((int)(10 * spop(wsize) + newsize)) { + switch ((int)(10 * swpop() + newsize)) { case 42: if (wsize == 4) { wtrap(WILLCONV, EILLINS); @@ -172,11 +172,11 @@ DoCIFz() { /* CIF -: Convert integer to floating (*) */ #ifndef NOFLOAT - register int newsize = spop(wsize); + register int newsize = swpop(); LOG(("@C6 DoCIFz()")); spoilFRA(); - switch ((int)(10 * spop(wsize) + newsize)) { + switch ((int)(10 * swpop() + newsize)) { case 24: if (wsize == 4) { wtrap(WILLCONV, EILLINS); @@ -207,12 +207,12 @@ DoCUFz() { /* CUF -: Convert unsigned to floating (*) */ #ifndef NOFLOAT - register int newsize = spop(wsize); + register int newsize = swpop(); register unsigned long u; LOG(("@C6 DoCUFz()")); spoilFRA(); - switch ((int)(10 * spop(wsize) + newsize)) { + switch ((int)(10 * swpop() + newsize)) { case 24: if (wsize == 4) { wtrap(WILLCONV, EILLINS); @@ -253,11 +253,11 @@ DoCFFz() { /* CFF -: Convert floating to floating (*) */ #ifndef NOFLOAT - register int newsize = spop(wsize); + register int newsize = swpop(); LOG(("@C6 DoCFFz()")); spoilFRA(); - switch ((int)(10 * spop(wsize) + newsize)) { + switch ((int)(10 * swpop() + newsize)) { case 44: return; case 48: @@ -279,12 +279,12 @@ DoCFFz() DoCIUz() { /* CIU -: Convert integer to unsigned */ - register int newsize = spop(wsize); + register int newsize = swpop(); register long u; LOG(("@C6 DoCIUz()")); spoilFRA(); - switch ((int)(10 * spop(wsize) + newsize)) { + switch ((int)(10 * swpop() + newsize)) { case 22: if (wsize == 4) { wtrap(WILLCONV, EILLINS); @@ -313,11 +313,11 @@ DoCIUz() DoCUUz() { /* CUU -: Convert unsigned to unsigned */ - register int newsize = spop(wsize); + register int newsize = swpop(); LOG(("@C6 DoCUUz()")); spoilFRA(); - switch ((int)(10 * spop(wsize) + newsize)) { + switch ((int)(10 * swpop() + newsize)) { case 22: if (wsize == 4) { wtrap(WILLCONV, EILLINS); @@ -346,12 +346,12 @@ DoCFUz() { /* CFU -: Convert floating to unsigned */ #ifndef NOFLOAT - register int newsize = spop(wsize); + register int newsize = swpop(); double f; LOG(("@C6 DoCFUz()")); spoilFRA(); - switch ((int)(10 * spop(wsize) + newsize)) { + switch ((int)(10 * swpop() + newsize)) { case 42: if (wsize == 4) { wtrap(WILLCONV, EILLINS); diff --git a/util/int/do_fpar.c b/util/int/do_fpar.c index 80a9c244f..188a29e0e 100644 --- a/util/int/do_fpar.c +++ b/util/int/do_fpar.c @@ -68,7 +68,7 @@ DoADFz() { /* ADF w: Floating add (*) */ #ifndef NOFLOAT - register size l = upop(wsize); + register size l = uwpop(); double t = fpop(arg_wf(l)); LOG(("@F6 DoADFz(%ld)", l)); @@ -119,7 +119,7 @@ DoSBFz() { /* SBF w: Floating subtract (*) */ #ifndef NOFLOAT - register size l = upop(wsize); + register size l = uwpop(); double t = fpop(arg_wf(l)); LOG(("@F6 DoSBFz(%ld)", l)); @@ -170,7 +170,7 @@ DoMLFz() { /* MLF w: Floating multiply (*) */ #ifndef NOFLOAT - register size l = upop(wsize); + register size l = uwpop(); double t = fpop(arg_wf(l)); LOG(("@F6 DoMLFz(%ld)", l)); @@ -221,7 +221,7 @@ DoDVFz() { /* DVF w: Floating divide (*) */ #ifndef NOFLOAT - register size l = upop(wsize); + register size l = uwpop(); double t = fpop(arg_wf(l)); LOG(("@F6 DoDVFz(%ld)", l)); @@ -253,7 +253,7 @@ DoNGFz() { /* NGF w: Floating negate (*) */ #ifndef NOFLOAT - register size l = upop(wsize); + register size l = uwpop(); double t = fpop(arg_wf(l)); LOG(("@F6 DoNGFz(%ld)", l)); @@ -285,7 +285,7 @@ DoFIFz() { /* FIF w: Floating multiply and split integer and fraction part (*) */ #ifndef NOFLOAT - register size l = upop(wsize); + register size l = uwpop(); double t = fpop(arg_wf(l)); LOG(("@F6 DoFIFz(%ld)", l)); @@ -316,7 +316,7 @@ DoFEFz() { /* FEF w: Split floating number in exponent and fraction part (*) */ #ifndef NOFLOAT - register size l = upop(wsize); + register size l = uwpop(); LOG(("@F6 DoFEFz(%ld)", l)); spoilFRA(); diff --git a/util/int/do_incdec.c b/util/int/do_incdec.c index 9b3cebf58..2d3104164 100644 --- a/util/int/do_incdec.c +++ b/util/int/do_incdec.c @@ -21,7 +21,7 @@ DoINCz() /* INC -: Increment word on top of stack by 1 (*) */ LOG(("@Z6 DoINCz()")); spoilFRA(); - wpush(inc(spop(wsize))); + wpush(inc(swpop())); } DoINLm(arg) @@ -34,7 +34,7 @@ DoINLm(arg) LOG(("@Z6 DoINLm(%ld)", l)); spoilFRA(); p = loc_addr(l); - st_stn(p, inc(st_lds(p, wsize)), wsize); + st_stw(p, inc(st_ldsw(p))); } DoINLn2(arg) @@ -48,7 +48,7 @@ DoINLn2(arg) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, inc(st_lds(p, wsize)), wsize); + st_stw(p, inc(st_ldsw(p))); } DoINLn4(arg) @@ -62,7 +62,7 @@ DoINLn4(arg) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, inc(st_lds(p, wsize)), wsize); + st_stw(p, inc(st_ldsw(p))); } DoINLp2(arg) @@ -76,7 +76,7 @@ DoINLp2(arg) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, inc(st_lds(p, wsize)), wsize); + st_stw(p, inc(st_ldsw(p))); } DoINLp4(arg) @@ -90,7 +90,7 @@ DoINLp4(arg) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, inc(st_lds(p, wsize)), wsize); + st_stw(p, inc(st_ldsw(p))); } DoINLs(hob, wfac) @@ -105,7 +105,7 @@ DoINLs(hob, wfac) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, inc(st_lds(p, wsize)), wsize); + st_stw(p, inc(st_ldsw(p))); } DoINEl2(arg) @@ -117,7 +117,7 @@ DoINEl2(arg) LOG(("@Z6 DoINEl2(%lu)", p)); spoilFRA(); p = arg_g(p); - dt_stn(p, inc(dt_lds(p, wsize)), wsize); + dt_stw(p, inc(dt_ldsw(p))); } DoINEl4(arg) @@ -129,7 +129,7 @@ DoINEl4(arg) LOG(("@Z6 DoINEl4(%lu)", p)); spoilFRA(); p = arg_g(p); - dt_stn(p, inc(dt_lds(p, wsize)), wsize); + dt_stw(p, inc(dt_ldsw(p))); } DoINEs(hob, wfac) @@ -142,7 +142,7 @@ DoINEs(hob, wfac) LOG(("@Z6 DoINEs(%lu)", p)); spoilFRA(); p = arg_g(p); - dt_stn(p, inc(dt_lds(p, wsize)), wsize); + dt_stw(p, inc(dt_ldsw(p))); } DoDECz() @@ -150,7 +150,7 @@ DoDECz() /* DEC -: Decrement word on top of stack by 1 (*) */ LOG(("@Z6 DoDECz()")); spoilFRA(); - wpush(dec(spop(wsize))); + wpush(dec(swpop())); } DoDELn2(arg) @@ -164,7 +164,7 @@ DoDELn2(arg) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, dec(st_lds(p, wsize)), wsize); + st_stw(p, dec(st_ldsw(p))); } DoDELn4(arg) @@ -178,7 +178,7 @@ DoDELn4(arg) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, dec(st_lds(p, wsize)), wsize); + st_stw(p, dec(st_ldsw(p))); } DoDELp2(arg) @@ -192,7 +192,7 @@ DoDELp2(arg) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, dec(st_lds(p, wsize)), wsize); + st_stw(p, dec(st_ldsw(p))); } DoDELp4(arg) @@ -206,7 +206,7 @@ DoDELp4(arg) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, dec(st_lds(p, wsize)), wsize); + st_stw(p, dec(st_ldsw(p))); } DoDELs(hob, wfac) @@ -221,7 +221,7 @@ DoDELs(hob, wfac) spoilFRA(); l = arg_l(l); p = loc_addr(l); - st_stn(p, dec(st_lds(p, wsize)), wsize); + st_stw(p, dec(st_ldsw(p))); } DoDEEl2(arg) @@ -233,7 +233,7 @@ DoDEEl2(arg) LOG(("@Z6 DoDEEl2(%lu)", p)); spoilFRA(); p = arg_g(p); - dt_stn(p, dec(dt_lds(p, wsize)), wsize); + dt_stw(p, dec(dt_ldsw(p))); } DoDEEl4(arg) @@ -245,7 +245,7 @@ DoDEEl4(arg) LOG(("@Z6 DoDEEl4(%lu)", p)); spoilFRA(); p = arg_g(p); - dt_stn(p, dec(dt_lds(p, wsize)), wsize); + dt_stw(p, dec(dt_ldsw(p))); } DoDEEs(hob, wfac) @@ -258,7 +258,7 @@ DoDEEs(hob, wfac) LOG(("@Z6 DoDEEs(%lu)", p)); spoilFRA(); p = arg_g(p); - dt_stn(p, dec(dt_lds(p, wsize)), wsize); + dt_stw(p, dec(dt_ldsw(p))); } DoZRLm(arg) @@ -269,7 +269,7 @@ DoZRLm(arg) LOG(("@Z6 DoZRLm(%ld)", l)); spoilFRA(); - st_stn(loc_addr(l), 0L, wsize); + st_stw(loc_addr(l), 0L); } DoZRLn2(arg) @@ -281,7 +281,7 @@ DoZRLn2(arg) LOG(("@Z6 DoZRLn2(%ld)", l)); spoilFRA(); l = arg_l(arg); - st_stn(loc_addr(l), 0L, wsize); + st_stw(loc_addr(l), 0L); } DoZRLn4(arg) @@ -293,7 +293,7 @@ DoZRLn4(arg) LOG(("@Z6 DoZRLn4(%ld)", l)); spoilFRA(); l = arg_l(l); - st_stn(loc_addr(l), 0L, wsize); + st_stw(loc_addr(l), 0L); } DoZRLp2(arg) @@ -305,7 +305,7 @@ DoZRLp2(arg) LOG(("@Z6 DoZRLp2(%ld)", l)); spoilFRA(); l = arg_l(l); - st_stn(loc_addr(l), 0L, wsize); + st_stw(loc_addr(l), 0L); } DoZRLp4(arg) @@ -317,7 +317,7 @@ DoZRLp4(arg) LOG(("@Z6 DoZRLp4(%ld)", l)); spoilFRA(); l = arg_l(l); - st_stn(loc_addr(l), 0L, wsize); + st_stw(loc_addr(l), 0L); } DoZRLs(hob, wfac) @@ -330,7 +330,7 @@ DoZRLs(hob, wfac) LOG(("@Z6 DoZRLs(%ld)", l)); spoilFRA(); l = arg_l(l); - st_stn(loc_addr(l), 0L, wsize); + st_stw(loc_addr(l), 0L); } DoZREl2(arg) @@ -341,7 +341,7 @@ DoZREl2(arg) LOG(("@Z6 DoZREl2(%lu)", p)); spoilFRA(); - dt_stn(arg_g(p), 0L, wsize); + dt_stw(arg_g(p), 0L); } DoZREl4(arg) @@ -352,7 +352,7 @@ DoZREl4(arg) LOG(("@Z6 DoZREl4(%lu)", p)); spoilFRA(); - dt_stn(arg_g(p), 0L, wsize); + dt_stw(arg_g(p), 0L); } DoZREs(hob, wfac) @@ -364,7 +364,7 @@ DoZREs(hob, wfac) LOG(("@Z6 DoZREs(%lu)", p)); spoilFRA(); - dt_stn(arg_g(p), 0L, wsize); + dt_stw(arg_g(p), 0L); } DoZRFl2(arg) @@ -387,7 +387,7 @@ DoZRFz() { /* ZRF w: Load a floating zero of size w */ #ifndef NOFLOAT - register size l = upop(wsize); + register size l = uwpop(); LOG(("@Z6 DoZRFz(%ld)", l)); spoilFRA(); @@ -425,7 +425,7 @@ DoZERs(hob, wfac) DoZERz() { /* ZER w: Load w zero bytes */ - register size i, l = spop(wsize); + register size i, l = swpop(); LOG(("@Z6 DoZERz(%ld)", l)); spoilFRA(); diff --git a/util/int/do_intar.c b/util/int/do_intar.c index 3b7662ccf..f147c2b3d 100644 --- a/util/int/do_intar.c +++ b/util/int/do_intar.c @@ -43,7 +43,7 @@ DoADIm(arg) DoADIz() /* argument on top of stack */ { /* ADI w: Addition (*) */ - register size l = upop(wsize); + register size l = uwpop(); register long t = spop(arg_wi(l)); LOG(("@I6 DoADIz(%ld)", l)); @@ -78,7 +78,7 @@ DoSBIm(arg) DoSBIz() /* arg on top of stack */ { /* SBI w: Subtraction (*) */ - register size l = upop(wsize); + register size l = uwpop(); register long t = spop(arg_wi(l)); LOG(("@I6 DoSBIz(%ld)", l)); @@ -113,7 +113,7 @@ DoMLIm(arg) DoMLIz() /* arg on top of stack */ { /* MLI w: Multiplication (*) */ - register size l = upop(wsize); + register size l = uwpop(); register long t = spop(arg_wi(l)); LOG(("@I6 DoMLIz(%ld)", l)); @@ -148,7 +148,7 @@ DoDVIm(arg) DoDVIz() /* arg on top of stack */ { /* DVI w: Division (*) */ - register size l = upop(wsize); + register size l = uwpop(); register long t = spop(arg_wi(l)); LOG(("@I6 DoDVIz(%ld)", l)); @@ -183,7 +183,7 @@ DoRMIm(arg) DoRMIz() /* arg on top of stack */ { /* RMI w: Remainder (*) */ - register size l = upop(wsize); + register size l = uwpop(); register long t = spop(arg_wi(l)); LOG(("@I6 DoRMIz(%ld)", l)); @@ -206,7 +206,7 @@ DoNGIl2(arg) DoNGIz() { /* NGI w: Negate (two's complement) (*) */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@I6 DoNGIz(%ld)", l)); spoilFRA(); @@ -219,7 +219,7 @@ DoSLIl2(arg) { /* SLI w: Shift left (*) */ register size l = (L_arg_2() * arg); - register long t = spop(wsize); + register long t = swpop(); LOG(("@I6 DoSLIl2(%ld)", l)); spoilFRA(); @@ -232,7 +232,7 @@ DoSLIm(arg) { /* SLI w: Shift left (*) */ register size l = arg_wi(arg); - register long t = spop(wsize); + register long t = swpop(); LOG(("@I6 DoSLIm(%ld)", l)); spoilFRA(); @@ -242,8 +242,8 @@ DoSLIm(arg) DoSLIz() { /* SLI w: Shift left (*) */ - register size l = upop(wsize); - register long t = spop(wsize); + register size l = uwpop(); + register long t = swpop(); LOG(("@I6 DoSLIz(%ld)", l)); spoilFRA(); @@ -256,7 +256,7 @@ DoSRIl2(arg) { /* SRI w: Shift right (*) */ register size l = (L_arg_2() * arg); - register long t = spop(wsize); + register long t = swpop(); LOG(("@I6 DoSRIl2(%ld)", l)); spoilFRA(); @@ -267,8 +267,8 @@ DoSRIl2(arg) DoSRIz() { /* SRI w: Shift right (*) */ - register size l = upop(wsize); - register long t = spop(wsize); + register size l = uwpop(); + register long t = swpop(); LOG(("@I6 DoSRIz(%ld)", l)); spoilFRA(); diff --git a/util/int/do_load.c b/util/int/do_load.c index bc397de1b..fd70ea648 100644 --- a/util/int/do_load.c +++ b/util/int/do_load.c @@ -42,7 +42,7 @@ DoLOCm(arg) long arg; { /* LOC c: Load constant (i.e. push one word onto the stack) */ - register long l = arg_c(arg); + long l = arg_c(arg); LOG(("@L6 DoLOCm(%ld)", l)); spoilFRA(); @@ -102,7 +102,7 @@ DoLOLm(arg) LOG(("@L6 DoLOLm(%ld)", l)); spoilFRA(); - push_st(loc_addr(l), wsize); + pushw_st(loc_addr(l)); } DoLOLn2(arg) @@ -114,7 +114,7 @@ DoLOLn2(arg) LOG(("@L6 DoLOLn2(%ld)", l)); spoilFRA(); l = arg_l(l); - push_st(loc_addr(l), wsize); + pushw_st(loc_addr(l)); } DoLOLn4(arg) @@ -126,7 +126,7 @@ DoLOLn4(arg) LOG(("@L6 DoLOLn4(%ld)", l)); spoilFRA(); l = arg_l(l); - push_st(loc_addr(l), wsize); + pushw_st(loc_addr(l)); } DoLOLp2(arg) @@ -138,7 +138,7 @@ DoLOLp2(arg) LOG(("@L6 DoLOLp2(%ld)", l)); spoilFRA(); l = arg_l(l); - push_st(loc_addr(l), wsize); + pushw_st(loc_addr(l)); } DoLOLp4(arg) @@ -150,7 +150,7 @@ DoLOLp4(arg) LOG(("@L6 DoLOLp4(%ld)", l)); spoilFRA(); l = arg_l(l); - push_st(loc_addr(l), wsize); + pushw_st(loc_addr(l)); } DoLOLs(hob, wfac) @@ -163,7 +163,7 @@ DoLOLs(hob, wfac) LOG(("@L6 DoLOLs(%ld)", l)); spoilFRA(); l = arg_l(l); - push_st(loc_addr(l), wsize); + pushw_st(loc_addr(l)); } DoLOEl2(arg) @@ -174,7 +174,7 @@ DoLOEl2(arg) LOG(("@L6 DoLOEl2(%lu)", p)); spoilFRA(); - push_m(arg_g(p), wsize); + pushw_m(arg_g(p)); } DoLOEl4(arg) @@ -185,7 +185,7 @@ DoLOEl4(arg) LOG(("@L6 DoLOEl4(%lu)", p)); spoilFRA(); - push_m(arg_g(p), wsize); + pushw_m(arg_g(p)); } DoLOEs(hob, wfac) @@ -197,7 +197,7 @@ DoLOEs(hob, wfac) LOG(("@L6 DoLOEs(%lu)", p)); spoilFRA(); - push_m(arg_g(p), wsize); + pushw_m(arg_g(p)); } DoLILm(arg) @@ -208,7 +208,7 @@ DoLILm(arg) LOG(("@L6 DoLILm(%ld)", l)); spoilFRA(); - push_m(st_lddp(loc_addr(l)), wsize); + pushw_m(st_lddp(loc_addr(l))); } DoLILn2(arg) @@ -220,7 +220,7 @@ DoLILn2(arg) LOG(("@L6 DoLILn2(%ld)", l)); spoilFRA(); l = arg_l(l); - push_m(st_lddp(loc_addr(l)), wsize); + pushw_m(st_lddp(loc_addr(l))); } DoLILn4(arg) @@ -232,7 +232,7 @@ DoLILn4(arg) LOG(("@L6 DoLILn4(%ld)", l)); spoilFRA(); l = arg_l(l); - push_m(st_lddp(loc_addr(l)), wsize); + pushw_m(st_lddp(loc_addr(l))); } DoLILp2(arg) @@ -244,7 +244,7 @@ DoLILp2(arg) LOG(("@L6 DoLILp2(%ld)", l)); spoilFRA(); l = arg_l(l); - push_m(st_lddp(loc_addr(l)), wsize); + pushw_m(st_lddp(loc_addr(l))); } DoLILp4(arg) @@ -256,7 +256,7 @@ DoLILp4(arg) LOG(("@L6 DoLILp4(%ld)", l)); spoilFRA(); l = arg_l(l); - push_m(st_lddp(loc_addr(l)), wsize); + pushw_m(st_lddp(loc_addr(l))); } DoLILs(hob, wfac) @@ -269,7 +269,7 @@ DoLILs(hob, wfac) LOG(("@L6 DoLILs(%ld)", l)); spoilFRA(); l = arg_l(l); - push_m(st_lddp(loc_addr(l)), wsize); + pushw_m(st_lddp(loc_addr(l))); } DoLOFl2(arg) @@ -281,7 +281,7 @@ DoLOFl2(arg) LOG(("@L6 DoLOFl2(%ld)", l)); spoilFRA(); - push_m(p + arg_f(l), wsize); + pushw_m(p + arg_f(l)); } DoLOFl4(arg) @@ -293,7 +293,7 @@ DoLOFl4(arg) LOG(("@L6 DoLOFl4(%ld)", l)); spoilFRA(); - push_m(p + arg_f(l), wsize); + pushw_m(p + arg_f(l)); } DoLOFm(arg) @@ -305,7 +305,7 @@ DoLOFm(arg) LOG(("@L6 DoLOFm(%ld)", l)); spoilFRA(); - push_m(p + arg_f(l), wsize); + pushw_m(p + arg_f(l)); } DoLOFs(hob, wfac) @@ -318,7 +318,7 @@ DoLOFs(hob, wfac) LOG(("@L6 DoLOFs(%ld)", l)); spoilFRA(); - push_m(p + arg_f(l), wsize); + pushw_m(p + arg_f(l)); } DoLALm(arg) @@ -548,7 +548,7 @@ DoLOSl2(arg) DoLOSz() { /* LOS w: Load indirect, w-byte integer on top of stack gives object size */ - register size l = upop(wsize); + register size l = uwpop(); register ptr p; LOG(("@L6 DoLOSz(%ld)", l)); diff --git a/util/int/do_logic.c b/util/int/do_logic.c index f2f339d5f..13b3900ca 100644 --- a/util/int/do_logic.c +++ b/util/int/do_logic.c @@ -62,7 +62,7 @@ DoANDz() { /* AND w: Boolean and on two groups of w bytes */ /* size of objects to be compared (in bytes) on top of stack */ - register size l = upop(wsize); + register size l = uwpop(); register ptr p; LOG(("@X6 DoANDz(%ld)", l)); @@ -129,7 +129,7 @@ DoIORs(hob, wfac) DoIORz() { /* IOR w: Boolean inclusive or on two groups of w bytes */ - register size l = upop(wsize); + register size l = uwpop(); register ptr p; LOG(("@X6 DoIORz(%ld)", l)); @@ -162,7 +162,7 @@ DoXORl2(arg) DoXORz() { /* XOR w: Boolean exclusive or on two groups of w bytes */ - register size l = upop(wsize); + register size l = uwpop(); register ptr p; LOG(("@X6 DoXORz(%ld)", l)); @@ -194,7 +194,7 @@ DoCOMl2(arg) DoCOMz() { /* COM w: Complement (one's complement of top w bytes) */ - register size l = upop(wsize); + register size l = uwpop(); register ptr p; LOG(("@X6 DoCOMz(%ld)", l)); @@ -211,7 +211,7 @@ DoROLl2(arg) { /* ROL w: Rotate left a group of w bytes */ register size l = (L_arg_2() * arg); - register long s, t = upop(wsize); + register long s, t = uwpop(); register long signbit; LOG(("@X6 DoROLl2(%ld)", l)); @@ -243,8 +243,8 @@ DoROLl2(arg) DoROLz() { /* ROL w: Rotate left a group of w bytes */ - register size l = upop(wsize); - register long s, t = upop(wsize); + register size l = uwpop(); + register long s, t = uwpop(); register long signbit; LOG(("@X6 DoROLz(%ld)", l)); @@ -278,7 +278,7 @@ DoRORl2(arg) { /* ROR w: Rotate right a group of w bytes */ register size l = (L_arg_2() * arg); - register long s, t = upop(wsize); + register long s, t = uwpop(); register long signbit; LOG(("@X6 DoRORl2(%ld)", l)); @@ -313,8 +313,8 @@ DoRORl2(arg) DoRORz() { /* ROR w: Rotate right a group of w bytes */ - register size l = upop(wsize); - register long s, t = upop(wsize); + register size l = uwpop(); + register long s, t = uwpop(); register long signbit; LOG(("@X6 DoRORz(%ld)", l)); diff --git a/util/int/do_misc.c b/util/int/do_misc.c index 9eecf0d6d..d0eb420d2 100644 --- a/util/int/do_misc.c +++ b/util/int/do_misc.c @@ -86,7 +86,7 @@ DoASSl2(arg) DoASSz() { /* ASS w: Adjust the stack pointer by w-byte integer */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@M6 DoASSz(%ld)", l)); spoilFRA(); @@ -162,7 +162,7 @@ DoBLSl2(arg) DoBLSz() { /* BLS w: Block move, size is in w-byte integer on top of stack */ - register size l = upop(wsize); + register size l = uwpop(); register ptr dp1, dp2; LOG(("@M6 DoBLSz(%ld)", l)); @@ -196,7 +196,7 @@ DoCSAm(arg) DoCSAz() { /* CSA w: Case jump; address of jump table at top of stack */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@M6 DoCSAz(%ld)", l)); spoilFRA(); @@ -226,7 +226,7 @@ DoCSBm(arg) DoCSBz() { /* CSB w: Table lookup jump; address of jump table at top of stack */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@M6 DoCSBz(%ld)", l)); spoilFRA(); @@ -290,7 +290,7 @@ DoDUSl2(arg) DoDUSz() { /* DUS w: Duplicate top w bytes */ - register size l = upop(wsize); + register size l = uwpop(); register ptr oldSP; LOG(("@M6 DoDUSz(%ld)", l)); @@ -337,7 +337,7 @@ DoEXGs(hob, wfac) DoEXGz() { /* EXG w: Exchange top w bytes */ - register size l = upop(wsize); + register size l = uwpop(); register ptr oldSP = SP; LOG(("@M6 DoEXGz(%ld)", l)); @@ -522,7 +522,7 @@ DoRCKm(arg) DoRCKz() { /* RCK w: Range check; trap on error */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@M6 DoRCKz(%ld)", l)); spoilFRA(); @@ -555,11 +555,11 @@ DoRTTz() } /* pop the trap number */ - upop(wsize); + uwpop(); /* restore the Function Return Area */ - FRA_def = upop(wsize); - FRASize = upop(wsize); + FRA_def = uwpop(); + FRASize = uwpop(); popFRA(FRASize); } @@ -587,7 +587,7 @@ DoSIMz() /* SIM -: Store 16 bit ignore mask */ LOG(("@M6 DoSIMz()")); spoilFRA(); - IgnMask = (upop(wsize) | PreIgnMask) & MASK2; + IgnMask = (uwpop() | PreIgnMask) & MASK2; } DoSTRs(hob, wfac) @@ -616,7 +616,7 @@ DoSTRs(hob, wfac) DoTRPz() { /* TRP -: Cause trap to occur (Error number on stack) */ - register unsigned int tr = (unsigned int)upop(wsize); + register unsigned int tr = (unsigned int)uwpop(); LOG(("@M6 DoTRPz()")); spoilFRA(); @@ -690,11 +690,11 @@ PRIVATE index_jump(nbytes) { register ptr cdp = dppop(); /* Case Descriptor Pointer */ register long t_index = /* Table INDEX */ - spop(nbytes) - mem_lds(cdp + psize, wsize); + spop(nbytes) - mem_lds(cdp + psize, nbytes); register ptr nPC; /* New Program Counter */ - if (t_index >= 0 && t_index <= mem_lds(cdp + wsize + psize, wsize)) { - nPC = mem_ldip(cdp + (2 * wsize) + ((t_index + 1) * psize)); + if (t_index >= 0 && t_index <= mem_lds(cdp + nbytes + psize, nbytes)) { + nPC = mem_ldip(cdp + (2 * nbytes) + ((t_index + 1) * psize)); } else if ((nPC = mem_ldip(cdp)) == 0) { trap(ECASE); @@ -719,12 +719,12 @@ PRIVATE search_jump(nbytes) register ptr cdp = dppop(); /* Case Descriptor Pointer */ register long sv = spop(nbytes);/* Search Value */ register long nt = /* Number of Table-entries */ - mem_lds(cdp + psize, wsize); + mem_lds(cdp + psize, nbytes); register ptr nPC; /* New Program Counter */ while (--nt >= 0) { - if (sv == mem_lds(cdp + (nt+1) * (wsize+psize), wsize)) { - nPC = mem_ldip(cdp + wsize + (nt+1)*(wsize+psize)); + if (sv == mem_lds(cdp + (nt+1) * (nbytes+psize), nbytes)) { + nPC = mem_ldip(cdp + nbytes + (nt+1)*(nbytes+psize)); if (nPC == 0) trap(ECASE); newPC(nPC); @@ -754,8 +754,8 @@ PRIVATE range_check(nbytes) st_lds(SP, nbytes); if (must_test && !(IgnMask&BIT(ERANGE))) { - if ( cv < mem_lds(rdp, wsize) - || cv > mem_lds(rdp + wsize, wsize) + if ( cv < mem_lds(rdp, nbytes) + || cv > mem_lds(rdp + nbytes, nbytes) ) { trap(ERANGE); } diff --git a/util/int/do_ptrar.c b/util/int/do_ptrar.c index b92137e39..96258da3d 100644 --- a/util/int/do_ptrar.c +++ b/util/int/do_ptrar.c @@ -141,7 +141,7 @@ DoADSm(arg) DoADSz() { /* ADS w: Add w-byte value and pointer */ - register size l = upop(wsize); + register size l = uwpop(); register long t = spop(arg_wi(l)); register ptr p, s = st_lddp(SP); @@ -182,7 +182,7 @@ DoSBSl2(arg) DoSBSz() { /* SBS w: Subtract pointers in same fragment and push diff as size w integer */ - register size l = upop(wsize); + register size l = uwpop(); register ptr t = st_lddp(SP); register ptr s = st_lddp(SP + psize); register long w; diff --git a/util/int/do_sets.c b/util/int/do_sets.c index a0a63fce0..c3eabec37 100644 --- a/util/int/do_sets.c +++ b/util/int/do_sets.c @@ -40,7 +40,7 @@ DoINNs(hob, wfac) DoINNz() { /* INN w: Bit test on w byte set (bit number on top of stack) */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@Y6 DoINNz(%ld)", l)); spoilFRA(); @@ -73,7 +73,7 @@ DoSETs(hob, wfac) DoSETz() { /* SET w: Create singleton w byte set with bit n on (n is top of stack) */ - register size l = upop(wsize); + register size l = uwpop(); LOG(("@Y6 DoSETz(%ld)", l)); spoilFRA(); @@ -93,7 +93,7 @@ PRIVATE bit_test(w) size w; { register int bitno = - (int) spop(wsize); /* bitno on TOS */ + (int) swpop(); /* bitno on TOS */ register char test_byte = (char) 0;/* default value to be tested */ if (must_test && !(IgnMask&BIT(ESET))) { @@ -119,7 +119,7 @@ PRIVATE bit_test(w) PRIVATE create_set(w) size w; { - register int bitno = (int) spop(wsize); + register int bitno = (int) swpop(); register size nbytes = w; st_inc(nbytes); diff --git a/util/int/do_store.c b/util/int/do_store.c index 23f6a8bef..20d769c53 100644 --- a/util/int/do_store.c +++ b/util/int/do_store.c @@ -21,7 +21,7 @@ DoSTLm(arg) LOG(("@S6 DoSTLm(%ld)", l)); spoilFRA(); - pop_st(loc_addr(l), wsize); + popw_st(loc_addr(l)); } DoSTLn2(arg) @@ -33,7 +33,7 @@ DoSTLn2(arg) LOG(("@S6 DoSTLn2(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_st(loc_addr(l), wsize); + popw_st(loc_addr(l)); } DoSTLn4(arg) @@ -45,7 +45,7 @@ DoSTLn4(arg) LOG(("@S6 DoSTLn4(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_st(loc_addr(l), wsize); + popw_st(loc_addr(l)); } DoSTLp2(arg) @@ -57,7 +57,7 @@ DoSTLp2(arg) LOG(("@S6 DoSTLp2(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_st(loc_addr(l), wsize); + popw_st(loc_addr(l)); } DoSTLp4(arg) @@ -69,7 +69,7 @@ DoSTLp4(arg) LOG(("@S6 DoSTLp4(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_st(loc_addr(l), wsize); + popw_st(loc_addr(l)); } DoSTLs(hob, wfac) @@ -82,7 +82,7 @@ DoSTLs(hob, wfac) LOG(("@S6 DoSTLs(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_st(loc_addr(l), wsize); + popw_st(loc_addr(l)); } DoSTEl2(arg) @@ -93,7 +93,7 @@ DoSTEl2(arg) LOG(("@S6 DoSTEl2(%lu)", p)); spoilFRA(); - pop_m(arg_g(p), wsize); + popw_m(arg_g(p)); } DoSTEl4(arg) @@ -104,7 +104,7 @@ DoSTEl4(arg) LOG(("@S6 DoSTEl4(%lu)", p)); spoilFRA(); - pop_m(arg_g(p), wsize); + popw_m(arg_g(p)); } DoSTEs(hob, wfac) @@ -116,7 +116,7 @@ DoSTEs(hob, wfac) LOG(("@S6 DoSTEs(%lu)", p)); spoilFRA(); - pop_m(arg_g(p), wsize); + popw_m(arg_g(p)); } DoSILn2(arg) @@ -128,7 +128,7 @@ DoSILn2(arg) LOG(("@S6 DoSILn2(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_m(st_lddp(loc_addr(l)), wsize); + popw_m(st_lddp(loc_addr(l))); } DoSILn4(arg) @@ -140,7 +140,7 @@ DoSILn4(arg) LOG(("@S6 DoSILn4(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_m(st_lddp(loc_addr(l)), wsize); + popw_m(st_lddp(loc_addr(l))); } DoSILp2(arg) @@ -152,7 +152,7 @@ DoSILp2(arg) LOG(("@S6 DoSILp2(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_m(st_lddp(loc_addr(l)), wsize); + popw_m(st_lddp(loc_addr(l))); } DoSILp4(arg) @@ -164,7 +164,7 @@ DoSILp4(arg) LOG(("@S6 DoSILp4(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_m(st_lddp(loc_addr(l)), wsize); + popw_m(st_lddp(loc_addr(l))); } DoSILs(hob, wfac) @@ -177,7 +177,7 @@ DoSILs(hob, wfac) LOG(("@S6 DoSILs(%ld)", l)); spoilFRA(); l = arg_l(l); - pop_m(st_lddp(loc_addr(l)), wsize); + popw_m(st_lddp(loc_addr(l))); } DoSTFl2(arg) @@ -189,7 +189,7 @@ DoSTFl2(arg) LOG(("@S6 DoSTFl2(%ld)", l)); spoilFRA(); - pop_m(p + arg_f(l), wsize); + popw_m(p + arg_f(l)); } DoSTFl4(arg) @@ -201,7 +201,7 @@ DoSTFl4(arg) LOG(("@S6 DoSTFl4(%ld)", l)); spoilFRA(); - pop_m(p + arg_f(l), wsize); + popw_m(p + arg_f(l)); } DoSTFm(arg) @@ -213,7 +213,7 @@ DoSTFm(arg) LOG(("@S6 DoSTFm(%ld)", l)); spoilFRA(); - pop_m(p + arg_f(l), wsize); + popw_m(p + arg_f(l)); } DoSTFs(hob, wfac) @@ -226,7 +226,7 @@ DoSTFs(hob, wfac) LOG(("@S6 DoSTFs(%ld)", l)); spoilFRA(); - pop_m(p + arg_f(l), wsize); + popw_m(p + arg_f(l)); } DoSTIl2(arg) @@ -294,7 +294,7 @@ DoSTSl2(arg) DoSTSz() /* the arg 'w' is on top of stack */ { /* STS w: Store indirect, w-byte integer on top of stack gives object size */ - register size l = upop(wsize); + register size l = uwpop(); register ptr p; LOG(("@S6 DoSTSz(%ld)", l)); diff --git a/util/int/do_unsar.c b/util/int/do_unsar.c index 51a8aae2a..1581849b3 100644 --- a/util/int/do_unsar.c +++ b/util/int/do_unsar.c @@ -48,7 +48,7 @@ DoADUl2(arg) DoADUz() { /* ADU w: Addition */ - register size l = upop(wsize); + register size l = uwpop(); register unsigned long t = upop(arg_wi(l)); LOG(("@U6 DoADUz(%ld)", l)); @@ -71,7 +71,7 @@ DoSBUl2(arg) DoSBUz() { /* SBU w: Subtraction */ - register size l = upop(wsize); + register size l = uwpop(); register unsigned long t = upop(arg_wi(l)); LOG(("@U6 DoSBUz(%ld)", l)); @@ -94,7 +94,7 @@ DoMLUl2(arg) DoMLUz() { /* MLU w: Multiplication */ - register size l = upop(wsize); + register size l = uwpop(); register unsigned long t = upop(arg_wi(l)); LOG(("@U6 DoMLUz(%ld)", l)); @@ -117,7 +117,7 @@ DoDVUl2(arg) DoDVUz() { /* DVU w: Division */ - register size l = upop(wsize); + register size l = uwpop(); register unsigned long t = upop(arg_wi(l)); LOG(("@U6 DoDVUz(%ld)", l)); @@ -140,7 +140,7 @@ DoRMUl2(arg) DoRMUz() { /* RMU w: Remainder */ - register size l = upop(wsize); + register size l = uwpop(); register unsigned long t = upop(arg_wi(l)); LOG(("@U6 DoRMUz(%ld)", l)); @@ -153,7 +153,7 @@ DoSLUl2(arg) { /* SLU w: Shift left */ register size l = (L_arg_2() * arg); - register unsigned long t = upop(wsize); + register unsigned long t = uwpop(); LOG(("@U6 DoSLUl2(%ld)", l)); spoilFRA(); @@ -164,8 +164,8 @@ DoSLUl2(arg) DoSLUz() { /* SLU w: Shift left */ - register size l = upop(wsize); - register unsigned long t = upop(wsize); + register size l = uwpop(); + register unsigned long t = uwpop(); LOG(("@U6 DoSLUz(%ld)", l)); spoilFRA(); @@ -178,7 +178,7 @@ DoSRUl2(arg) { /* SRU w: Shift right */ register size l = (L_arg_2() * arg); - register unsigned long t = upop(wsize); + register unsigned long t = uwpop(); LOG(("@U6 DoSRUl2(%ld)", l)); spoilFRA(); @@ -189,8 +189,8 @@ DoSRUl2(arg) DoSRUz() { /* SRU w: Shift right */ - register size l = upop(wsize); - register unsigned long t = upop(wsize); + register size l = uwpop(); + register unsigned long t = uwpop(); LOG(("@U6 DoSRUz(%ld)", l)); spoilFRA(); diff --git a/util/int/dump.c b/util/int/dump.c index a2e11212d..e64db3e96 100644 --- a/util/int/dump.c +++ b/util/int/dump.c @@ -130,7 +130,7 @@ PRIVATE std_item(addr) } else if ( is_wordaligned(addr) - && is_in_stack(addr, wsize) + && w_is_in_stack(addr) && std_bytes(addr, addr + wsize, SH_INT) ) { /* print a word value */ diff --git a/util/int/mem.h b/util/int/mem.h index e83333e09..f10c0d603 100644 --- a/util/int/mem.h +++ b/util/int/mem.h @@ -17,11 +17,13 @@ /******** Checks on adresses and ranges ********/ #define is_aligned(a,n) ((p2i(a)) % (n) == 0) -#define is_wordaligned(a) (((p2i(a)) & wsizem1) == 0) +#define is_wordaligned(a) \ + (((p2i(a)) & wsizem1) == 0) #define ch_aligned(a,n) { if (!is_aligned(a, min(n, wsize))) \ { trap(EBADPTR); } } -#define ch_wordaligned(a) { if (!is_wordaligned(a)) \ +#define ch_wordaligned(a) \ + { if (!is_wordaligned(a)) \ { trap(EBADPTR); } } #define in_gda(p) ((p) < HB) @@ -33,6 +35,9 @@ #define is_in_stack(a,n) (SP <= (a) && (a) + (n) - 1 <= ML) #define ch_in_stack(a,n) { if (!is_in_stack(a, n)) { trap(EMEMFLT); } } +#define w_is_in_stack(a) (SP <= (a) && (a) + wsizem1 <= ML) +#define ch_w_in_stack(a) { if (!w_is_in_stack(a)) { trap(EMEMFLT); } } + #define is_in_FRA(a,n) ((a) + (n) <= FRASize) @@ -45,10 +50,14 @@ #define mem_lddp(a) (in_stack(a) ? st_lddp(a) : dt_lddp(a)) #define mem_ldip(a) (in_stack(a) ? st_ldip(a) : dt_ldip(a)) #define mem_ldu(a,n) (in_stack(a) ? st_ldu(a, n) : dt_ldu(a, n)) +#define mem_lduw(a) (in_stack(a) ? st_lduw(a) : dt_lduw(a)) #define mem_lds(a,n) (in_stack(a) ? st_lds(a, n) : dt_lds(a, n)) +#define mem_ldsw(a) (in_stack(a) ? st_ldsw(a) : dt_ldsw(a)) #define push_m(a,n) { if (in_stack(a)) push_st(a, n); else push_dt(a, n); } +#define pushw_m(a) { if (in_stack(a)) pushw_st(a); else pushw_dt(a); } #define pop_m(a,n) { if (in_stack(a)) pop_st(a, n); else pop_dt(a, n); } +#define popw_m(a) { if (in_stack(a)) popw_st(a); else popw_dt(a); } /******** Simple stack manipulation ********/ @@ -61,6 +70,6 @@ extern ptr st_ldip(), dt_ldip(); extern ptr st_lddp(), dt_lddp(), dppop(); -extern long st_lds(), dt_lds(), spop(), wpop(); -extern unsigned long st_ldu(), dt_ldu(), upop(); +extern long st_lds(), st_ldsw(), dt_lds(), dt_ldsw(), spop(), swpop(), wpop(); +extern unsigned long st_ldu(), st_lduw(), dt_ldu(), dt_lduw(), upop(), uwpop(); diff --git a/util/int/moncalls.c b/util/int/moncalls.c index 096a3bb84..23e080d1a 100644 --- a/util/int/moncalls.c +++ b/util/int/moncalls.c @@ -70,7 +70,7 @@ extern void sync(); #define INT2SIZE max(wsize, 2L) #define INT4SIZE max(wsize, 4L) -#define pop_int() ((int) spop(wsize)) +#define pop_int() ((int) swpop()) #define pop_int2() ((int) spop(INT2SIZE)) #define pop_int4() (spop(INT4SIZE)) #define pop_intp() ((int) spop(psize)) diff --git a/util/int/read.c b/util/int/read.c index dd2e7e85b..b7bb3a2ba 100644 --- a/util/int/read.c +++ b/util/int/read.c @@ -234,7 +234,7 @@ PRIVATE ptr rd_descr(type, count, pos) case 1: /* m uninitialized words */ j = count; while (j--) { - dt_stn(pos, 0L, wsize); + dt_stw(pos, 0L); pos += wsize; } break; @@ -246,7 +246,7 @@ PRIVATE ptr rd_descr(type, count, pos) break; case 3: /* m initialized wordsize integers */ for (j = 0; j < count; j++) { - dt_stn(pos, rd_int(wsize), wsize); + dt_stw(pos, rd_int(wsize)); pos += wsize; } break; @@ -301,7 +301,7 @@ PRIVATE int rd_byte() { register int i; - if ((i = fgetc(load_fp)) == EOF) + if ((i = getc(load_fp)) == EOF) fatal("EOF reached during initialization"); return (i); } diff --git a/util/int/rsb.c b/util/int/rsb.c index fffe7232f..d70db6379 100644 --- a/util/int/rsb.c +++ b/util/int/rsb.c @@ -37,7 +37,7 @@ pushrsb(rsbcode) int rsbcode; { /* fill Return Status Block */ - st_inc(rsbsize); + incSP((size)rsbsize); st_stdp(SP + rsb_FIL, getFIL()); st_prot(SP + rsb_FIL, psize); @@ -54,7 +54,7 @@ pushrsb(rsbcode) st_stn(SP + rsb_PI, PI, psize); st_prot(SP + rsb_PI, psize); - st_stn(SP + rsb_rsbcode, (long)rsbcode, wsize); + st_stw(SP + rsb_rsbcode, (long)rsbcode); st_prot(SP + rsb_rsbcode, wsize); newLB(SP); @@ -83,7 +83,7 @@ int poprsb(rtt) newSP(LB); /* get RSB code and test it for applicability */ - rsbcode = st_ldu(SP + rsb_rsbcode, wsize); + rsbcode = st_lduw(SP + rsb_rsbcode); if ((rsbcode & RSBMASK) != RSBCODE) /* no RSB at all */ return rsbcode; diff --git a/util/int/stack.c b/util/int/stack.c index 01ca81e01..6ec240cf4 100644 --- a/util/int/stack.c +++ b/util/int/stack.c @@ -53,6 +53,8 @@ init_stack() { ************************************************************************ * * * newSP(p) - check and adjust StackPointer. * + * incSP(n) - increment stack pointer. n already checked * + * decSP(n) - decrement stack pointer. n already checked * * newLB(p) - check and adjust Local Base and Actual Base * * * ************************************************************************/ @@ -102,6 +104,43 @@ newSP(ap) SP = p; } +incSP(n) +#ifdef LOGGING + register +#endif + size n; +{ + register ptr p = SP - n; + + if (p < HP || maxstack || p < SL) newSP(p); + else { + LOG(("@s6 newSP(%lu), ML = %lu, SP = %lu", p, ML, SP)); +#ifdef LOGGING + /* inline version of st_clear_area. + */ + SP = p; + { + while (n--) { + st_undef(p); + p++; + } + } +#endif + } +} + +decSP(n) + size n; +{ + register ptr p = SP + n; + + if (LB < p) newSP(p); + else { + LOG(("@s6 newSP(%lu), ML = %lu, SP = %lu", p, ML, SP)); + SP = p; + } +} + newLB(p) ptr p; { @@ -126,6 +165,7 @@ newLB(p) * st_stdp(addr, p) - STore Data Pointer. * * st_stip(addr, p) - STore Instruction Pointer. * * st_stn(addr, l, n) - STore N byte integer. * + * st_stw(addr, l) - STore wordsize integer. * * st_stf(addr, f, n) - STore Floating point number. * * * ************************************************************************/ @@ -194,6 +234,32 @@ st_stn(addr, al, n) } } +st_stw(addr, al) + register ptr addr; + long al; +{ + register int i; + register long l = al; +#ifdef LOGGING + /* a psize zero is ambiguous */ + int sh_flags = (l == 0 && wsize == psize) ? (SH_INT|SH_DATAP) : SH_INT; +#endif + + LOG(("@s6 st_stw(%lu, %ld)", addr, l)); + ch_w_in_stack(addr); + ch_wordaligned(addr); + + /* store the bytes */ + for (i = (int) wsize; i > 0; i--, addr++) { + ch_st_prot(addr); + stack_loc(addr) = (char) l; +#ifdef LOGGING + st_sh(addr) = sh_flags; +#endif LOGGING + l = l>>8; + } +} + #ifndef NOFLOAT st_stf(addr, f, n) register ptr addr; @@ -226,7 +292,9 @@ st_stf(addr, f, n) * st_lddp(addr) - LoaD Data Pointer from stack. * * st_ldip(addr) - LoaD Instruction Pointer from stack. * * st_ldu(addr, n) - LoaD n Unsigned bytes from stack. * + * st_lduw(addr) - LoaD wsize Unsigned bytes from stack. * * st_lds(addr, n) - LoaD n Signed bytes from stack. * + * st_ldsw(addr) - LoaD wsize Signed bytes from stack. * * st_ldf(addr, n) - LoaD Floating point number from stack. * * * ************************************************************************/ @@ -291,13 +359,39 @@ unsigned long st_ldu(addr, n) } #endif LOGGING - for (i = (int) n-1; i >= 0; i--) { - u = (u<<8) | (btou(stack_loc(addr + i))); + addr += n-1; + for (i = (int) n-1; i >= 0; i--, addr--) { + u = (u<<8) | (btou(stack_loc(addr))); } LOG(("@s6 st_ldu() returns %ld", u)); return (u); } +unsigned long st_lduw(addr) + register ptr addr; +{ + register int i; + register unsigned long u = 0; + + LOG(("@s6 st_lduw(%lu)", addr)); + + ch_w_in_stack(addr); + ch_wordaligned(addr); +#ifdef LOGGING + if (!is_st_set(addr, wsize, SH_INT)) { + warning(WLIEXP); + warn_stbits(addr, wsize); + } +#endif LOGGING + + addr += wsize - 1; + for (i = (int) wsize-1; i >= 0; i--, addr--) { + u = (u<<8) | (btou(stack_loc(addr))); + } + LOG(("@s6 st_lduw() returns %ld", u)); + return (u); +} + long st_lds(addr, n) register ptr addr; size n; @@ -316,14 +410,41 @@ long st_lds(addr, n) } #endif LOGGING - l = btos(stack_loc(addr + n - 1)); - for (i = n - 2; i >= 0; i--) { - l = (l<<8) | btol(stack_loc(addr + i)); + addr += n - 2; + l = btos(stack_loc(addr + 1)); + for (i = n - 2; i >= 0; i--, addr--) { + l = (l<<8) | btol(stack_loc(addr)); } LOG(("@s6 st_lds() returns %ld", l)); return (l); } +long st_ldsw(addr) + register ptr addr; +{ + register int i; + register long l; + + LOG(("@s6 st_ldsw(%lu)", addr)); + + ch_w_in_stack(addr); + ch_wordaligned(addr); +#ifdef LOGGING + if (!is_st_set(addr, wsize, SH_INT)) { + warning(WLIEXP); + warn_stbits(addr, wsize); + } +#endif LOGGING + + addr += wsize - 2; + l = btos(stack_loc(addr+1)); + for (i = wsize - 2; i >= 0; i--, addr--) { + l = (l<<8) | btol(stack_loc(addr)); + } + LOG(("@s6 st_ldsw() returns %ld", l)); + return (l); +} + #ifndef NOFLOAT double st_ldf(addr, n) register ptr addr; @@ -425,9 +546,13 @@ st_mvd(s, d, n) /* d -> s */ * * * dppop() - pop a data ptr, return a ptr. * * upop(n) - pop n unsigned bytes, return a long. * + * uwpop() - pop wsize unsigned bytes, return a long. * * spop(n) - pop n signed bytes, return a long. * + * swpop() - pop wsize signed bytes, return a long. * * pop_dt(d, n) - pop n bytes, store at address d in data. * + * popw_dt(d) - pop wsize bytes, store at address d in data. * * pop_st(s, n) - pop n bytes, store at address s in stack. * + * popw_st(s) - pop wsize bytes, store at address s in stack. * * fpop() - pop a floating point number. * * wpop() - pop a signed word, don't care about any type. * * * @@ -438,7 +563,7 @@ ptr dppop() register ptr p; p = st_lddp(SP); - st_dec(psize); + decSP(psize); LOG(("@s7 dppop(), return: %lu", p)); return (p); } @@ -449,22 +574,42 @@ unsigned long upop(n) register unsigned long l; l = st_ldu(SP, n); - st_dec(max(n, wsize)); + decSP(max(n, wsize)); LOG(("@s7 upop(), return: %lu", l)); return (l); } +unsigned long uwpop() +{ + register unsigned long l; + + l = st_lduw(SP); + decSP(wsize); + LOG(("@s7 uwpop(), return: %lu", l)); + return (l); +} + long spop(n) size n; { register long l; l = st_lds(SP, n); - st_dec(max(n, wsize)); + decSP(max(n, wsize)); LOG(("@s7 spop(), return: %ld", l)); return (l); } +long swpop() +{ + register long l; + + l = st_ldsw(SP); + decSP(wsize); + LOG(("@s7 swpop(), return: %ld", l)); + return (l); +} + pop_dt(d, n) ptr d; size n; @@ -473,10 +618,17 @@ pop_dt(d, n) dt_stn(d, (long) upop(n), n); else { dt_mvs(d, SP, n); - st_dec(n); + decSP(n); } } +popw_dt(d) + ptr d; +{ + dt_mvs(d, SP, wsize); + decSP(wsize); +} + pop_st(s, n) ptr s; size n; @@ -485,10 +637,17 @@ pop_st(s, n) st_stn(s, (long) upop(n), n); else { st_mvs(s, SP, n); - st_dec(n); + decSP(n); } } +popw_st(s) + ptr s; +{ + st_mvs(s, SP, wsize); + decSP(wsize); +} + #ifndef NOFLOAT double fpop(n) size n; @@ -496,7 +655,7 @@ double fpop(n) double d; d = st_ldf(SP, n); - st_dec(n); + decSP(n); return (d); } #endif NOFLOAT @@ -506,7 +665,7 @@ long wpop() register long l; l = w_in_stack(SP); - st_dec(wsize); + decSP(wsize); return (l); } @@ -518,7 +677,9 @@ long wpop() * wpush(l) - push a word, load from l. * * npush(l, n) - push n bytes, load from l. * * push_dt(d, n) - push n bytes, load from address d in data. * + * pushw_dt(d) - push wsize bytes, load from address d in data.* * push_st(s, n) - push n bytes, load from address s in stack. * + * pushw_st(s) - push wsize bytes, load from address s in stack.* * fpush(f, n) - push a floating point number, of size n. * * * ************************************************************************/ @@ -526,31 +687,31 @@ long wpop() dppush(p) ptr p; { - st_inc(psize); + incSP(psize); st_stdp(SP, p); } wpush(l) long l; { - st_inc(wsize); - st_stn(SP, l, wsize); + incSP(wsize); + st_stw(SP, l); } npush(l, n) register long l; - size n; + register size n; { - size m = max(n, wsize); - - st_inc(m); - if (n == 1) - l &= MASK1; - else - if (n == 2) - l &= MASK2; - st_stn(SP, l, m); - + if (n <= wsize) { + incSP(wsize); + if (n == 1) l &= MASK1; + else if (n == 2) l &= MASK2; + st_stw(SP, l); + } + else { + incSP(n); + st_stn(SP, l, n); + } } push_dt(d, n) @@ -561,11 +722,18 @@ push_dt(d, n) npush((long) dt_ldu(d, n), n); } else { - st_inc(n); + incSP(n); st_mvd(SP, d, n); } } +pushw_dt(d) + ptr d; +{ + incSP(wsize); + st_mvd(SP, d, wsize); +} + push_st(s, n) ptr s; size n; @@ -574,17 +742,24 @@ push_st(s, n) npush((long) st_ldu(s, n), n); } else { - st_inc(n); + incSP(n); st_mvs(SP, s, n); } } +pushw_st(s) + ptr s; +{ + incSP(wsize); + st_mvs(SP, s, wsize); +} + #ifndef NOFLOAT fpush(f, n) double f; size n; { - st_inc(n); + incSP(n); st_stf(SP, f, n); } #endif NOFLOAT