Home » Archimedes archive » Zipped Apps » BCPL » BCPL/b/cgb
BCPL/b/cgb
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Zipped Apps » BCPL |
Filename: | BCPL/b/cgb |
Read OK: | ✔ |
File size: | 38A6 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
SECTION "CGB" GET "b.CGheader" STATIC { /* Version of 07 Feb 86 11:03:42 */ dummy = VersionMark; version = 1*256+7 }; // 1.5 05 Nov 85 10:02:04 // Temporary removal of 'no RL' optimisation if just no static use // 1.6 23 Jan 86 11:49:14 // Optimisation which used to say "If a call is of a local procedure // which uses no frame, no need to set up RTS" to add "and contains no // calls" (exit calls do not need a frame, but the called procedure may // use one). // 1.7 07 Feb 86 11:03:01 // Improvement of algorithm for discard of pending stores to stack frame // on exit call. STATIC { swr=0; swd=0; casek=0; casel=0 }; LET CGSwitch(n) BE { LET a = GetVec(2*n); LET b = a+n; swd := ReadL(); casek, casel := a, b; FOR i = 1 TO n DO { LET a = ReadN(); LET l = ReadL(); LET j = i-1; WHILE j~=0 DO { IF a>casek!j THEN BREAK; casek!(j+1) := casek!j; casel!(j+1) := casel!j; j := j-1 }; casek!(j+1), casel!(j+1) := a, l }; Store(0, ssp-2); swr := MoveToAnyR(arg1); InitStack(ssp-1); // care with overflow!! TEST 0<=16+casek!n-casek!1<5*n THEN LabVecSwitch(1, n) ELSE { BinTreeSwitch(1, n); Jump(swd) }; DeadCode := Dead } AND LabVecSwitch(p, q) BE { LET min, max = casek!p, casek!q; IF min=1 THEN min := 0; IF min~=0 THEN DiscardReg(swr, k.reg); GenF1K(f.subs, swr, swr, min); CondJump(m.lt, swd); GenF1K(f.cmps, 0, swr, max-min); CondJump(m.gt, swd); FlushPendingInsts(Null, FALSE); F2Inst(f.ldr, r.pc, r.pc, 0, swr, f.preup, sh.asl, 2, m.always); PutWord(0); FOR k = min TO max DO { LET lab = ?; TEST casek!p=k THEN { lab := casel!p; SaveStateForLab(lab); p := p+1 } ELSE lab := swd; lab := TransferredLabel(lab); IF lab=0 THEN lab := exitLab; AddRelocatedLoc(locCtr, lab); AddressInCode(lab, 0) } } AND BinTreeSwitch(p, q) BE TEST q-p>6 THEN { LET m = NextLabel(); LET t = (p+q)/2; CaseCompare(t); CondJump(m.gt, m); CondJump(m.eq, casel!t); BinTreeSwitch(p, t-1); CondJump(m.always, swd); FlushPendingInsts(Null, FALSE); SetLabel(m); BinTreeSwitch(t+1, q) } ELSE FOR i = p TO q DO { CaseCompare(i); CondJump(m.eq, casel!i) } AND CaseCompare(i) BE { LET n = casek!i; TEST n<0 THEN GenF1K(f.cmns, 0, swr, -n) ELSE GenF1K(f.cmps, 0, swr, n) } AND CGEntry(n, m) BE { LET p = 0; { LET w = VEC 256/BytesPerWord; LET v = VEC 1; LET k = sectionName%0; FOR i = 1 TO k DO w%i := sectionName%i; k := k+1; w%k := '.'; FOR i = 1 TO n DO { LET c = ReadN(); w%(i+k) := c; IF i<=7 THEN v%i := c }; w%0 := n+k; FOR i = n+1 TO 7 DO v%i := '*s'; v%0 := 7; AddressInCode(staticDataLab, 0); IF procNames THEN { TEST naming THEN { p := procLabel; procLabel := NextLabel(); AddressInCode(procLabel, locCtr) } ELSE PutWord(-1); PutWord(v!0); PutWord(v!1) }; AddXSymbol(w, 1, m); base!0, base!1 := baseLab, baseAddr; { LET f = 0; IF localsSafe THEN f := f+1; IF usesFrame THEN f := f+2; IF containsCalls THEN f := f+4; IF usesRL THEN f := f+8; IF linkageNotStored THEN TEST linkageNotStored=r.b THEN f := f+16 ELSE f := f+32; base!2 := f }; base := base+3; baseLab, baseAddr := m, locCtr; localsSafe := ~LabelFlagged(m, lab.lvptaken); usesFrame := LabelFlagged(m, lab.frameneeded); containsCalls := LabelFlagged(m, lab.prochascalls); usesRL := usesFrame | LabelFlagged(m, lab.procstatics); IF CGDebugMode~=0 THEN { WriteF("****** %s", v); IF ~usesFrame THEN WriteS(" - no frame"); IF ~containsCalls THEN WriteS(" - no calls"); IF localsSafe THEN WriteS(" - locals safe"); WriteS(" *******n") }; SetLabel(m) }; DiscardRegs(); deadCode := Alive; IF naming THEN { LET n, b = namel, blockLabel; namel, blockLabel := namet, -1; op := ReadOp(); Scan() namet := namel; namel, blockLabel, procLabel := n, b, p } } AND CGSave(n) BE { LET a = 1+n-saveSpaceSize-1; LET regset = 0; IF a>4 THEN a, usesFrame := 4, TRUE; linkageNotStored := FALSE; TEST counting | callCounting THEN { usesFrame := TRUE; InsertCount(sr.entrycount) } ELSE IF usesFrame THEN { LET r = reversedStack -> (TABLE r.14, r.l, r.p, r.b), saveSpaceSize=4 -> (TABLE r.b, r.p, r.l, r.14), (TABLE r.p, r.l, r.14); linkageNotStored := TRUE; IF saveSpaceSize=4 THEN { // The only point in saving RB at all is to allow // diagnostic programs easily to see to whom stack // frames belong. If, therefore, it looks as though // a procedure will be called by direct BL, we must // take steps to ensure that the stored RB is right. LET p = Assoc(baseLab, 2, staticLabels); IF p~=Null & LabelFlagged(p!1, lab.called) THEN linkageNotStored := r.b }; FOR i = 0 TO saveSpaceSize-1 DO AddToPendingStores(r!i, k.loc, i, TRUE, 0) }; TOSOffset := saveSpaceSize; InitStack(n) TEST ~usesFrame & ~containsCalls & a<=3 THEN FOR r = 1 TO 3 DO { LET n = TOSOffset+r-1; LET s = ArgumentRegister(r); DedicateRegisterToLoc(s, n); IF r<=a THEN MoveSToR(k.reg, s, k.loc, n) } ELSE FOR r = 1 TO a DO { LET s = ArgumentRegister(r); MoveStoR(k.reg, s, k.loc, TOSOffset) AddToPendingStores(s, k.loc, TOSOffset, TRUE, 0); TOSoffset := TOSOffset+1 } } AND CheckRLLoaded() = VALOF TEST ~usesRL THEN RESULTIS r.pc ELSE { IF linkageNotStored THEN FlushPendingUsesOfReg(r.l); IF linkageNotStored THEN { RLLoadList := FillBlk(2, RLLoadList, locCtr); GenF2(f.ldr, r.0, r.pc, 0, ValueOfLabel(baseLab)-12-locCtr-(procNames->12,0)); RESULTIS r.0 }; RESULTIS r.l } AND CGApply(callType, k) BE TEST XSymInStatic(arg1)~=Null THEN CGApplyX(callType, k) ELSE { LET argbase = k+saveSpaceSize; LET tempbase = h5!tempv-argbase; LET rmin, rmax = 1+tempbase, 1+h5!arg2-argbase; LET argmax = rmax; LET exitCall = FALSE; LET stackAtEnd = k; LET procLab = Null; IF rmin<1 THEN rmin := 1; IF rmax>4 THEN rmax := 4; op := ReadOp(); WHILE op=s.stack DO { stackAtEnd := ReadN(); op := ReadOp() }; IF rmax=argmax & // you can't have exit calls with more arguments than are passed // in registers (or rather you can, but they're tricky to handle) localsSafe THEN // If an argument may be a pointer into this procedure's frame, // we'd better not compile an exit call (which would throw away // the frame) TEST op=s.fnrn | op=s.rtrn THEN { op := ReadOp(); exitCall := TRUE } ELSE IF (op=s.res | op=s.jump | op=s.lab) & TransferredLabel(PeekN())=0 THEN { ReadN(); op := ReadOp(); exitCall := TRUE }; FOR r = rmin TO rmax DO IF Using(r) THEN Lock(ArgumentRegister(r), k.reg); IF argmax>5 THEN { LET n = k+4+saveSpaceSize; FlushPendingStores(); SetRtoRplusK(r.ts, r.p, nextStackWord*n); TOSOffset := n }; Store(argbase+4, ssp-2); FOR t = tempv TO arg2 BY sssize DO { LET s = h5!t; IF s>k THEN BREAK; IF h1!t=k.reg THEN StoreT(t) }; FOR r = rmin TO rmax DO Lock(ArgumentRegister(r), k.reg); IF h1!arg1=k.reg & h3!arg1<=rmax THEN { MoveToR(r.w1, arg1); Lock(r.w1, k.reg) }; IF exitCall THEN { /* Construct a list of the frame values which are needed in loading values of arguments. Pending stores to other locations in the frame may then be discarded */ LET p = 0; FOR r = 1 TO rmax DO { LET l = argbase+r-1; TEST l<(argbase+tempbase) THEN p := FillBlk(2, p, l) ELSE { l := tempv+sssize*(l-tempbase-argbase); IF h1!l=k.loc THEN { LET s = LookFor(l, NotAddr); IF s=Null | s>r THEN p := FillBlk(2, p, h3!l) } } }; IF linkageNotStored THEN FOR i = 0 TO saveSpaceSize-1 DO p := FillBlk(2, p, i); DelLocsExcept(p); WHILE p~=0 DO { LET q = !p; FreeBlk(p, 2); p := q } } loadRegFromFRegOK := TRUE; FOR t = arg2 TO tempv BY -sssize DO { LET r = r.a1+h5!t-argbase; IF r<rmin THEN BREAK; TEST r<=rmax THEN { LET n = ArgumentRegister(r); MoveToRSomeTime(n, t) } ELSE StoreT(t) }; loadRegFromFRegOK := FALSE; FlushPendingLoads(); IF exitCall THEN DelLocsAbove(0, TRUE); FlushPendingStores(); procLab := LabelInStatic(arg1); TEST exitCall THEN TOSOffset := -1 ELSE IF k~=TOSOffset & (procLab=Null | LabelFlagged(procLab, lab.frameneeded) | LabelFlagged(procLab, lab.prochascalls)) THEN { SetRtoRplusK(r.ts, r.p, nextStackWord*k); TOSOffset := k }; IF tempbase>0 THEN { LET r = 1+tempbase-1; LET offset = nextStackWord*(k+saveSpaceSize); IF r>4 THEN r := 4; TEST r=1 THEN GenF2(f.ldr, ArgumentRegister(1), r.p, 0, offset) ELSE { LET regset = 0; SetRtoRplusK(r.0, r.p, offset); FOR s = 1 TO r DO regset := regset+(1<<ArgumentRegister(s)); F4Inst(f.ldm, r.0, regset, upStack) } }; TEST procLab~=Null THEN TEST exitCall THEN { IF usesFrame & ~linkageNotStored THEN { LET ldmType = reversedStack | saveSpaceSize=3 -> upStack, upStack+f.pre; GenRR(f.mov, r.ts, 0, r.p); F4Inst(f.ldm, r.p, f4.pl14, ldmType) }; Jump(procLab) } ELSE F5InstL(m.always, procLab, f.bl) ELSE TEST ~usesFrame | linkageNotStored THEN TEST rbInCalls THEN { // must be an exit call. MoveToR(r.b, arg1); GenRR(f.mov, r.pc, r.pc, r.b) // The second r.pc distinguishes this as an // exit call. } ELSE MoveToR(r.pc, arg1) ELSE TEST compactCode THEN TEST exitCall THEN { MoveToR(r.b, arg1); CondJump(m.always, exitCallLab) } ELSE { MoveToR(r.b, arg1); F5InstL(m.always, CallLab, f.bl) } ELSE TEST exitCall THEN { LET ldmtype = reversedStack | saveSpaceSize=3 -> upStack, upStack+f.pre; LET directCall = TRUE; IF rbInCalls | (h1!arg1~=k.reg & h1!arg1~=k.glob) THEN { MoveToR(r.b, arg1); directCall := FALSE }; GenRR(f.mov, r.ts, 0, r.p); F4Inst(f.ldm, r.p, f4.pl14, ldmType); TEST directCall THEN MoveToR(r.pc, arg1) ELSE GenRR(f.mov, r.pc, r.pc, r.b) } ELSE { LET directCall = TRUE; IF rbInCalls | (h2!arg1>=0 | h4!arg1~=0) THEN { MoveToR(r.b, arg1); directCall := FALSE }; GenRR(f.mov, r.14, 0, r.pc) TEST directCall THEN MoveToR(r.pc, arg1) ELSE GenRR(f.mov, r.pc, 0, r.b) }; DiscardRegs(); TEST exitCall THEN { InitStack(stackAtEnd); deadCode := Dead } ELSE { Stack(k); IF callType=s.fnap THEN Load(k.reg, ArgumentRegister(1)); IF stackAtEnd~=k THEN Stack(stackAtEnd) } } AND CGApplyX(callType, k) BE { LET argbase = k+saveSpaceSize; LET tempbase = h5!tempv-argbase; LET rmin, rmax = 1+tempbase, 1+h5!arg2-argbase; LET argmax = rmax; LET stackAtEnd = k; LET procLab = Null; LET xsym = XSymInStatic(arg1); LET bcplContext = 0; IF rmin<1 THEN rmin := 1; IF rmax>4 THEN rmax := 4; op := ReadOp(); WHILE op=s.stack DO { stackAtEnd := ReadN(); op := ReadOp() }; FOR r = rmin TO rmax DO IF Using(r-1) THEN Lock(r-1, k.reg); IF argmax>5 THEN { LET n = k+4+saveSpaceSize; FlushPendingStores(); SetRtoRplusK(r.ts, r.p, nextStackWord*n); TOSOffset := n }; Store(argbase+4, ssp-2); FOR t = tempv TO arg2 BY sssize DO { LET s = h5!t; IF s>k THEN BREAK; IF h1!t=k.reg THEN StoreT(t) }; FOR r = rmin TO rmax DO Lock(r-1, k.reg); loadRegFromFRegOK := TRUE; FOR t = arg2 TO tempv BY -sssize DO { LET r = r.a1+h5!t-argbase; IF r<rmin THEN BREAK; TEST r<=rmax THEN { LET n = r-1; MoveToRSomeTime(n, t) } ELSE StoreT(t) }; loadRegFromFRegOK := FALSE; FlushPendingLoads(); FlushPendingStores(); IF k~=TOSOffset THEN { SetRtoRplusK(r.ts, r.p, nextStackWord*k); TOSOffset := k }; IF tempbase>0 THEN { LET r = 1+tempbase-1; LET offset = nextStackWord*(k+saveSpaceSize); IF r>4 THEN r := 4; TEST r=1 THEN GenF2(f.ldr, r.0, r.p, 0, offset) ELSE { LET regset = 0; SetRtoRplusK(r.0, r.p, offset); FOR s = 1 TO r DO regset := regset+(1<<(s-1)); F4Inst(f.ldm, r.0, regset, upStack) } }; // The arguments are in the right registers; it remains to // save the BCPL context // restore the "Modula" context // copy over arguments above 4 // There's guaranteed space to store the BCPL context, where the called // procedure would save its linkage if it were a BCPL one. There only // could be any problem if the procedure has more than four arguments. // It's a bit silly doing the save in store if there's only one register // that's important { LET stmType = reversedStack -> f.postdown, f.postup; bcplContext := (1<<r.p)+(1<<r.nil); IF usesRl THEN bcplContext := bcplContext+(1<<r.l); IF linkageNotStored THEN bcplContext := bcplContext|((1<<r.l)+(1<<r.14)); F4Inst(f.stm, r.ts, bcplContext, stmType); GenRR(f.mov, 4, 0, r.ts) } GenF1K(f.sub, 5, r.g, 80); F4Inst(f.ldm, 5, (1<<10)+(1<<12)+(1<<13), f.postup); // Copy over arguments. We don't need to worry about the linkageNotStored // case: it can't happen if we need to copy. // Falling stacks not supported !!!!! TEST argmax=5 THEN { GenF2(f.ldr, 5, r.ts, 0, nextStackWord*(saveSpaceSize+4)); F4Inst(f.stm, 12, 1<<5, f.predown+f.wb) } ELSE IF argmax>5 THEN { LET n = argmax-4; SetRToRPlusK(r.ts, r.ts, nextStackWord*(saveSpaceSize+argMax)); WHILE n>0 DO { LET regSet = n=1 -> (1<<5), n=2 -> (1<<5)+(1<<8), (1<<5)+(1<<8)+(1<<14); F4Inst(f.ldm, r.ts, regSet, f.predown); F4Inst(f.stm, 12, regSet, f.predown+f.wb); n := n-3 } }; F5InstX(f.bl, AddXSymbol(xsym, 0, 0), m.always); IF callType=s.fnap THEN GenRR(f.mov, ArgumentRegister(1), 0, r.0); { LET ldmType = reversedStack -> f.postdown, f.postup; F4Inst(f.ldm, 4, bcplContext, ldmType) } DiscardRegs(); Stack(k); IF callType=s.fnap THEN Load(k.reg, ArgumentRegister(1)); IF stackAtEnd~=k THEN Stack(stackAtEnd); tosOffset := Null }
00000000 53 45 43 54 49 4f 4e 20 22 43 47 42 22 0a 0a 47 |SECTION "CGB"..G| 00000010 45 54 20 22 62 2e 43 47 68 65 61 64 65 72 22 0a |ET "b.CGheader".| 00000020 0a 53 54 41 54 49 43 20 7b 0a 2f 2a 20 56 65 72 |.STATIC {./* Ver| 00000030 73 69 6f 6e 20 6f 66 20 30 37 20 46 65 62 20 38 |sion of 07 Feb 8| 00000040 36 20 31 31 3a 30 33 3a 34 32 0a 20 2a 2f 0a 20 |6 11:03:42. */. | 00000050 20 20 64 75 6d 6d 79 20 3d 20 56 65 72 73 69 6f | dummy = Versio| 00000060 6e 4d 61 72 6b 3b 0a 20 20 20 76 65 72 73 69 6f |nMark;. versio| 00000070 6e 20 3d 20 31 2a 32 35 36 2b 37 20 7d 3b 0a 0a |n = 1*256+7 };..| 00000080 2f 2f 20 31 2e 35 09 30 35 20 4e 6f 76 20 38 35 |// 1.5.05 Nov 85| 00000090 20 31 30 3a 30 32 3a 30 34 0a 2f 2f 20 20 20 54 | 10:02:04.// T| 000000a0 65 6d 70 6f 72 61 72 79 20 72 65 6d 6f 76 61 6c |emporary removal| 000000b0 20 6f 66 20 27 6e 6f 20 52 4c 27 20 6f 70 74 69 | of 'no RL' opti| 000000c0 6d 69 73 61 74 69 6f 6e 20 69 66 20 6a 75 73 74 |misation if just| 000000d0 20 6e 6f 20 73 74 61 74 69 63 20 75 73 65 0a 2f | no static use./| 000000e0 2f 20 31 2e 36 09 32 33 20 4a 61 6e 20 38 36 20 |/ 1.6.23 Jan 86 | 000000f0 31 31 3a 34 39 3a 31 34 0a 2f 2f 20 20 20 4f 70 |11:49:14.// Op| 00000100 74 69 6d 69 73 61 74 69 6f 6e 20 77 68 69 63 68 |timisation which| 00000110 20 75 73 65 64 20 74 6f 20 73 61 79 20 22 49 66 | used to say "If| 00000120 20 61 20 63 61 6c 6c 20 69 73 20 6f 66 20 61 20 | a call is of a | 00000130 6c 6f 63 61 6c 20 70 72 6f 63 65 64 75 72 65 0a |local procedure.| 00000140 2f 2f 20 20 20 77 68 69 63 68 20 75 73 65 73 20 |// which uses | 00000150 6e 6f 20 66 72 61 6d 65 2c 20 6e 6f 20 6e 65 65 |no frame, no nee| 00000160 64 20 74 6f 20 73 65 74 20 75 70 20 52 54 53 22 |d to set up RTS"| 00000170 20 74 6f 20 61 64 64 20 22 61 6e 64 20 63 6f 6e | to add "and con| 00000180 74 61 69 6e 73 20 6e 6f 0a 2f 2f 20 20 20 63 61 |tains no.// ca| 00000190 6c 6c 73 22 20 28 65 78 69 74 20 63 61 6c 6c 73 |lls" (exit calls| 000001a0 20 64 6f 20 6e 6f 74 20 6e 65 65 64 20 61 20 66 | do not need a f| 000001b0 72 61 6d 65 2c 20 62 75 74 20 74 68 65 20 63 61 |rame, but the ca| 000001c0 6c 6c 65 64 20 70 72 6f 63 65 64 75 72 65 20 6d |lled procedure m| 000001d0 61 79 0a 2f 2f 20 20 20 75 73 65 20 6f 6e 65 29 |ay.// use one)| 000001e0 2e 0a 2f 2f 20 31 2e 37 09 30 37 20 46 65 62 20 |..// 1.7.07 Feb | 000001f0 38 36 20 31 31 3a 30 33 3a 30 31 0a 2f 2f 20 20 |86 11:03:01.// | 00000200 20 49 6d 70 72 6f 76 65 6d 65 6e 74 20 6f 66 20 | Improvement of | 00000210 61 6c 67 6f 72 69 74 68 6d 20 66 6f 72 20 64 69 |algorithm for di| 00000220 73 63 61 72 64 20 6f 66 20 70 65 6e 64 69 6e 67 |scard of pending| 00000230 20 73 74 6f 72 65 73 20 74 6f 20 73 74 61 63 6b | stores to stack| 00000240 20 66 72 61 6d 65 0a 2f 2f 20 20 20 6f 6e 20 65 | frame.// on e| 00000250 78 69 74 20 63 61 6c 6c 2e 0a 0a 53 54 41 54 49 |xit call...STATI| 00000260 43 20 7b 20 73 77 72 3d 30 3b 20 73 77 64 3d 30 |C { swr=0; swd=0| 00000270 3b 20 63 61 73 65 6b 3d 30 3b 20 63 61 73 65 6c |; casek=0; casel| 00000280 3d 30 20 7d 3b 0a 0a 4c 45 54 20 43 47 53 77 69 |=0 };..LET CGSwi| 00000290 74 63 68 28 6e 29 20 42 45 20 7b 0a 20 20 20 4c |tch(n) BE {. L| 000002a0 45 54 20 61 20 3d 20 47 65 74 56 65 63 28 32 2a |ET a = GetVec(2*| 000002b0 6e 29 3b 0a 20 20 20 4c 45 54 20 62 20 3d 20 61 |n);. LET b = a| 000002c0 2b 6e 3b 0a 20 20 20 73 77 64 20 3a 3d 20 52 65 |+n;. swd := Re| 000002d0 61 64 4c 28 29 3b 0a 0a 20 20 20 63 61 73 65 6b |adL();.. casek| 000002e0 2c 20 63 61 73 65 6c 20 3a 3d 20 61 2c 20 62 3b |, casel := a, b;| 000002f0 0a 0a 20 20 20 46 4f 52 20 69 20 3d 20 31 20 54 |.. FOR i = 1 T| 00000300 4f 20 6e 20 44 4f 0a 20 20 20 7b 20 20 4c 45 54 |O n DO. { LET| 00000310 20 61 20 3d 20 52 65 61 64 4e 28 29 3b 0a 20 20 | a = ReadN();. | 00000320 20 20 20 20 4c 45 54 20 6c 20 3d 20 52 65 61 64 | LET l = Read| 00000330 4c 28 29 3b 0a 20 20 20 20 20 20 4c 45 54 20 6a |L();. LET j| 00000340 20 3d 20 69 2d 31 3b 0a 0a 20 20 20 20 20 20 57 | = i-1;.. W| 00000350 48 49 4c 45 20 6a 7e 3d 30 20 44 4f 0a 20 20 20 |HILE j~=0 DO. | 00000360 20 20 20 7b 20 20 49 46 20 61 3e 63 61 73 65 6b | { IF a>casek| 00000370 21 6a 20 54 48 45 4e 20 42 52 45 41 4b 3b 0a 09 |!j THEN BREAK;..| 00000380 20 63 61 73 65 6b 21 28 6a 2b 31 29 20 3a 3d 20 | casek!(j+1) := | 00000390 63 61 73 65 6b 21 6a 3b 0a 09 20 63 61 73 65 6c |casek!j;.. casel| 000003a0 21 28 6a 2b 31 29 20 3a 3d 20 63 61 73 65 6c 21 |!(j+1) := casel!| 000003b0 6a 3b 0a 09 20 6a 20 3a 3d 20 6a 2d 31 20 7d 3b |j;.. j := j-1 };| 000003c0 0a 0a 20 20 20 20 20 20 63 61 73 65 6b 21 28 6a |.. casek!(j| 000003d0 2b 31 29 2c 20 63 61 73 65 6c 21 28 6a 2b 31 29 |+1), casel!(j+1)| 000003e0 20 3a 3d 20 61 2c 20 6c 20 7d 3b 0a 0a 20 20 20 | := a, l };.. | 000003f0 53 74 6f 72 65 28 30 2c 20 73 73 70 2d 32 29 3b |Store(0, ssp-2);| 00000400 0a 20 20 20 73 77 72 20 3a 3d 20 4d 6f 76 65 54 |. swr := MoveT| 00000410 6f 41 6e 79 52 28 61 72 67 31 29 3b 0a 20 20 20 |oAnyR(arg1);. | 00000420 49 6e 69 74 53 74 61 63 6b 28 73 73 70 2d 31 29 |InitStack(ssp-1)| 00000430 3b 0a 0a 20 20 20 2f 2f 20 63 61 72 65 20 77 69 |;.. // care wi| 00000440 74 68 20 6f 76 65 72 66 6c 6f 77 21 21 0a 20 20 |th overflow!!. | 00000450 20 54 45 53 54 20 30 3c 3d 31 36 2b 63 61 73 65 | TEST 0<=16+case| 00000460 6b 21 6e 2d 63 61 73 65 6b 21 31 3c 35 2a 6e 20 |k!n-casek!1<5*n | 00000470 54 48 45 4e 0a 20 20 20 20 20 20 4c 61 62 56 65 |THEN. LabVe| 00000480 63 53 77 69 74 63 68 28 31 2c 20 6e 29 0a 20 20 |cSwitch(1, n). | 00000490 20 45 4c 53 45 20 7b 0a 20 20 20 20 20 20 42 69 | ELSE {. Bi| 000004a0 6e 54 72 65 65 53 77 69 74 63 68 28 31 2c 20 6e |nTreeSwitch(1, n| 000004b0 29 3b 0a 20 20 20 20 20 20 4a 75 6d 70 28 73 77 |);. Jump(sw| 000004c0 64 29 20 7d 3b 0a 0a 20 20 20 44 65 61 64 43 6f |d) };.. DeadCo| 000004d0 64 65 20 3a 3d 20 44 65 61 64 20 7d 0a 0a 41 4e |de := Dead }..AN| 000004e0 44 20 4c 61 62 56 65 63 53 77 69 74 63 68 28 70 |D LabVecSwitch(p| 000004f0 2c 20 71 29 20 42 45 20 7b 0a 20 20 20 4c 45 54 |, q) BE {. LET| 00000500 20 6d 69 6e 2c 20 6d 61 78 20 3d 20 63 61 73 65 | min, max = case| 00000510 6b 21 70 2c 20 63 61 73 65 6b 21 71 3b 0a 0a 20 |k!p, casek!q;.. | 00000520 20 20 49 46 20 6d 69 6e 3d 31 20 54 48 45 4e 20 | IF min=1 THEN | 00000530 6d 69 6e 20 3a 3d 20 30 3b 0a 20 20 20 49 46 20 |min := 0;. IF | 00000540 6d 69 6e 7e 3d 30 20 54 48 45 4e 20 44 69 73 63 |min~=0 THEN Disc| 00000550 61 72 64 52 65 67 28 73 77 72 2c 20 6b 2e 72 65 |ardReg(swr, k.re| 00000560 67 29 3b 0a 0a 20 20 20 47 65 6e 46 31 4b 28 66 |g);.. GenF1K(f| 00000570 2e 73 75 62 73 2c 20 73 77 72 2c 20 73 77 72 2c |.subs, swr, swr,| 00000580 20 6d 69 6e 29 3b 0a 20 20 20 43 6f 6e 64 4a 75 | min);. CondJu| 00000590 6d 70 28 6d 2e 6c 74 2c 20 73 77 64 29 3b 0a 20 |mp(m.lt, swd);. | 000005a0 20 20 47 65 6e 46 31 4b 28 66 2e 63 6d 70 73 2c | GenF1K(f.cmps,| 000005b0 20 30 2c 20 73 77 72 2c 20 6d 61 78 2d 6d 69 6e | 0, swr, max-min| 000005c0 29 3b 0a 20 20 20 43 6f 6e 64 4a 75 6d 70 28 6d |);. CondJump(m| 000005d0 2e 67 74 2c 20 73 77 64 29 3b 0a 0a 20 20 20 46 |.gt, swd);.. F| 000005e0 6c 75 73 68 50 65 6e 64 69 6e 67 49 6e 73 74 73 |lushPendingInsts| 000005f0 28 4e 75 6c 6c 2c 20 46 41 4c 53 45 29 3b 0a 20 |(Null, FALSE);. | 00000600 20 20 46 32 49 6e 73 74 28 66 2e 6c 64 72 2c 20 | F2Inst(f.ldr, | 00000610 72 2e 70 63 2c 20 72 2e 70 63 2c 20 30 2c 20 73 |r.pc, r.pc, 0, s| 00000620 77 72 2c 20 66 2e 70 72 65 75 70 2c 20 73 68 2e |wr, f.preup, sh.| 00000630 61 73 6c 2c 20 32 2c 20 6d 2e 61 6c 77 61 79 73 |asl, 2, m.always| 00000640 29 3b 0a 20 20 20 50 75 74 57 6f 72 64 28 30 29 |);. PutWord(0)| 00000650 3b 0a 0a 20 20 20 46 4f 52 20 6b 20 3d 20 6d 69 |;.. FOR k = mi| 00000660 6e 20 54 4f 20 6d 61 78 20 44 4f 20 7b 0a 20 20 |n TO max DO {. | 00000670 20 20 20 20 4c 45 54 20 6c 61 62 20 3d 20 3f 3b | LET lab = ?;| 00000680 0a 20 20 20 20 20 20 54 45 53 54 20 63 61 73 65 |. TEST case| 00000690 6b 21 70 3d 6b 20 54 48 45 4e 20 7b 0a 09 20 6c |k!p=k THEN {.. l| 000006a0 61 62 20 3a 3d 20 63 61 73 65 6c 21 70 3b 0a 09 |ab := casel!p;..| 000006b0 20 53 61 76 65 53 74 61 74 65 46 6f 72 4c 61 62 | SaveStateForLab| 000006c0 28 6c 61 62 29 3b 0a 09 20 70 20 3a 3d 20 70 2b |(lab);.. p := p+| 000006d0 31 20 7d 0a 20 20 20 20 20 20 45 4c 53 45 0a 09 |1 }. ELSE..| 000006e0 20 6c 61 62 20 3a 3d 20 73 77 64 3b 0a 20 20 20 | lab := swd;. | 000006f0 20 20 20 6c 61 62 20 3a 3d 20 54 72 61 6e 73 66 | lab := Transf| 00000700 65 72 72 65 64 4c 61 62 65 6c 28 6c 61 62 29 3b |erredLabel(lab);| 00000710 0a 20 20 20 20 20 20 49 46 20 6c 61 62 3d 30 20 |. IF lab=0 | 00000720 54 48 45 4e 20 6c 61 62 20 3a 3d 20 65 78 69 74 |THEN lab := exit| 00000730 4c 61 62 3b 0a 20 20 20 20 20 20 41 64 64 52 65 |Lab;. AddRe| 00000740 6c 6f 63 61 74 65 64 4c 6f 63 28 6c 6f 63 43 74 |locatedLoc(locCt| 00000750 72 2c 20 6c 61 62 29 3b 0a 20 20 20 20 20 20 41 |r, lab);. A| 00000760 64 64 72 65 73 73 49 6e 43 6f 64 65 28 6c 61 62 |ddressInCode(lab| 00000770 2c 20 30 29 20 7d 20 7d 0a 0a 41 4e 44 20 42 69 |, 0) } }..AND Bi| 00000780 6e 54 72 65 65 53 77 69 74 63 68 28 70 2c 20 71 |nTreeSwitch(p, q| 00000790 29 20 42 45 0a 20 20 20 54 45 53 54 20 71 2d 70 |) BE. TEST q-p| 000007a0 3e 36 20 54 48 45 4e 20 7b 0a 20 20 20 20 20 20 |>6 THEN {. | 000007b0 4c 45 54 20 6d 20 3d 20 4e 65 78 74 4c 61 62 65 |LET m = NextLabe| 000007c0 6c 28 29 3b 0a 20 20 20 20 20 20 4c 45 54 20 74 |l();. LET t| 000007d0 20 3d 20 28 70 2b 71 29 2f 32 3b 0a 0a 20 20 20 | = (p+q)/2;.. | 000007e0 20 20 20 43 61 73 65 43 6f 6d 70 61 72 65 28 74 | CaseCompare(t| 000007f0 29 3b 0a 20 20 20 20 20 20 43 6f 6e 64 4a 75 6d |);. CondJum| 00000800 70 28 6d 2e 67 74 2c 20 6d 29 3b 0a 20 20 20 20 |p(m.gt, m);. | 00000810 20 20 43 6f 6e 64 4a 75 6d 70 28 6d 2e 65 71 2c | CondJump(m.eq,| 00000820 20 63 61 73 65 6c 21 74 29 3b 0a 20 20 20 20 20 | casel!t);. | 00000830 20 42 69 6e 54 72 65 65 53 77 69 74 63 68 28 70 | BinTreeSwitch(p| 00000840 2c 20 74 2d 31 29 3b 0a 0a 20 20 20 20 20 20 43 |, t-1);.. C| 00000850 6f 6e 64 4a 75 6d 70 28 6d 2e 61 6c 77 61 79 73 |ondJump(m.always| 00000860 2c 20 73 77 64 29 3b 0a 20 20 20 20 20 20 46 6c |, swd);. Fl| 00000870 75 73 68 50 65 6e 64 69 6e 67 49 6e 73 74 73 28 |ushPendingInsts(| 00000880 4e 75 6c 6c 2c 20 46 41 4c 53 45 29 3b 0a 0a 20 |Null, FALSE);.. | 00000890 20 20 20 20 20 53 65 74 4c 61 62 65 6c 28 6d 29 | SetLabel(m)| 000008a0 3b 0a 20 20 20 20 20 20 42 69 6e 54 72 65 65 53 |;. BinTreeS| 000008b0 77 69 74 63 68 28 74 2b 31 2c 20 71 29 20 7d 0a |witch(t+1, q) }.| 000008c0 0a 20 20 20 45 4c 53 45 20 46 4f 52 20 69 20 3d |. ELSE FOR i =| 000008d0 20 70 20 54 4f 20 71 20 44 4f 20 7b 0a 20 20 20 | p TO q DO {. | 000008e0 20 20 20 43 61 73 65 43 6f 6d 70 61 72 65 28 69 | CaseCompare(i| 000008f0 29 3b 0a 20 20 20 20 20 20 43 6f 6e 64 4a 75 6d |);. CondJum| 00000900 70 28 6d 2e 65 71 2c 20 63 61 73 65 6c 21 69 29 |p(m.eq, casel!i)| 00000910 20 7d 0a 0a 41 4e 44 20 43 61 73 65 43 6f 6d 70 | }..AND CaseComp| 00000920 61 72 65 28 69 29 20 42 45 20 7b 0a 20 20 20 4c |are(i) BE {. L| 00000930 45 54 20 6e 20 3d 20 63 61 73 65 6b 21 69 3b 0a |ET n = casek!i;.| 00000940 20 20 20 54 45 53 54 20 6e 3c 30 0a 20 20 20 20 | TEST n<0. | 00000950 20 20 54 48 45 4e 20 47 65 6e 46 31 4b 28 66 2e | THEN GenF1K(f.| 00000960 63 6d 6e 73 2c 20 30 2c 20 73 77 72 2c 20 2d 6e |cmns, 0, swr, -n| 00000970 29 0a 20 20 20 20 20 20 45 4c 53 45 20 47 65 6e |). ELSE Gen| 00000980 46 31 4b 28 66 2e 63 6d 70 73 2c 20 30 2c 20 73 |F1K(f.cmps, 0, s| 00000990 77 72 2c 20 6e 29 20 7d 0a 0a 41 4e 44 20 43 47 |wr, n) }..AND CG| 000009a0 45 6e 74 72 79 28 6e 2c 20 6d 29 20 42 45 20 7b |Entry(n, m) BE {| 000009b0 0a 20 20 20 4c 45 54 20 70 20 3d 20 30 3b 0a 20 |. LET p = 0;. | 000009c0 20 20 7b 20 20 4c 45 54 20 77 20 3d 20 56 45 43 | { LET w = VEC| 000009d0 20 32 35 36 2f 42 79 74 65 73 50 65 72 57 6f 72 | 256/BytesPerWor| 000009e0 64 3b 0a 20 20 20 20 20 20 4c 45 54 20 76 20 3d |d;. LET v =| 000009f0 20 56 45 43 20 31 3b 0a 20 20 20 20 20 20 4c 45 | VEC 1;. LE| 00000a00 54 20 6b 20 3d 20 73 65 63 74 69 6f 6e 4e 61 6d |T k = sectionNam| 00000a10 65 25 30 3b 0a 20 20 20 20 20 20 46 4f 52 20 69 |e%0;. FOR i| 00000a20 20 3d 20 31 20 54 4f 20 6b 20 44 4f 20 77 25 69 | = 1 TO k DO w%i| 00000a30 20 3a 3d 20 73 65 63 74 69 6f 6e 4e 61 6d 65 25 | := sectionName%| 00000a40 69 3b 0a 20 20 20 20 20 20 6b 20 3a 3d 20 6b 2b |i;. k := k+| 00000a50 31 3b 0a 20 20 20 20 20 20 77 25 6b 20 3a 3d 20 |1;. w%k := | 00000a60 27 2e 27 3b 0a 20 20 20 20 20 20 46 4f 52 20 69 |'.';. FOR i| 00000a70 20 3d 20 31 20 54 4f 20 6e 20 44 4f 0a 20 20 20 | = 1 TO n DO. | 00000a80 20 20 20 7b 20 20 4c 45 54 20 63 20 3d 20 52 65 | { LET c = Re| 00000a90 61 64 4e 28 29 3b 0a 09 20 77 25 28 69 2b 6b 29 |adN();.. w%(i+k)| 00000aa0 20 3a 3d 20 63 3b 0a 09 20 49 46 20 69 3c 3d 37 | := c;.. IF i<=7| 00000ab0 20 54 48 45 4e 20 76 25 69 20 3a 3d 20 63 20 7d | THEN v%i := c }| 00000ac0 3b 0a 20 20 20 20 20 20 77 25 30 20 3a 3d 20 6e |;. w%0 := n| 00000ad0 2b 6b 3b 0a 20 20 20 20 20 20 46 4f 52 20 69 20 |+k;. FOR i | 00000ae0 3d 20 6e 2b 31 20 54 4f 20 37 20 44 4f 20 76 25 |= n+1 TO 7 DO v%| 00000af0 69 20 3a 3d 20 27 2a 73 27 3b 0a 20 20 20 20 20 |i := '*s';. | 00000b00 20 76 25 30 20 3a 3d 20 37 3b 0a 0a 20 20 20 20 | v%0 := 7;.. | 00000b10 20 20 41 64 64 72 65 73 73 49 6e 43 6f 64 65 28 | AddressInCode(| 00000b20 73 74 61 74 69 63 44 61 74 61 4c 61 62 2c 20 30 |staticDataLab, 0| 00000b30 29 3b 0a 20 20 20 20 20 20 49 46 20 70 72 6f 63 |);. IF proc| 00000b40 4e 61 6d 65 73 20 54 48 45 4e 20 7b 0a 09 20 54 |Names THEN {.. T| 00000b50 45 53 54 20 6e 61 6d 69 6e 67 20 54 48 45 4e 20 |EST naming THEN | 00000b60 7b 0a 09 20 20 20 20 70 20 3a 3d 20 70 72 6f 63 |{.. p := proc| 00000b70 4c 61 62 65 6c 3b 0a 09 20 20 20 20 70 72 6f 63 |Label;.. proc| 00000b80 4c 61 62 65 6c 20 3a 3d 20 4e 65 78 74 4c 61 62 |Label := NextLab| 00000b90 65 6c 28 29 3b 0a 09 20 20 20 20 41 64 64 72 65 |el();.. Addre| 00000ba0 73 73 49 6e 43 6f 64 65 28 70 72 6f 63 4c 61 62 |ssInCode(procLab| 00000bb0 65 6c 2c 20 6c 6f 63 43 74 72 29 20 7d 0a 09 20 |el, locCtr) }.. | 00000bc0 45 4c 53 45 0a 09 20 20 20 20 50 75 74 57 6f 72 |ELSE.. PutWor| 00000bd0 64 28 2d 31 29 3b 0a 0a 09 20 50 75 74 57 6f 72 |d(-1);... PutWor| 00000be0 64 28 76 21 30 29 3b 0a 09 20 50 75 74 57 6f 72 |d(v!0);.. PutWor| 00000bf0 64 28 76 21 31 29 20 7d 3b 0a 0a 20 20 20 20 20 |d(v!1) };.. | 00000c00 20 41 64 64 58 53 79 6d 62 6f 6c 28 77 2c 20 31 | AddXSymbol(w, 1| 00000c10 2c 20 6d 29 3b 0a 0a 20 20 20 20 20 20 62 61 73 |, m);.. bas| 00000c20 65 21 30 2c 20 62 61 73 65 21 31 20 3a 3d 20 62 |e!0, base!1 := b| 00000c30 61 73 65 4c 61 62 2c 20 62 61 73 65 41 64 64 72 |aseLab, baseAddr| 00000c40 3b 0a 20 20 20 20 20 20 7b 20 20 4c 45 54 20 66 |;. { LET f| 00000c50 20 3d 20 30 3b 0a 09 20 49 46 20 6c 6f 63 61 6c | = 0;.. IF local| 00000c60 73 53 61 66 65 20 54 48 45 4e 20 66 20 3a 3d 20 |sSafe THEN f := | 00000c70 66 2b 31 3b 0a 09 20 49 46 20 75 73 65 73 46 72 |f+1;.. IF usesFr| 00000c80 61 6d 65 20 54 48 45 4e 20 66 20 3a 3d 20 66 2b |ame THEN f := f+| 00000c90 32 3b 0a 09 20 49 46 20 63 6f 6e 74 61 69 6e 73 |2;.. IF contains| 00000ca0 43 61 6c 6c 73 20 54 48 45 4e 20 66 20 3a 3d 20 |Calls THEN f := | 00000cb0 66 2b 34 3b 0a 09 20 49 46 20 75 73 65 73 52 4c |f+4;.. IF usesRL| 00000cc0 20 54 48 45 4e 20 66 20 3a 3d 20 66 2b 38 3b 0a | THEN f := f+8;.| 00000cd0 09 20 49 46 20 6c 69 6e 6b 61 67 65 4e 6f 74 53 |. IF linkageNotS| 00000ce0 74 6f 72 65 64 20 54 48 45 4e 0a 09 20 20 20 20 |tored THEN.. | 00000cf0 54 45 53 54 20 6c 69 6e 6b 61 67 65 4e 6f 74 53 |TEST linkageNotS| 00000d00 74 6f 72 65 64 3d 72 2e 62 20 54 48 45 4e 0a 09 |tored=r.b THEN..| 00000d10 20 20 20 20 20 20 20 66 20 3a 3d 20 66 2b 31 36 | f := f+16| 00000d20 0a 09 20 20 20 20 45 4c 53 45 0a 09 20 20 20 20 |.. ELSE.. | 00000d30 20 20 20 66 20 3a 3d 20 66 2b 33 32 3b 0a 09 20 | f := f+32;.. | 00000d40 62 61 73 65 21 32 20 3a 3d 20 66 20 7d 3b 0a 20 |base!2 := f };. | 00000d50 20 20 20 20 20 62 61 73 65 20 3a 3d 20 62 61 73 | base := bas| 00000d60 65 2b 33 3b 0a 20 20 20 20 20 20 62 61 73 65 4c |e+3;. baseL| 00000d70 61 62 2c 20 62 61 73 65 41 64 64 72 20 3a 3d 20 |ab, baseAddr := | 00000d80 6d 2c 20 6c 6f 63 43 74 72 3b 0a 20 20 20 20 20 |m, locCtr;. | 00000d90 20 6c 6f 63 61 6c 73 53 61 66 65 20 3a 3d 20 7e | localsSafe := ~| 00000da0 4c 61 62 65 6c 46 6c 61 67 67 65 64 28 6d 2c 20 |LabelFlagged(m, | 00000db0 6c 61 62 2e 6c 76 70 74 61 6b 65 6e 29 3b 0a 20 |lab.lvptaken);. | 00000dc0 20 20 20 20 20 75 73 65 73 46 72 61 6d 65 20 3a | usesFrame :| 00000dd0 3d 20 4c 61 62 65 6c 46 6c 61 67 67 65 64 28 6d |= LabelFlagged(m| 00000de0 2c 20 6c 61 62 2e 66 72 61 6d 65 6e 65 65 64 65 |, lab.frameneede| 00000df0 64 29 3b 0a 20 20 20 20 20 20 63 6f 6e 74 61 69 |d);. contai| 00000e00 6e 73 43 61 6c 6c 73 20 3a 3d 20 4c 61 62 65 6c |nsCalls := Label| 00000e10 46 6c 61 67 67 65 64 28 6d 2c 20 6c 61 62 2e 70 |Flagged(m, lab.p| 00000e20 72 6f 63 68 61 73 63 61 6c 6c 73 29 3b 0a 20 20 |rochascalls);. | 00000e30 20 20 20 20 75 73 65 73 52 4c 20 3a 3d 20 75 73 | usesRL := us| 00000e40 65 73 46 72 61 6d 65 20 7c 20 4c 61 62 65 6c 46 |esFrame | LabelF| 00000e50 6c 61 67 67 65 64 28 6d 2c 20 6c 61 62 2e 70 72 |lagged(m, lab.pr| 00000e60 6f 63 73 74 61 74 69 63 73 29 3b 0a 20 20 20 20 |ocstatics);. | 00000e70 20 20 49 46 20 43 47 44 65 62 75 67 4d 6f 64 65 | IF CGDebugMode| 00000e80 7e 3d 30 20 54 48 45 4e 20 7b 0a 09 20 57 72 69 |~=0 THEN {.. Wri| 00000e90 74 65 46 28 22 2a 2a 2a 2a 2a 2a 20 25 73 22 2c |teF("****** %s",| 00000ea0 20 76 29 3b 0a 09 20 49 46 20 7e 75 73 65 73 46 | v);.. IF ~usesF| 00000eb0 72 61 6d 65 20 54 48 45 4e 20 57 72 69 74 65 53 |rame THEN WriteS| 00000ec0 28 22 20 2d 20 6e 6f 20 66 72 61 6d 65 22 29 3b |(" - no frame");| 00000ed0 0a 09 20 49 46 20 7e 63 6f 6e 74 61 69 6e 73 43 |.. IF ~containsC| 00000ee0 61 6c 6c 73 20 54 48 45 4e 20 57 72 69 74 65 53 |alls THEN WriteS| 00000ef0 28 22 20 2d 20 6e 6f 20 63 61 6c 6c 73 22 29 3b |(" - no calls");| 00000f00 0a 09 20 49 46 20 6c 6f 63 61 6c 73 53 61 66 65 |.. IF localsSafe| 00000f10 20 54 48 45 4e 20 57 72 69 74 65 53 28 22 20 2d | THEN WriteS(" -| 00000f20 20 6c 6f 63 61 6c 73 20 73 61 66 65 22 29 3b 0a | locals safe");.| 00000f30 09 20 57 72 69 74 65 53 28 22 20 2a 2a 2a 2a 2a |. WriteS(" *****| 00000f40 2a 2a 6e 22 29 20 7d 3b 0a 20 20 20 20 20 20 53 |**n") };. S| 00000f50 65 74 4c 61 62 65 6c 28 6d 29 20 7d 3b 0a 0a 20 |etLabel(m) };.. | 00000f60 20 20 44 69 73 63 61 72 64 52 65 67 73 28 29 3b | DiscardRegs();| 00000f70 0a 20 20 20 64 65 61 64 43 6f 64 65 20 3a 3d 20 |. deadCode := | 00000f80 41 6c 69 76 65 3b 0a 20 20 20 49 46 20 6e 61 6d |Alive;. IF nam| 00000f90 69 6e 67 20 54 48 45 4e 0a 20 20 20 7b 20 20 4c |ing THEN. { L| 00000fa0 45 54 20 6e 2c 20 62 20 3d 20 6e 61 6d 65 6c 2c |ET n, b = namel,| 00000fb0 20 62 6c 6f 63 6b 4c 61 62 65 6c 3b 0a 20 20 20 | blockLabel;. | 00000fc0 20 20 20 6e 61 6d 65 6c 2c 20 62 6c 6f 63 6b 4c | namel, blockL| 00000fd0 61 62 65 6c 20 3a 3d 20 6e 61 6d 65 74 2c 20 2d |abel := namet, -| 00000fe0 31 3b 0a 20 20 20 20 20 20 6f 70 20 3a 3d 20 52 |1;. op := R| 00000ff0 65 61 64 4f 70 28 29 3b 0a 20 20 20 20 20 20 53 |eadOp();. S| 00001000 63 61 6e 28 29 0a 20 20 20 20 20 20 6e 61 6d 65 |can(). name| 00001010 74 20 3a 3d 20 6e 61 6d 65 6c 3b 0a 20 20 20 20 |t := namel;. | 00001020 20 20 6e 61 6d 65 6c 2c 20 62 6c 6f 63 6b 4c 61 | namel, blockLa| 00001030 62 65 6c 2c 20 70 72 6f 63 4c 61 62 65 6c 20 3a |bel, procLabel :| 00001040 3d 20 6e 2c 20 62 2c 20 70 20 7d 20 7d 0a 0a 41 |= n, b, p } }..A| 00001050 4e 44 20 43 47 53 61 76 65 28 6e 29 20 42 45 20 |ND CGSave(n) BE | 00001060 7b 0a 20 20 20 4c 45 54 20 61 20 3d 20 31 2b 6e |{. LET a = 1+n| 00001070 2d 73 61 76 65 53 70 61 63 65 53 69 7a 65 2d 31 |-saveSpaceSize-1| 00001080 3b 0a 20 20 20 4c 45 54 20 72 65 67 73 65 74 20 |;. LET regset | 00001090 3d 20 30 3b 0a 20 20 20 49 46 20 61 3e 34 20 54 |= 0;. IF a>4 T| 000010a0 48 45 4e 20 61 2c 20 75 73 65 73 46 72 61 6d 65 |HEN a, usesFrame| 000010b0 20 3a 3d 20 34 2c 20 54 52 55 45 3b 0a 20 20 20 | := 4, TRUE;. | 000010c0 6c 69 6e 6b 61 67 65 4e 6f 74 53 74 6f 72 65 64 |linkageNotStored| 000010d0 20 3a 3d 20 46 41 4c 53 45 3b 0a 0a 20 20 20 54 | := FALSE;.. T| 000010e0 45 53 54 20 63 6f 75 6e 74 69 6e 67 20 7c 20 63 |EST counting | c| 000010f0 61 6c 6c 43 6f 75 6e 74 69 6e 67 20 54 48 45 4e |allCounting THEN| 00001100 20 7b 0a 20 20 20 20 20 20 75 73 65 73 46 72 61 | {. usesFra| 00001110 6d 65 20 3a 3d 20 54 52 55 45 3b 0a 20 20 20 20 |me := TRUE;. | 00001120 20 20 49 6e 73 65 72 74 43 6f 75 6e 74 28 73 72 | InsertCount(sr| 00001130 2e 65 6e 74 72 79 63 6f 75 6e 74 29 20 7d 0a 20 |.entrycount) }. | 00001140 20 20 45 4c 53 45 20 49 46 20 75 73 65 73 46 72 | ELSE IF usesFr| 00001150 61 6d 65 20 54 48 45 4e 20 7b 0a 20 20 20 20 20 |ame THEN {. | 00001160 20 4c 45 54 20 72 20 3d 20 72 65 76 65 72 73 65 | LET r = reverse| 00001170 64 53 74 61 63 6b 20 2d 3e 20 28 54 41 42 4c 45 |dStack -> (TABLE| 00001180 20 72 2e 31 34 2c 20 72 2e 6c 2c 20 72 2e 70 2c | r.14, r.l, r.p,| 00001190 20 72 2e 62 29 2c 0a 09 20 20 20 20 73 61 76 65 | r.b),.. save| 000011a0 53 70 61 63 65 53 69 7a 65 3d 34 20 2d 3e 20 28 |SpaceSize=4 -> (| 000011b0 54 41 42 4c 45 20 72 2e 62 2c 20 72 2e 70 2c 20 |TABLE r.b, r.p, | 000011c0 72 2e 6c 2c 20 72 2e 31 34 29 2c 0a 09 09 09 20 |r.l, r.14),.... | 000011d0 20 20 20 20 20 20 28 54 41 42 4c 45 20 72 2e 70 | (TABLE r.p| 000011e0 2c 20 72 2e 6c 2c 20 72 2e 31 34 29 3b 0a 20 20 |, r.l, r.14);. | 000011f0 20 20 20 20 6c 69 6e 6b 61 67 65 4e 6f 74 53 74 | linkageNotSt| 00001200 6f 72 65 64 20 3a 3d 20 54 52 55 45 3b 0a 20 20 |ored := TRUE;. | 00001210 20 20 20 20 49 46 20 73 61 76 65 53 70 61 63 65 | IF saveSpace| 00001220 53 69 7a 65 3d 34 20 54 48 45 4e 20 7b 0a 09 20 |Size=4 THEN {.. | 00001230 20 20 20 2f 2f 20 54 68 65 20 6f 6e 6c 79 20 70 | // The only p| 00001240 6f 69 6e 74 20 69 6e 20 73 61 76 69 6e 67 20 52 |oint in saving R| 00001250 42 20 61 74 20 61 6c 6c 20 69 73 20 74 6f 20 61 |B at all is to a| 00001260 6c 6c 6f 77 0a 09 20 20 20 20 2f 2f 20 64 69 61 |llow.. // dia| 00001270 67 6e 6f 73 74 69 63 20 70 72 6f 67 72 61 6d 73 |gnostic programs| 00001280 20 65 61 73 69 6c 79 20 74 6f 20 73 65 65 20 74 | easily to see t| 00001290 6f 20 77 68 6f 6d 20 73 74 61 63 6b 0a 09 20 20 |o whom stack.. | 000012a0 20 20 2f 2f 20 66 72 61 6d 65 73 20 62 65 6c 6f | // frames belo| 000012b0 6e 67 2e 20 20 49 66 2c 20 74 68 65 72 65 66 6f |ng. If, therefo| 000012c0 72 65 2c 20 69 74 20 6c 6f 6f 6b 73 20 61 73 20 |re, it looks as | 000012d0 74 68 6f 75 67 68 0a 09 20 20 20 20 2f 2f 20 61 |though.. // a| 000012e0 20 70 72 6f 63 65 64 75 72 65 20 77 69 6c 6c 20 | procedure will | 000012f0 62 65 20 63 61 6c 6c 65 64 20 62 79 20 64 69 72 |be called by dir| 00001300 65 63 74 20 42 4c 2c 20 77 65 20 6d 75 73 74 0a |ect BL, we must.| 00001310 09 20 20 20 20 2f 2f 20 74 61 6b 65 20 73 74 65 |. // take ste| 00001320 70 73 20 74 6f 20 65 6e 73 75 72 65 20 74 68 61 |ps to ensure tha| 00001330 74 20 74 68 65 20 73 74 6f 72 65 64 20 52 42 20 |t the stored RB | 00001340 69 73 20 72 69 67 68 74 2e 0a 0a 09 20 4c 45 54 |is right.... LET| 00001350 20 70 20 3d 20 41 73 73 6f 63 28 62 61 73 65 4c | p = Assoc(baseL| 00001360 61 62 2c 20 32 2c 20 73 74 61 74 69 63 4c 61 62 |ab, 2, staticLab| 00001370 65 6c 73 29 3b 0a 09 20 49 46 20 70 7e 3d 4e 75 |els);.. IF p~=Nu| 00001380 6c 6c 20 26 20 4c 61 62 65 6c 46 6c 61 67 67 65 |ll & LabelFlagge| 00001390 64 28 70 21 31 2c 20 6c 61 62 2e 63 61 6c 6c 65 |d(p!1, lab.calle| 000013a0 64 29 20 54 48 45 4e 0a 09 20 20 20 20 6c 69 6e |d) THEN.. lin| 000013b0 6b 61 67 65 4e 6f 74 53 74 6f 72 65 64 20 3a 3d |kageNotStored :=| 000013c0 20 72 2e 62 20 7d 3b 0a 0a 20 20 20 20 20 20 46 | r.b };.. F| 000013d0 4f 52 20 69 20 3d 20 30 20 54 4f 20 73 61 76 65 |OR i = 0 TO save| 000013e0 53 70 61 63 65 53 69 7a 65 2d 31 20 44 4f 0a 09 |SpaceSize-1 DO..| 000013f0 20 41 64 64 54 6f 50 65 6e 64 69 6e 67 53 74 6f | AddToPendingSto| 00001400 72 65 73 28 72 21 69 2c 20 6b 2e 6c 6f 63 2c 20 |res(r!i, k.loc, | 00001410 69 2c 20 54 52 55 45 2c 20 30 29 20 7d 3b 0a 0a |i, TRUE, 0) };..| 00001420 20 20 20 54 4f 53 4f 66 66 73 65 74 20 3a 3d 20 | TOSOffset := | 00001430 73 61 76 65 53 70 61 63 65 53 69 7a 65 3b 0a 20 |saveSpaceSize;. | 00001440 20 20 49 6e 69 74 53 74 61 63 6b 28 6e 29 0a 20 | InitStack(n). | 00001450 20 20 54 45 53 54 20 7e 75 73 65 73 46 72 61 6d | TEST ~usesFram| 00001460 65 20 26 20 7e 63 6f 6e 74 61 69 6e 73 43 61 6c |e & ~containsCal| 00001470 6c 73 20 26 20 61 3c 3d 33 20 54 48 45 4e 0a 20 |ls & a<=3 THEN. | 00001480 20 20 20 20 20 46 4f 52 20 72 20 3d 20 31 20 54 | FOR r = 1 T| 00001490 4f 20 33 20 44 4f 20 7b 0a 09 20 4c 45 54 20 6e |O 3 DO {.. LET n| 000014a0 20 3d 20 54 4f 53 4f 66 66 73 65 74 2b 72 2d 31 | = TOSOffset+r-1| 000014b0 3b 0a 09 20 4c 45 54 20 73 20 3d 20 41 72 67 75 |;.. LET s = Argu| 000014c0 6d 65 6e 74 52 65 67 69 73 74 65 72 28 72 29 3b |mentRegister(r);| 000014d0 0a 09 20 44 65 64 69 63 61 74 65 52 65 67 69 73 |.. DedicateRegis| 000014e0 74 65 72 54 6f 4c 6f 63 28 73 2c 20 6e 29 3b 0a |terToLoc(s, n);.| 000014f0 09 20 49 46 20 72 3c 3d 61 20 54 48 45 4e 20 4d |. IF r<=a THEN M| 00001500 6f 76 65 53 54 6f 52 28 6b 2e 72 65 67 2c 20 73 |oveSToR(k.reg, s| 00001510 2c 20 6b 2e 6c 6f 63 2c 20 6e 29 20 7d 0a 20 20 |, k.loc, n) }. | 00001520 20 45 4c 53 45 0a 20 20 20 20 20 20 46 4f 52 20 | ELSE. FOR | 00001530 72 20 3d 20 31 20 54 4f 20 61 20 44 4f 20 7b 0a |r = 1 TO a DO {.| 00001540 09 20 4c 45 54 20 73 20 3d 20 41 72 67 75 6d 65 |. LET s = Argume| 00001550 6e 74 52 65 67 69 73 74 65 72 28 72 29 3b 0a 09 |ntRegister(r);..| 00001560 20 4d 6f 76 65 53 74 6f 52 28 6b 2e 72 65 67 2c | MoveStoR(k.reg,| 00001570 20 73 2c 20 6b 2e 6c 6f 63 2c 20 54 4f 53 4f 66 | s, k.loc, TOSOf| 00001580 66 73 65 74 29 0a 09 20 41 64 64 54 6f 50 65 6e |fset).. AddToPen| 00001590 64 69 6e 67 53 74 6f 72 65 73 28 73 2c 20 6b 2e |dingStores(s, k.| 000015a0 6c 6f 63 2c 20 54 4f 53 4f 66 66 73 65 74 2c 20 |loc, TOSOffset, | 000015b0 54 52 55 45 2c 20 30 29 3b 0a 09 20 54 4f 53 6f |TRUE, 0);.. TOSo| 000015c0 66 66 73 65 74 20 3a 3d 20 54 4f 53 4f 66 66 73 |ffset := TOSOffs| 000015d0 65 74 2b 31 20 7d 20 7d 0a 0a 41 4e 44 20 43 68 |et+1 } }..AND Ch| 000015e0 65 63 6b 52 4c 4c 6f 61 64 65 64 28 29 20 3d 20 |eckRLLoaded() = | 000015f0 56 41 4c 4f 46 0a 20 20 20 54 45 53 54 20 7e 75 |VALOF. TEST ~u| 00001600 73 65 73 52 4c 20 54 48 45 4e 0a 20 20 20 20 20 |sesRL THEN. | 00001610 20 52 45 53 55 4c 54 49 53 20 72 2e 70 63 0a 20 | RESULTIS r.pc. | 00001620 20 20 45 4c 53 45 20 7b 0a 20 20 20 20 20 20 49 | ELSE {. I| 00001630 46 20 6c 69 6e 6b 61 67 65 4e 6f 74 53 74 6f 72 |F linkageNotStor| 00001640 65 64 20 54 48 45 4e 20 46 6c 75 73 68 50 65 6e |ed THEN FlushPen| 00001650 64 69 6e 67 55 73 65 73 4f 66 52 65 67 28 72 2e |dingUsesOfReg(r.| 00001660 6c 29 3b 0a 20 20 20 20 20 20 49 46 20 6c 69 6e |l);. IF lin| 00001670 6b 61 67 65 4e 6f 74 53 74 6f 72 65 64 20 54 48 |kageNotStored TH| 00001680 45 4e 20 7b 0a 09 20 52 4c 4c 6f 61 64 4c 69 73 |EN {.. RLLoadLis| 00001690 74 20 3a 3d 20 46 69 6c 6c 42 6c 6b 28 32 2c 20 |t := FillBlk(2, | 000016a0 52 4c 4c 6f 61 64 4c 69 73 74 2c 20 6c 6f 63 43 |RLLoadList, locC| 000016b0 74 72 29 3b 0a 09 20 47 65 6e 46 32 28 66 2e 6c |tr);.. GenF2(f.l| 000016c0 64 72 2c 20 72 2e 30 2c 20 72 2e 70 63 2c 20 30 |dr, r.0, r.pc, 0| 000016d0 2c 0a 09 20 20 20 20 20 20 20 56 61 6c 75 65 4f |,.. ValueO| 000016e0 66 4c 61 62 65 6c 28 62 61 73 65 4c 61 62 29 2d |fLabel(baseLab)-| 000016f0 31 32 2d 6c 6f 63 43 74 72 2d 28 70 72 6f 63 4e |12-locCtr-(procN| 00001700 61 6d 65 73 2d 3e 31 32 2c 30 29 29 3b 0a 09 20 |ames->12,0));.. | 00001710 52 45 53 55 4c 54 49 53 20 72 2e 30 20 7d 3b 0a |RESULTIS r.0 };.| 00001720 20 20 20 20 20 20 52 45 53 55 4c 54 49 53 20 72 | RESULTIS r| 00001730 2e 6c 20 7d 0a 0a 41 4e 44 20 43 47 41 70 70 6c |.l }..AND CGAppl| 00001740 79 28 63 61 6c 6c 54 79 70 65 2c 20 6b 29 20 42 |y(callType, k) B| 00001750 45 20 54 45 53 54 20 58 53 79 6d 49 6e 53 74 61 |E TEST XSymInSta| 00001760 74 69 63 28 61 72 67 31 29 7e 3d 4e 75 6c 6c 20 |tic(arg1)~=Null | 00001770 54 48 45 4e 0a 20 20 20 43 47 41 70 70 6c 79 58 |THEN. CGApplyX| 00001780 28 63 61 6c 6c 54 79 70 65 2c 20 6b 29 0a 45 4c |(callType, k).EL| 00001790 53 45 20 7b 0a 20 20 20 4c 45 54 20 61 72 67 62 |SE {. LET argb| 000017a0 61 73 65 20 3d 20 6b 2b 73 61 76 65 53 70 61 63 |ase = k+saveSpac| 000017b0 65 53 69 7a 65 3b 0a 20 20 20 4c 45 54 20 74 65 |eSize;. LET te| 000017c0 6d 70 62 61 73 65 20 3d 20 68 35 21 74 65 6d 70 |mpbase = h5!temp| 000017d0 76 2d 61 72 67 62 61 73 65 3b 0a 20 20 20 4c 45 |v-argbase;. LE| 000017e0 54 20 72 6d 69 6e 2c 20 72 6d 61 78 20 3d 20 31 |T rmin, rmax = 1| 000017f0 2b 74 65 6d 70 62 61 73 65 2c 20 31 2b 68 35 21 |+tempbase, 1+h5!| 00001800 61 72 67 32 2d 61 72 67 62 61 73 65 3b 0a 20 20 |arg2-argbase;. | 00001810 20 4c 45 54 20 61 72 67 6d 61 78 20 3d 20 72 6d | LET argmax = rm| 00001820 61 78 3b 0a 20 20 20 4c 45 54 20 65 78 69 74 43 |ax;. LET exitC| 00001830 61 6c 6c 20 3d 20 46 41 4c 53 45 3b 0a 20 20 20 |all = FALSE;. | 00001840 4c 45 54 20 73 74 61 63 6b 41 74 45 6e 64 20 3d |LET stackAtEnd =| 00001850 20 6b 3b 0a 20 20 20 4c 45 54 20 70 72 6f 63 4c | k;. LET procL| 00001860 61 62 20 3d 20 4e 75 6c 6c 3b 0a 0a 20 20 20 49 |ab = Null;.. I| 00001870 46 20 72 6d 69 6e 3c 31 20 54 48 45 4e 20 72 6d |F rmin<1 THEN rm| 00001880 69 6e 20 3a 3d 20 31 3b 0a 20 20 20 49 46 20 72 |in := 1;. IF r| 00001890 6d 61 78 3e 34 20 54 48 45 4e 20 72 6d 61 78 20 |max>4 THEN rmax | 000018a0 3a 3d 20 34 3b 0a 0a 20 20 20 6f 70 20 3a 3d 20 |:= 4;.. op := | 000018b0 52 65 61 64 4f 70 28 29 3b 0a 20 20 20 57 48 49 |ReadOp();. WHI| 000018c0 4c 45 20 6f 70 3d 73 2e 73 74 61 63 6b 20 44 4f |LE op=s.stack DO| 000018d0 20 7b 0a 20 20 20 20 20 20 73 74 61 63 6b 41 74 | {. stackAt| 000018e0 45 6e 64 20 3a 3d 20 52 65 61 64 4e 28 29 3b 0a |End := ReadN();.| 000018f0 20 20 20 20 20 20 6f 70 20 3a 3d 20 52 65 61 64 | op := Read| 00001900 4f 70 28 29 20 7d 3b 0a 0a 0a 20 20 20 49 46 20 |Op() };... IF | 00001910 72 6d 61 78 3d 61 72 67 6d 61 78 20 26 0a 20 20 |rmax=argmax &. | 00001920 20 2f 2f 20 79 6f 75 20 63 61 6e 27 74 20 68 61 | // you can't ha| 00001930 76 65 20 65 78 69 74 20 63 61 6c 6c 73 20 77 69 |ve exit calls wi| 00001940 74 68 20 6d 6f 72 65 20 61 72 67 75 6d 65 6e 74 |th more argument| 00001950 73 20 74 68 61 6e 20 61 72 65 20 70 61 73 73 65 |s than are passe| 00001960 64 0a 20 20 20 2f 2f 20 69 6e 20 72 65 67 69 73 |d. // in regis| 00001970 74 65 72 73 20 28 6f 72 20 72 61 74 68 65 72 20 |ters (or rather | 00001980 79 6f 75 20 63 61 6e 2c 20 62 75 74 20 74 68 65 |you can, but the| 00001990 79 27 72 65 20 74 72 69 63 6b 79 20 74 6f 20 68 |y're tricky to h| 000019a0 61 6e 64 6c 65 29 0a 20 20 20 20 20 20 6c 6f 63 |andle). loc| 000019b0 61 6c 73 53 61 66 65 20 54 48 45 4e 0a 20 20 20 |alsSafe THEN. | 000019c0 2f 2f 20 49 66 20 61 6e 20 61 72 67 75 6d 65 6e |// If an argumen| 000019d0 74 20 6d 61 79 20 62 65 20 61 20 70 6f 69 6e 74 |t may be a point| 000019e0 65 72 20 69 6e 74 6f 20 74 68 69 73 20 70 72 6f |er into this pro| 000019f0 63 65 64 75 72 65 27 73 20 66 72 61 6d 65 2c 0a |cedure's frame,.| 00001a00 20 20 20 2f 2f 20 77 65 27 64 20 62 65 74 74 65 | // we'd bette| 00001a10 72 20 6e 6f 74 20 63 6f 6d 70 69 6c 65 20 61 6e |r not compile an| 00001a20 20 65 78 69 74 20 63 61 6c 6c 20 28 77 68 69 63 | exit call (whic| 00001a30 68 20 77 6f 75 6c 64 20 74 68 72 6f 77 20 61 77 |h would throw aw| 00001a40 61 79 0a 20 20 20 2f 2f 20 74 68 65 20 66 72 61 |ay. // the fra| 00001a50 6d 65 29 0a 20 20 20 20 20 20 54 45 53 54 20 6f |me). TEST o| 00001a60 70 3d 73 2e 66 6e 72 6e 20 7c 20 6f 70 3d 73 2e |p=s.fnrn | op=s.| 00001a70 72 74 72 6e 20 54 48 45 4e 20 7b 0a 09 20 6f 70 |rtrn THEN {.. op| 00001a80 20 3a 3d 20 52 65 61 64 4f 70 28 29 3b 0a 09 20 | := ReadOp();.. | 00001a90 65 78 69 74 43 61 6c 6c 20 3a 3d 20 54 52 55 45 |exitCall := TRUE| 00001aa0 20 7d 0a 0a 20 20 20 20 20 20 45 4c 53 45 20 49 | }.. ELSE I| 00001ab0 46 20 28 6f 70 3d 73 2e 72 65 73 20 7c 20 6f 70 |F (op=s.res | op| 00001ac0 3d 73 2e 6a 75 6d 70 20 7c 20 6f 70 3d 73 2e 6c |=s.jump | op=s.l| 00001ad0 61 62 29 20 26 0a 09 20 20 20 20 20 20 54 72 61 |ab) &.. Tra| 00001ae0 6e 73 66 65 72 72 65 64 4c 61 62 65 6c 28 50 65 |nsferredLabel(Pe| 00001af0 65 6b 4e 28 29 29 3d 30 20 54 48 45 4e 20 7b 0a |ekN())=0 THEN {.| 00001b00 09 20 52 65 61 64 4e 28 29 3b 20 6f 70 20 3a 3d |. ReadN(); op :=| 00001b10 20 52 65 61 64 4f 70 28 29 3b 0a 09 20 65 78 69 | ReadOp();.. exi| 00001b20 74 43 61 6c 6c 20 3a 3d 20 54 52 55 45 20 7d 3b |tCall := TRUE };| 00001b30 0a 0a 20 20 20 46 4f 52 20 72 20 3d 20 72 6d 69 |.. FOR r = rmi| 00001b40 6e 20 54 4f 20 72 6d 61 78 20 44 4f 0a 20 20 20 |n TO rmax DO. | 00001b50 20 20 20 49 46 20 55 73 69 6e 67 28 72 29 20 54 | IF Using(r) T| 00001b60 48 45 4e 20 4c 6f 63 6b 28 41 72 67 75 6d 65 6e |HEN Lock(Argumen| 00001b70 74 52 65 67 69 73 74 65 72 28 72 29 2c 20 6b 2e |tRegister(r), k.| 00001b80 72 65 67 29 3b 0a 0a 20 20 20 49 46 20 61 72 67 |reg);.. IF arg| 00001b90 6d 61 78 3e 35 20 54 48 45 4e 20 7b 0a 20 20 20 |max>5 THEN {. | 00001ba0 20 20 20 4c 45 54 20 6e 20 3d 20 6b 2b 34 2b 73 | LET n = k+4+s| 00001bb0 61 76 65 53 70 61 63 65 53 69 7a 65 3b 0a 20 20 |aveSpaceSize;. | 00001bc0 20 20 20 20 46 6c 75 73 68 50 65 6e 64 69 6e 67 | FlushPending| 00001bd0 53 74 6f 72 65 73 28 29 3b 0a 20 20 20 20 20 20 |Stores();. | 00001be0 53 65 74 52 74 6f 52 70 6c 75 73 4b 28 72 2e 74 |SetRtoRplusK(r.t| 00001bf0 73 2c 20 72 2e 70 2c 20 6e 65 78 74 53 74 61 63 |s, r.p, nextStac| 00001c00 6b 57 6f 72 64 2a 6e 29 3b 0a 20 20 20 20 20 20 |kWord*n);. | 00001c10 54 4f 53 4f 66 66 73 65 74 20 3a 3d 20 6e 20 7d |TOSOffset := n }| 00001c20 3b 0a 0a 20 20 20 53 74 6f 72 65 28 61 72 67 62 |;.. Store(argb| 00001c30 61 73 65 2b 34 2c 20 73 73 70 2d 32 29 3b 0a 20 |ase+4, ssp-2);. | 00001c40 20 20 46 4f 52 20 74 20 3d 20 74 65 6d 70 76 20 | FOR t = tempv | 00001c50 54 4f 20 61 72 67 32 20 42 59 20 73 73 73 69 7a |TO arg2 BY sssiz| 00001c60 65 20 44 4f 20 7b 0a 20 20 20 20 20 20 4c 45 54 |e DO {. LET| 00001c70 20 73 20 3d 20 68 35 21 74 3b 0a 20 20 20 20 20 | s = h5!t;. | 00001c80 20 49 46 20 73 3e 6b 20 54 48 45 4e 20 42 52 45 | IF s>k THEN BRE| 00001c90 41 4b 3b 0a 20 20 20 20 20 20 49 46 20 68 31 21 |AK;. IF h1!| 00001ca0 74 3d 6b 2e 72 65 67 20 54 48 45 4e 20 53 74 6f |t=k.reg THEN Sto| 00001cb0 72 65 54 28 74 29 20 7d 3b 0a 0a 20 20 20 46 4f |reT(t) };.. FO| 00001cc0 52 20 72 20 3d 20 72 6d 69 6e 20 54 4f 20 72 6d |R r = rmin TO rm| 00001cd0 61 78 20 44 4f 0a 20 20 20 20 20 20 4c 6f 63 6b |ax DO. Lock| 00001ce0 28 41 72 67 75 6d 65 6e 74 52 65 67 69 73 74 65 |(ArgumentRegiste| 00001cf0 72 28 72 29 2c 20 6b 2e 72 65 67 29 3b 0a 0a 20 |r(r), k.reg);.. | 00001d00 20 20 49 46 20 68 31 21 61 72 67 31 3d 6b 2e 72 | IF h1!arg1=k.r| 00001d10 65 67 20 26 20 68 33 21 61 72 67 31 3c 3d 72 6d |eg & h3!arg1<=rm| 00001d20 61 78 20 54 48 45 4e 20 7b 0a 20 20 20 20 20 20 |ax THEN {. | 00001d30 4d 6f 76 65 54 6f 52 28 72 2e 77 31 2c 20 61 72 |MoveToR(r.w1, ar| 00001d40 67 31 29 3b 0a 20 20 20 20 20 20 4c 6f 63 6b 28 |g1);. Lock(| 00001d50 72 2e 77 31 2c 20 6b 2e 72 65 67 29 20 7d 3b 0a |r.w1, k.reg) };.| 00001d60 0a 20 20 20 49 46 20 65 78 69 74 43 61 6c 6c 20 |. IF exitCall | 00001d70 54 48 45 4e 20 7b 0a 20 20 20 2f 2a 20 43 6f 6e |THEN {. /* Con| 00001d80 73 74 72 75 63 74 20 61 20 6c 69 73 74 20 6f 66 |struct a list of| 00001d90 20 74 68 65 20 66 72 61 6d 65 20 76 61 6c 75 65 | the frame value| 00001da0 73 20 77 68 69 63 68 20 61 72 65 20 6e 65 65 64 |s which are need| 00001db0 65 64 0a 20 20 20 20 20 20 69 6e 20 6c 6f 61 64 |ed. in load| 00001dc0 69 6e 67 20 76 61 6c 75 65 73 20 6f 66 20 61 72 |ing values of ar| 00001dd0 67 75 6d 65 6e 74 73 2e 20 20 50 65 6e 64 69 6e |guments. Pendin| 00001de0 67 20 73 74 6f 72 65 73 20 74 6f 20 6f 74 68 65 |g stores to othe| 00001df0 72 0a 20 20 20 20 20 20 6c 6f 63 61 74 69 6f 6e |r. location| 00001e00 73 20 69 6e 20 74 68 65 20 66 72 61 6d 65 20 6d |s in the frame m| 00001e10 61 79 20 74 68 65 6e 20 62 65 20 64 69 73 63 61 |ay then be disca| 00001e20 72 64 65 64 0a 20 20 20 20 2a 2f 0a 20 20 20 20 |rded. */. | 00001e30 20 20 4c 45 54 20 70 20 3d 20 30 3b 0a 20 20 20 | LET p = 0;. | 00001e40 20 20 20 46 4f 52 20 72 20 3d 20 31 20 54 4f 20 | FOR r = 1 TO | 00001e50 72 6d 61 78 20 44 4f 20 7b 0a 09 20 4c 45 54 20 |rmax DO {.. LET | 00001e60 6c 20 3d 20 61 72 67 62 61 73 65 2b 72 2d 31 3b |l = argbase+r-1;| 00001e70 0a 09 20 54 45 53 54 20 6c 3c 28 61 72 67 62 61 |.. TEST l<(argba| 00001e80 73 65 2b 74 65 6d 70 62 61 73 65 29 20 54 48 45 |se+tempbase) THE| 00001e90 4e 0a 09 20 20 20 20 70 20 3a 3d 20 46 69 6c 6c |N.. p := Fill| 00001ea0 42 6c 6b 28 32 2c 20 70 2c 20 6c 29 0a 09 20 45 |Blk(2, p, l).. E| 00001eb0 4c 53 45 20 7b 0a 09 20 20 20 20 6c 20 3a 3d 20 |LSE {.. l := | 00001ec0 74 65 6d 70 76 2b 73 73 73 69 7a 65 2a 28 6c 2d |tempv+sssize*(l-| 00001ed0 74 65 6d 70 62 61 73 65 2d 61 72 67 62 61 73 65 |tempbase-argbase| 00001ee0 29 3b 0a 09 20 20 20 20 49 46 20 68 31 21 6c 3d |);.. IF h1!l=| 00001ef0 6b 2e 6c 6f 63 20 54 48 45 4e 20 7b 0a 09 20 20 |k.loc THEN {.. | 00001f00 20 20 20 20 20 4c 45 54 20 73 20 3d 20 4c 6f 6f | LET s = Loo| 00001f10 6b 46 6f 72 28 6c 2c 20 4e 6f 74 41 64 64 72 29 |kFor(l, NotAddr)| 00001f20 3b 0a 09 20 20 20 20 20 20 20 49 46 20 73 3d 4e |;.. IF s=N| 00001f30 75 6c 6c 20 7c 20 73 3e 72 0a 09 09 20 20 54 48 |ull | s>r... TH| 00001f40 45 4e 20 70 20 3a 3d 20 46 69 6c 6c 42 6c 6b 28 |EN p := FillBlk(| 00001f50 32 2c 20 70 2c 20 68 33 21 6c 29 20 7d 20 7d 20 |2, p, h3!l) } } | 00001f60 7d 3b 0a 0a 20 20 20 20 20 20 49 46 20 6c 69 6e |};.. IF lin| 00001f70 6b 61 67 65 4e 6f 74 53 74 6f 72 65 64 20 54 48 |kageNotStored TH| 00001f80 45 4e 0a 09 20 46 4f 52 20 69 20 3d 20 30 20 54 |EN.. FOR i = 0 T| 00001f90 4f 20 73 61 76 65 53 70 61 63 65 53 69 7a 65 2d |O saveSpaceSize-| 00001fa0 31 20 44 4f 0a 09 20 20 20 20 70 20 3a 3d 20 46 |1 DO.. p := F| 00001fb0 69 6c 6c 42 6c 6b 28 32 2c 20 70 2c 20 69 29 3b |illBlk(2, p, i);| 00001fc0 0a 0a 20 20 20 20 20 20 44 65 6c 4c 6f 63 73 45 |.. DelLocsE| 00001fd0 78 63 65 70 74 28 70 29 3b 0a 20 20 20 20 20 20 |xcept(p);. | 00001fe0 57 48 49 4c 45 20 70 7e 3d 30 20 44 4f 20 7b 0a |WHILE p~=0 DO {.| 00001ff0 09 20 4c 45 54 20 71 20 3d 20 21 70 3b 0a 09 20 |. LET q = !p;.. | 00002000 46 72 65 65 42 6c 6b 28 70 2c 20 32 29 3b 0a 09 |FreeBlk(p, 2);..| 00002010 20 70 20 3a 3d 20 71 20 7d 20 7d 0a 0a 20 20 20 | p := q } }.. | 00002020 6c 6f 61 64 52 65 67 46 72 6f 6d 46 52 65 67 4f |loadRegFromFRegO| 00002030 4b 20 3a 3d 20 54 52 55 45 3b 0a 20 20 20 46 4f |K := TRUE;. FO| 00002040 52 20 74 20 3d 20 61 72 67 32 20 54 4f 20 74 65 |R t = arg2 TO te| 00002050 6d 70 76 20 42 59 20 2d 73 73 73 69 7a 65 20 44 |mpv BY -sssize D| 00002060 4f 20 7b 0a 20 20 20 20 20 20 4c 45 54 20 72 20 |O {. LET r | 00002070 3d 20 72 2e 61 31 2b 68 35 21 74 2d 61 72 67 62 |= r.a1+h5!t-argb| 00002080 61 73 65 3b 0a 20 20 20 20 20 20 49 46 20 72 3c |ase;. IF r<| 00002090 72 6d 69 6e 20 54 48 45 4e 20 42 52 45 41 4b 3b |rmin THEN BREAK;| 000020a0 0a 20 20 20 20 20 20 54 45 53 54 20 72 3c 3d 72 |. TEST r<=r| 000020b0 6d 61 78 20 54 48 45 4e 20 7b 0a 09 20 4c 45 54 |max THEN {.. LET| 000020c0 20 6e 20 3d 20 41 72 67 75 6d 65 6e 74 52 65 67 | n = ArgumentReg| 000020d0 69 73 74 65 72 28 72 29 3b 0a 09 20 4d 6f 76 65 |ister(r);.. Move| 000020e0 54 6f 52 53 6f 6d 65 54 69 6d 65 28 6e 2c 20 74 |ToRSomeTime(n, t| 000020f0 29 20 7d 0a 20 20 20 20 20 20 45 4c 53 45 0a 09 |) }. ELSE..| 00002100 20 53 74 6f 72 65 54 28 74 29 20 7d 3b 0a 20 20 | StoreT(t) };. | 00002110 20 6c 6f 61 64 52 65 67 46 72 6f 6d 46 52 65 67 | loadRegFromFReg| 00002120 4f 4b 20 3a 3d 20 46 41 4c 53 45 3b 0a 0a 20 20 |OK := FALSE;.. | 00002130 20 46 6c 75 73 68 50 65 6e 64 69 6e 67 4c 6f 61 | FlushPendingLoa| 00002140 64 73 28 29 3b 0a 20 20 20 49 46 20 65 78 69 74 |ds();. IF exit| 00002150 43 61 6c 6c 20 54 48 45 4e 20 44 65 6c 4c 6f 63 |Call THEN DelLoc| 00002160 73 41 62 6f 76 65 28 30 2c 20 54 52 55 45 29 3b |sAbove(0, TRUE);| 00002170 0a 20 20 20 46 6c 75 73 68 50 65 6e 64 69 6e 67 |. FlushPending| 00002180 53 74 6f 72 65 73 28 29 3b 0a 0a 20 20 20 70 72 |Stores();.. pr| 00002190 6f 63 4c 61 62 20 3a 3d 20 4c 61 62 65 6c 49 6e |ocLab := LabelIn| 000021a0 53 74 61 74 69 63 28 61 72 67 31 29 3b 0a 0a 20 |Static(arg1);.. | 000021b0 20 20 54 45 53 54 20 65 78 69 74 43 61 6c 6c 0a | TEST exitCall.| 000021c0 20 20 20 20 20 20 54 48 45 4e 20 54 4f 53 4f 66 | THEN TOSOf| 000021d0 66 73 65 74 20 3a 3d 20 2d 31 0a 20 20 20 20 20 |fset := -1. | 000021e0 20 45 4c 53 45 20 49 46 20 6b 7e 3d 54 4f 53 4f | ELSE IF k~=TOSO| 000021f0 66 66 73 65 74 20 26 0a 09 20 20 20 20 20 20 28 |ffset &.. (| 00002200 70 72 6f 63 4c 61 62 3d 4e 75 6c 6c 20 7c 0a 09 |procLab=Null |..| 00002210 20 20 20 20 20 20 20 4c 61 62 65 6c 46 6c 61 67 | LabelFlag| 00002220 67 65 64 28 70 72 6f 63 4c 61 62 2c 20 6c 61 62 |ged(procLab, lab| 00002230 2e 66 72 61 6d 65 6e 65 65 64 65 64 29 20 7c 0a |.frameneeded) |.| 00002240 09 20 20 20 20 20 20 20 4c 61 62 65 6c 46 6c 61 |. LabelFla| 00002250 67 67 65 64 28 70 72 6f 63 4c 61 62 2c 20 6c 61 |gged(procLab, la| 00002260 62 2e 70 72 6f 63 68 61 73 63 61 6c 6c 73 29 29 |b.prochascalls))| 00002270 20 54 48 45 4e 20 7b 0a 09 20 53 65 74 52 74 6f | THEN {.. SetRto| 00002280 52 70 6c 75 73 4b 28 72 2e 74 73 2c 20 72 2e 70 |RplusK(r.ts, r.p| 00002290 2c 20 6e 65 78 74 53 74 61 63 6b 57 6f 72 64 2a |, nextStackWord*| 000022a0 6b 29 3b 0a 09 20 54 4f 53 4f 66 66 73 65 74 20 |k);.. TOSOffset | 000022b0 3a 3d 20 6b 20 7d 3b 0a 0a 20 20 20 49 46 20 74 |:= k };.. IF t| 000022c0 65 6d 70 62 61 73 65 3e 30 20 54 48 45 4e 20 7b |empbase>0 THEN {| 000022d0 0a 20 20 20 20 20 20 4c 45 54 20 72 20 3d 20 31 |. LET r = 1| 000022e0 2b 74 65 6d 70 62 61 73 65 2d 31 3b 0a 20 20 20 |+tempbase-1;. | 000022f0 20 20 20 4c 45 54 20 6f 66 66 73 65 74 20 3d 20 | LET offset = | 00002300 6e 65 78 74 53 74 61 63 6b 57 6f 72 64 2a 28 6b |nextStackWord*(k| 00002310 2b 73 61 76 65 53 70 61 63 65 53 69 7a 65 29 3b |+saveSpaceSize);| 00002320 0a 20 20 20 20 20 20 49 46 20 72 3e 34 20 54 48 |. IF r>4 TH| 00002330 45 4e 20 72 20 3a 3d 20 34 3b 0a 20 20 20 20 20 |EN r := 4;. | 00002340 20 54 45 53 54 20 72 3d 31 20 54 48 45 4e 0a 09 | TEST r=1 THEN..| 00002350 20 47 65 6e 46 32 28 66 2e 6c 64 72 2c 20 41 72 | GenF2(f.ldr, Ar| 00002360 67 75 6d 65 6e 74 52 65 67 69 73 74 65 72 28 31 |gumentRegister(1| 00002370 29 2c 20 72 2e 70 2c 20 30 2c 20 6f 66 66 73 65 |), r.p, 0, offse| 00002380 74 29 0a 20 20 20 20 20 20 45 4c 53 45 20 7b 0a |t). ELSE {.| 00002390 09 20 4c 45 54 20 72 65 67 73 65 74 20 3d 20 30 |. LET regset = 0| 000023a0 3b 0a 09 20 53 65 74 52 74 6f 52 70 6c 75 73 4b |;.. SetRtoRplusK| 000023b0 28 72 2e 30 2c 20 72 2e 70 2c 20 6f 66 66 73 65 |(r.0, r.p, offse| 000023c0 74 29 3b 0a 09 20 46 4f 52 20 73 20 3d 20 31 20 |t);.. FOR s = 1 | 000023d0 54 4f 20 72 20 44 4f 0a 09 20 20 20 20 72 65 67 |TO r DO.. reg| 000023e0 73 65 74 20 3a 3d 20 72 65 67 73 65 74 2b 28 31 |set := regset+(1| 000023f0 3c 3c 41 72 67 75 6d 65 6e 74 52 65 67 69 73 74 |<<ArgumentRegist| 00002400 65 72 28 73 29 29 3b 0a 09 20 46 34 49 6e 73 74 |er(s));.. F4Inst| 00002410 28 66 2e 6c 64 6d 2c 20 72 2e 30 2c 20 72 65 67 |(f.ldm, r.0, reg| 00002420 73 65 74 2c 20 75 70 53 74 61 63 6b 29 20 7d 20 |set, upStack) } | 00002430 7d 3b 0a 0a 20 20 20 54 45 53 54 20 70 72 6f 63 |};.. TEST proc| 00002440 4c 61 62 7e 3d 4e 75 6c 6c 20 54 48 45 4e 0a 20 |Lab~=Null THEN. | 00002450 20 20 20 20 20 54 45 53 54 20 65 78 69 74 43 61 | TEST exitCa| 00002460 6c 6c 20 54 48 45 4e 20 7b 0a 09 20 49 46 20 75 |ll THEN {.. IF u| 00002470 73 65 73 46 72 61 6d 65 20 26 20 7e 6c 69 6e 6b |sesFrame & ~link| 00002480 61 67 65 4e 6f 74 53 74 6f 72 65 64 20 54 48 45 |ageNotStored THE| 00002490 4e 20 7b 0a 09 20 20 20 20 4c 45 54 20 6c 64 6d |N {.. LET ldm| 000024a0 54 79 70 65 20 3d 20 72 65 76 65 72 73 65 64 53 |Type = reversedS| 000024b0 74 61 63 6b 20 7c 20 73 61 76 65 53 70 61 63 65 |tack | saveSpace| 000024c0 53 69 7a 65 3d 33 20 2d 3e 20 75 70 53 74 61 63 |Size=3 -> upStac| 000024d0 6b 2c 0a 09 09 09 09 09 09 09 20 20 20 20 20 75 |k,........ u| 000024e0 70 53 74 61 63 6b 2b 66 2e 70 72 65 3b 0a 09 20 |pStack+f.pre;.. | 000024f0 20 20 20 47 65 6e 52 52 28 66 2e 6d 6f 76 2c 20 | GenRR(f.mov, | 00002500 72 2e 74 73 2c 20 30 2c 20 72 2e 70 29 3b 0a 09 |r.ts, 0, r.p);..| 00002510 20 20 20 20 46 34 49 6e 73 74 28 66 2e 6c 64 6d | F4Inst(f.ldm| 00002520 2c 20 72 2e 70 2c 20 66 34 2e 70 6c 31 34 2c 20 |, r.p, f4.pl14, | 00002530 6c 64 6d 54 79 70 65 29 20 7d 3b 0a 09 20 4a 75 |ldmType) };.. Ju| 00002540 6d 70 28 70 72 6f 63 4c 61 62 29 20 7d 0a 20 20 |mp(procLab) }. | 00002550 20 20 20 20 45 4c 53 45 0a 09 20 46 35 49 6e 73 | ELSE.. F5Ins| 00002560 74 4c 28 6d 2e 61 6c 77 61 79 73 2c 20 70 72 6f |tL(m.always, pro| 00002570 63 4c 61 62 2c 20 66 2e 62 6c 29 0a 0a 0a 20 20 |cLab, f.bl)... | 00002580 20 45 4c 53 45 20 54 45 53 54 20 7e 75 73 65 73 | ELSE TEST ~uses| 00002590 46 72 61 6d 65 20 7c 20 6c 69 6e 6b 61 67 65 4e |Frame | linkageN| 000025a0 6f 74 53 74 6f 72 65 64 20 54 48 45 4e 0a 20 20 |otStored THEN. | 000025b0 20 20 20 20 54 45 53 54 20 72 62 49 6e 43 61 6c | TEST rbInCal| 000025c0 6c 73 20 54 48 45 4e 20 7b 20 20 2f 2f 20 6d 75 |ls THEN { // mu| 000025d0 73 74 20 62 65 20 61 6e 20 65 78 69 74 20 63 61 |st be an exit ca| 000025e0 6c 6c 2e 0a 09 20 4d 6f 76 65 54 6f 52 28 72 2e |ll... MoveToR(r.| 000025f0 62 2c 20 61 72 67 31 29 3b 0a 09 20 47 65 6e 52 |b, arg1);.. GenR| 00002600 52 28 66 2e 6d 6f 76 2c 20 72 2e 70 63 2c 20 72 |R(f.mov, r.pc, r| 00002610 2e 70 63 2c 20 72 2e 62 29 0a 09 20 2f 2f 20 54 |.pc, r.b).. // T| 00002620 68 65 20 73 65 63 6f 6e 64 20 72 2e 70 63 20 64 |he second r.pc d| 00002630 69 73 74 69 6e 67 75 69 73 68 65 73 20 74 68 69 |istinguishes thi| 00002640 73 20 61 73 20 61 6e 0a 09 20 2f 2f 20 65 78 69 |s as an.. // exi| 00002650 74 20 63 61 6c 6c 2e 0a 20 20 20 20 20 20 7d 0a |t call.. }.| 00002660 20 20 20 20 20 20 45 4c 53 45 0a 09 20 4d 6f 76 | ELSE.. Mov| 00002670 65 54 6f 52 28 72 2e 70 63 2c 20 61 72 67 31 29 |eToR(r.pc, arg1)| 00002680 0a 0a 20 20 20 45 4c 53 45 20 54 45 53 54 20 63 |.. ELSE TEST c| 00002690 6f 6d 70 61 63 74 43 6f 64 65 20 54 48 45 4e 0a |ompactCode THEN.| 000026a0 20 20 20 20 20 20 54 45 53 54 20 65 78 69 74 43 | TEST exitC| 000026b0 61 6c 6c 20 54 48 45 4e 20 7b 0a 09 20 4d 6f 76 |all THEN {.. Mov| 000026c0 65 54 6f 52 28 72 2e 62 2c 20 61 72 67 31 29 3b |eToR(r.b, arg1);| 000026d0 0a 09 20 43 6f 6e 64 4a 75 6d 70 28 6d 2e 61 6c |.. CondJump(m.al| 000026e0 77 61 79 73 2c 20 65 78 69 74 43 61 6c 6c 4c 61 |ways, exitCallLa| 000026f0 62 29 20 7d 0a 20 20 20 20 20 20 45 4c 53 45 20 |b) }. ELSE | 00002700 7b 0a 09 20 4d 6f 76 65 54 6f 52 28 72 2e 62 2c |{.. MoveToR(r.b,| 00002710 20 61 72 67 31 29 3b 0a 09 20 46 35 49 6e 73 74 | arg1);.. F5Inst| 00002720 4c 28 6d 2e 61 6c 77 61 79 73 2c 20 43 61 6c 6c |L(m.always, Call| 00002730 4c 61 62 2c 20 66 2e 62 6c 29 20 7d 0a 0a 20 20 |Lab, f.bl) }.. | 00002740 20 45 4c 53 45 20 54 45 53 54 20 65 78 69 74 43 | ELSE TEST exitC| 00002750 61 6c 6c 20 54 48 45 4e 20 7b 0a 20 20 20 20 20 |all THEN {. | 00002760 20 4c 45 54 20 6c 64 6d 74 79 70 65 20 3d 20 72 | LET ldmtype = r| 00002770 65 76 65 72 73 65 64 53 74 61 63 6b 20 7c 20 73 |eversedStack | s| 00002780 61 76 65 53 70 61 63 65 53 69 7a 65 3d 33 20 2d |aveSpaceSize=3 -| 00002790 3e 20 75 70 53 74 61 63 6b 2c 0a 09 09 09 09 09 |> upStack,......| 000027a0 09 20 20 20 20 20 20 20 75 70 53 74 61 63 6b 2b |. upStack+| 000027b0 66 2e 70 72 65 3b 0a 20 20 20 20 20 20 4c 45 54 |f.pre;. LET| 000027c0 20 64 69 72 65 63 74 43 61 6c 6c 20 3d 20 54 52 | directCall = TR| 000027d0 55 45 3b 0a 20 20 20 20 20 20 49 46 20 72 62 49 |UE;. IF rbI| 000027e0 6e 43 61 6c 6c 73 20 7c 0a 09 20 28 68 31 21 61 |nCalls |.. (h1!a| 000027f0 72 67 31 7e 3d 6b 2e 72 65 67 20 26 20 68 31 21 |rg1~=k.reg & h1!| 00002800 61 72 67 31 7e 3d 6b 2e 67 6c 6f 62 29 20 54 48 |arg1~=k.glob) TH| 00002810 45 4e 20 7b 0a 09 20 4d 6f 76 65 54 6f 52 28 72 |EN {.. MoveToR(r| 00002820 2e 62 2c 20 61 72 67 31 29 3b 0a 09 20 64 69 72 |.b, arg1);.. dir| 00002830 65 63 74 43 61 6c 6c 20 3a 3d 20 46 41 4c 53 45 |ectCall := FALSE| 00002840 20 7d 3b 0a 0a 20 20 20 20 20 20 47 65 6e 52 52 | };.. GenRR| 00002850 28 66 2e 6d 6f 76 2c 20 72 2e 74 73 2c 20 30 2c |(f.mov, r.ts, 0,| 00002860 20 72 2e 70 29 3b 0a 20 20 20 20 20 20 46 34 49 | r.p);. F4I| 00002870 6e 73 74 28 66 2e 6c 64 6d 2c 20 72 2e 70 2c 20 |nst(f.ldm, r.p, | 00002880 66 34 2e 70 6c 31 34 2c 20 6c 64 6d 54 79 70 65 |f4.pl14, ldmType| 00002890 29 3b 0a 20 20 20 20 20 20 54 45 53 54 20 64 69 |);. TEST di| 000028a0 72 65 63 74 43 61 6c 6c 0a 09 20 54 48 45 4e 20 |rectCall.. THEN | 000028b0 4d 6f 76 65 54 6f 52 28 72 2e 70 63 2c 20 61 72 |MoveToR(r.pc, ar| 000028c0 67 31 29 0a 09 20 45 4c 53 45 20 47 65 6e 52 52 |g1).. ELSE GenRR| 000028d0 28 66 2e 6d 6f 76 2c 20 72 2e 70 63 2c 20 72 2e |(f.mov, r.pc, r.| 000028e0 70 63 2c 20 72 2e 62 29 20 7d 0a 0a 20 20 20 45 |pc, r.b) }.. E| 000028f0 4c 53 45 20 7b 0a 20 20 20 20 20 20 4c 45 54 20 |LSE {. LET | 00002900 64 69 72 65 63 74 43 61 6c 6c 20 3d 20 54 52 55 |directCall = TRU| 00002910 45 3b 0a 20 20 20 20 20 20 49 46 20 72 62 49 6e |E;. IF rbIn| 00002920 43 61 6c 6c 73 20 7c 0a 09 20 28 68 32 21 61 72 |Calls |.. (h2!ar| 00002930 67 31 3e 3d 30 20 7c 20 68 34 21 61 72 67 31 7e |g1>=0 | h4!arg1~| 00002940 3d 30 29 20 54 48 45 4e 20 7b 0a 09 20 4d 6f 76 |=0) THEN {.. Mov| 00002950 65 54 6f 52 28 72 2e 62 2c 20 61 72 67 31 29 3b |eToR(r.b, arg1);| 00002960 0a 09 20 64 69 72 65 63 74 43 61 6c 6c 20 3a 3d |.. directCall :=| 00002970 20 46 41 4c 53 45 20 7d 3b 0a 20 20 20 20 20 20 | FALSE };. | 00002980 47 65 6e 52 52 28 66 2e 6d 6f 76 2c 20 72 2e 31 |GenRR(f.mov, r.1| 00002990 34 2c 20 30 2c 20 72 2e 70 63 29 0a 20 20 20 20 |4, 0, r.pc). | 000029a0 20 20 54 45 53 54 20 64 69 72 65 63 74 43 61 6c | TEST directCal| 000029b0 6c 0a 09 20 54 48 45 4e 20 4d 6f 76 65 54 6f 52 |l.. THEN MoveToR| 000029c0 28 72 2e 70 63 2c 20 61 72 67 31 29 0a 09 20 45 |(r.pc, arg1).. E| 000029d0 4c 53 45 20 47 65 6e 52 52 28 66 2e 6d 6f 76 2c |LSE GenRR(f.mov,| 000029e0 20 72 2e 70 63 2c 20 30 2c 20 72 2e 62 29 20 7d | r.pc, 0, r.b) }| 000029f0 3b 0a 0a 20 20 20 44 69 73 63 61 72 64 52 65 67 |;.. DiscardReg| 00002a00 73 28 29 3b 0a 20 20 20 54 45 53 54 20 65 78 69 |s();. TEST exi| 00002a10 74 43 61 6c 6c 20 54 48 45 4e 20 7b 0a 20 20 20 |tCall THEN {. | 00002a20 20 20 20 49 6e 69 74 53 74 61 63 6b 28 73 74 61 | InitStack(sta| 00002a30 63 6b 41 74 45 6e 64 29 3b 0a 20 20 20 20 20 20 |ckAtEnd);. | 00002a40 64 65 61 64 43 6f 64 65 20 3a 3d 20 44 65 61 64 |deadCode := Dead| 00002a50 20 7d 0a 20 20 20 45 4c 53 45 20 7b 0a 20 20 20 | }. ELSE {. | 00002a60 20 20 20 53 74 61 63 6b 28 6b 29 3b 0a 20 20 20 | Stack(k);. | 00002a70 20 20 20 49 46 20 63 61 6c 6c 54 79 70 65 3d 73 | IF callType=s| 00002a80 2e 66 6e 61 70 20 54 48 45 4e 20 4c 6f 61 64 28 |.fnap THEN Load(| 00002a90 6b 2e 72 65 67 2c 20 41 72 67 75 6d 65 6e 74 52 |k.reg, ArgumentR| 00002aa0 65 67 69 73 74 65 72 28 31 29 29 3b 0a 20 20 20 |egister(1));. | 00002ab0 20 20 20 49 46 20 73 74 61 63 6b 41 74 45 6e 64 | IF stackAtEnd| 00002ac0 7e 3d 6b 20 54 48 45 4e 20 53 74 61 63 6b 28 73 |~=k THEN Stack(s| 00002ad0 74 61 63 6b 41 74 45 6e 64 29 20 7d 20 7d 0a 0a |tackAtEnd) } }..| 00002ae0 41 4e 44 20 43 47 41 70 70 6c 79 58 28 63 61 6c |AND CGApplyX(cal| 00002af0 6c 54 79 70 65 2c 20 6b 29 20 42 45 20 7b 0a 20 |lType, k) BE {. | 00002b00 20 20 4c 45 54 20 61 72 67 62 61 73 65 20 3d 20 | LET argbase = | 00002b10 6b 2b 73 61 76 65 53 70 61 63 65 53 69 7a 65 3b |k+saveSpaceSize;| 00002b20 0a 20 20 20 4c 45 54 20 74 65 6d 70 62 61 73 65 |. LET tempbase| 00002b30 20 3d 20 68 35 21 74 65 6d 70 76 2d 61 72 67 62 | = h5!tempv-argb| 00002b40 61 73 65 3b 0a 20 20 20 4c 45 54 20 72 6d 69 6e |ase;. LET rmin| 00002b50 2c 20 72 6d 61 78 20 3d 20 31 2b 74 65 6d 70 62 |, rmax = 1+tempb| 00002b60 61 73 65 2c 20 31 2b 68 35 21 61 72 67 32 2d 61 |ase, 1+h5!arg2-a| 00002b70 72 67 62 61 73 65 3b 0a 20 20 20 4c 45 54 20 61 |rgbase;. LET a| 00002b80 72 67 6d 61 78 20 3d 20 72 6d 61 78 3b 0a 20 20 |rgmax = rmax;. | 00002b90 20 4c 45 54 20 73 74 61 63 6b 41 74 45 6e 64 20 | LET stackAtEnd | 00002ba0 3d 20 6b 3b 0a 20 20 20 4c 45 54 20 70 72 6f 63 |= k;. LET proc| 00002bb0 4c 61 62 20 3d 20 4e 75 6c 6c 3b 0a 20 20 20 4c |Lab = Null;. L| 00002bc0 45 54 20 78 73 79 6d 20 3d 20 58 53 79 6d 49 6e |ET xsym = XSymIn| 00002bd0 53 74 61 74 69 63 28 61 72 67 31 29 3b 0a 20 20 |Static(arg1);. | 00002be0 20 4c 45 54 20 62 63 70 6c 43 6f 6e 74 65 78 74 | LET bcplContext| 00002bf0 20 3d 20 30 3b 0a 0a 20 20 20 49 46 20 72 6d 69 | = 0;.. IF rmi| 00002c00 6e 3c 31 20 54 48 45 4e 20 72 6d 69 6e 20 3a 3d |n<1 THEN rmin :=| 00002c10 20 31 3b 0a 20 20 20 49 46 20 72 6d 61 78 3e 34 | 1;. IF rmax>4| 00002c20 20 54 48 45 4e 20 72 6d 61 78 20 3a 3d 20 34 3b | THEN rmax := 4;| 00002c30 0a 0a 20 20 20 6f 70 20 3a 3d 20 52 65 61 64 4f |.. op := ReadO| 00002c40 70 28 29 3b 0a 20 20 20 57 48 49 4c 45 20 6f 70 |p();. WHILE op| 00002c50 3d 73 2e 73 74 61 63 6b 20 44 4f 20 7b 0a 20 20 |=s.stack DO {. | 00002c60 20 20 20 20 73 74 61 63 6b 41 74 45 6e 64 20 3a | stackAtEnd :| 00002c70 3d 20 52 65 61 64 4e 28 29 3b 0a 20 20 20 20 20 |= ReadN();. | 00002c80 20 6f 70 20 3a 3d 20 52 65 61 64 4f 70 28 29 20 | op := ReadOp() | 00002c90 7d 3b 0a 0a 20 20 20 46 4f 52 20 72 20 3d 20 72 |};.. FOR r = r| 00002ca0 6d 69 6e 20 54 4f 20 72 6d 61 78 20 44 4f 0a 20 |min TO rmax DO. | 00002cb0 20 20 20 20 20 49 46 20 55 73 69 6e 67 28 72 2d | IF Using(r-| 00002cc0 31 29 20 54 48 45 4e 20 4c 6f 63 6b 28 72 2d 31 |1) THEN Lock(r-1| 00002cd0 2c 20 6b 2e 72 65 67 29 3b 0a 0a 20 20 20 49 46 |, k.reg);.. IF| 00002ce0 20 61 72 67 6d 61 78 3e 35 20 54 48 45 4e 20 7b | argmax>5 THEN {| 00002cf0 0a 20 20 20 20 20 20 4c 45 54 20 6e 20 3d 20 6b |. LET n = k| 00002d00 2b 34 2b 73 61 76 65 53 70 61 63 65 53 69 7a 65 |+4+saveSpaceSize| 00002d10 3b 0a 20 20 20 20 20 20 46 6c 75 73 68 50 65 6e |;. FlushPen| 00002d20 64 69 6e 67 53 74 6f 72 65 73 28 29 3b 0a 20 20 |dingStores();. | 00002d30 20 20 20 20 53 65 74 52 74 6f 52 70 6c 75 73 4b | SetRtoRplusK| 00002d40 28 72 2e 74 73 2c 20 72 2e 70 2c 20 6e 65 78 74 |(r.ts, r.p, next| 00002d50 53 74 61 63 6b 57 6f 72 64 2a 6e 29 3b 0a 20 20 |StackWord*n);. | 00002d60 20 20 20 20 54 4f 53 4f 66 66 73 65 74 20 3a 3d | TOSOffset :=| 00002d70 20 6e 20 7d 3b 0a 0a 20 20 20 53 74 6f 72 65 28 | n };.. Store(| 00002d80 61 72 67 62 61 73 65 2b 34 2c 20 73 73 70 2d 32 |argbase+4, ssp-2| 00002d90 29 3b 0a 20 20 20 46 4f 52 20 74 20 3d 20 74 65 |);. FOR t = te| 00002da0 6d 70 76 20 54 4f 20 61 72 67 32 20 42 59 20 73 |mpv TO arg2 BY s| 00002db0 73 73 69 7a 65 20 44 4f 20 7b 0a 20 20 20 20 20 |ssize DO {. | 00002dc0 20 4c 45 54 20 73 20 3d 20 68 35 21 74 3b 0a 20 | LET s = h5!t;. | 00002dd0 20 20 20 20 20 49 46 20 73 3e 6b 20 54 48 45 4e | IF s>k THEN| 00002de0 20 42 52 45 41 4b 3b 0a 20 20 20 20 20 20 49 46 | BREAK;. IF| 00002df0 20 68 31 21 74 3d 6b 2e 72 65 67 20 54 48 45 4e | h1!t=k.reg THEN| 00002e00 20 53 74 6f 72 65 54 28 74 29 20 7d 3b 0a 0a 20 | StoreT(t) };.. | 00002e10 20 20 46 4f 52 20 72 20 3d 20 72 6d 69 6e 20 54 | FOR r = rmin T| 00002e20 4f 20 72 6d 61 78 20 44 4f 0a 20 20 20 20 20 20 |O rmax DO. | 00002e30 4c 6f 63 6b 28 72 2d 31 2c 20 6b 2e 72 65 67 29 |Lock(r-1, k.reg)| 00002e40 3b 0a 0a 20 20 20 6c 6f 61 64 52 65 67 46 72 6f |;.. loadRegFro| 00002e50 6d 46 52 65 67 4f 4b 20 3a 3d 20 54 52 55 45 3b |mFRegOK := TRUE;| 00002e60 0a 20 20 20 46 4f 52 20 74 20 3d 20 61 72 67 32 |. FOR t = arg2| 00002e70 20 54 4f 20 74 65 6d 70 76 20 42 59 20 2d 73 73 | TO tempv BY -ss| 00002e80 73 69 7a 65 20 44 4f 20 7b 0a 20 20 20 20 20 20 |size DO {. | 00002e90 4c 45 54 20 72 20 3d 20 72 2e 61 31 2b 68 35 21 |LET r = r.a1+h5!| 00002ea0 74 2d 61 72 67 62 61 73 65 3b 0a 20 20 20 20 20 |t-argbase;. | 00002eb0 20 49 46 20 72 3c 72 6d 69 6e 20 54 48 45 4e 20 | IF r<rmin THEN | 00002ec0 42 52 45 41 4b 3b 0a 20 20 20 20 20 20 54 45 53 |BREAK;. TES| 00002ed0 54 20 72 3c 3d 72 6d 61 78 20 54 48 45 4e 20 7b |T r<=rmax THEN {| 00002ee0 0a 09 20 4c 45 54 20 6e 20 3d 20 72 2d 31 3b 0a |.. LET n = r-1;.| 00002ef0 09 20 4d 6f 76 65 54 6f 52 53 6f 6d 65 54 69 6d |. MoveToRSomeTim| 00002f00 65 28 6e 2c 20 74 29 20 7d 0a 20 20 20 20 20 20 |e(n, t) }. | 00002f10 45 4c 53 45 0a 09 20 53 74 6f 72 65 54 28 74 29 |ELSE.. StoreT(t)| 00002f20 20 7d 3b 0a 20 20 20 6c 6f 61 64 52 65 67 46 72 | };. loadRegFr| 00002f30 6f 6d 46 52 65 67 4f 4b 20 3a 3d 20 46 41 4c 53 |omFRegOK := FALS| 00002f40 45 3b 0a 0a 20 20 20 46 6c 75 73 68 50 65 6e 64 |E;.. FlushPend| 00002f50 69 6e 67 4c 6f 61 64 73 28 29 3b 0a 20 20 20 46 |ingLoads();. F| 00002f60 6c 75 73 68 50 65 6e 64 69 6e 67 53 74 6f 72 65 |lushPendingStore| 00002f70 73 28 29 3b 0a 0a 20 20 20 49 46 20 6b 7e 3d 54 |s();.. IF k~=T| 00002f80 4f 53 4f 66 66 73 65 74 20 54 48 45 4e 20 7b 0a |OSOffset THEN {.| 00002f90 20 20 20 20 20 53 65 74 52 74 6f 52 70 6c 75 73 | SetRtoRplus| 00002fa0 4b 28 72 2e 74 73 2c 20 72 2e 70 2c 20 6e 65 78 |K(r.ts, r.p, nex| 00002fb0 74 53 74 61 63 6b 57 6f 72 64 2a 6b 29 3b 0a 20 |tStackWord*k);. | 00002fc0 20 20 20 20 54 4f 53 4f 66 66 73 65 74 20 3a 3d | TOSOffset :=| 00002fd0 20 6b 20 7d 3b 0a 0a 20 20 20 49 46 20 74 65 6d | k };.. IF tem| 00002fe0 70 62 61 73 65 3e 30 20 54 48 45 4e 20 7b 0a 20 |pbase>0 THEN {. | 00002ff0 20 20 20 20 20 4c 45 54 20 72 20 3d 20 31 2b 74 | LET r = 1+t| 00003000 65 6d 70 62 61 73 65 2d 31 3b 0a 20 20 20 20 20 |empbase-1;. | 00003010 20 4c 45 54 20 6f 66 66 73 65 74 20 3d 20 6e 65 | LET offset = ne| 00003020 78 74 53 74 61 63 6b 57 6f 72 64 2a 28 6b 2b 73 |xtStackWord*(k+s| 00003030 61 76 65 53 70 61 63 65 53 69 7a 65 29 3b 0a 20 |aveSpaceSize);. | 00003040 20 20 20 20 20 49 46 20 72 3e 34 20 54 48 45 4e | IF r>4 THEN| 00003050 20 72 20 3a 3d 20 34 3b 0a 20 20 20 20 20 20 54 | r := 4;. T| 00003060 45 53 54 20 72 3d 31 20 54 48 45 4e 0a 09 20 47 |EST r=1 THEN.. G| 00003070 65 6e 46 32 28 66 2e 6c 64 72 2c 20 72 2e 30 2c |enF2(f.ldr, r.0,| 00003080 20 72 2e 70 2c 20 30 2c 20 6f 66 66 73 65 74 29 | r.p, 0, offset)| 00003090 0a 20 20 20 20 20 20 45 4c 53 45 20 7b 0a 09 20 |. ELSE {.. | 000030a0 4c 45 54 20 72 65 67 73 65 74 20 3d 20 30 3b 0a |LET regset = 0;.| 000030b0 09 20 53 65 74 52 74 6f 52 70 6c 75 73 4b 28 72 |. SetRtoRplusK(r| 000030c0 2e 30 2c 20 72 2e 70 2c 20 6f 66 66 73 65 74 29 |.0, r.p, offset)| 000030d0 3b 0a 09 20 46 4f 52 20 73 20 3d 20 31 20 54 4f |;.. FOR s = 1 TO| 000030e0 20 72 20 44 4f 0a 09 20 20 20 20 72 65 67 73 65 | r DO.. regse| 000030f0 74 20 3a 3d 20 72 65 67 73 65 74 2b 28 31 3c 3c |t := regset+(1<<| 00003100 28 73 2d 31 29 29 3b 0a 09 20 46 34 49 6e 73 74 |(s-1));.. F4Inst| 00003110 28 66 2e 6c 64 6d 2c 20 72 2e 30 2c 20 72 65 67 |(f.ldm, r.0, reg| 00003120 73 65 74 2c 20 75 70 53 74 61 63 6b 29 20 7d 20 |set, upStack) } | 00003130 7d 3b 0a 0a 2f 2f 20 54 68 65 20 61 72 67 75 6d |};..// The argum| 00003140 65 6e 74 73 20 61 72 65 20 69 6e 20 74 68 65 20 |ents are in the | 00003150 72 69 67 68 74 20 72 65 67 69 73 74 65 72 73 3b |right registers;| 00003160 20 69 74 20 72 65 6d 61 69 6e 73 20 74 6f 0a 2f | it remains to./| 00003170 2f 20 20 20 20 20 73 61 76 65 20 74 68 65 20 42 |/ save the B| 00003180 43 50 4c 20 63 6f 6e 74 65 78 74 0a 2f 2f 20 20 |CPL context.// | 00003190 20 20 20 72 65 73 74 6f 72 65 20 74 68 65 20 22 | restore the "| 000031a0 4d 6f 64 75 6c 61 22 20 63 6f 6e 74 65 78 74 0a |Modula" context.| 000031b0 2f 2f 20 20 20 20 20 63 6f 70 79 20 6f 76 65 72 |// copy over| 000031c0 20 61 72 67 75 6d 65 6e 74 73 20 61 62 6f 76 65 | arguments above| 000031d0 20 34 0a 0a 2f 2f 20 54 68 65 72 65 27 73 20 67 | 4..// There's g| 000031e0 75 61 72 61 6e 74 65 65 64 20 73 70 61 63 65 20 |uaranteed space | 000031f0 74 6f 20 73 74 6f 72 65 20 74 68 65 20 42 43 50 |to store the BCP| 00003200 4c 20 63 6f 6e 74 65 78 74 2c 20 77 68 65 72 65 |L context, where| 00003210 20 74 68 65 20 63 61 6c 6c 65 64 0a 2f 2f 20 70 | the called.// p| 00003220 72 6f 63 65 64 75 72 65 20 77 6f 75 6c 64 20 73 |rocedure would s| 00003230 61 76 65 20 69 74 73 20 6c 69 6e 6b 61 67 65 20 |ave its linkage | 00003240 69 66 20 69 74 20 77 65 72 65 20 61 20 42 43 50 |if it were a BCP| 00003250 4c 20 6f 6e 65 2e 20 20 54 68 65 72 65 20 6f 6e |L one. There on| 00003260 6c 79 0a 2f 2f 20 63 6f 75 6c 64 20 62 65 20 61 |ly.// could be a| 00003270 6e 79 20 70 72 6f 62 6c 65 6d 20 69 66 20 74 68 |ny problem if th| 00003280 65 20 70 72 6f 63 65 64 75 72 65 20 68 61 73 20 |e procedure has | 00003290 6d 6f 72 65 20 74 68 61 6e 20 66 6f 75 72 20 61 |more than four a| 000032a0 72 67 75 6d 65 6e 74 73 2e 0a 2f 2f 20 49 74 27 |rguments..// It'| 000032b0 73 20 61 20 62 69 74 20 73 69 6c 6c 79 20 64 6f |s a bit silly do| 000032c0 69 6e 67 20 74 68 65 20 73 61 76 65 20 69 6e 20 |ing the save in | 000032d0 73 74 6f 72 65 20 69 66 20 74 68 65 72 65 27 73 |store if there's| 000032e0 20 6f 6e 6c 79 20 6f 6e 65 20 72 65 67 69 73 74 | only one regist| 000032f0 65 72 0a 2f 2f 20 74 68 61 74 27 73 20 69 6d 70 |er.// that's imp| 00003300 6f 72 74 61 6e 74 0a 20 20 20 7b 20 20 4c 45 54 |ortant. { LET| 00003310 20 73 74 6d 54 79 70 65 20 3d 20 72 65 76 65 72 | stmType = rever| 00003320 73 65 64 53 74 61 63 6b 20 2d 3e 20 66 2e 70 6f |sedStack -> f.po| 00003330 73 74 64 6f 77 6e 2c 20 66 2e 70 6f 73 74 75 70 |stdown, f.postup| 00003340 3b 0a 20 20 20 20 20 20 62 63 70 6c 43 6f 6e 74 |;. bcplCont| 00003350 65 78 74 20 3a 3d 20 28 31 3c 3c 72 2e 70 29 2b |ext := (1<<r.p)+| 00003360 28 31 3c 3c 72 2e 6e 69 6c 29 3b 0a 20 20 20 20 |(1<<r.nil);. | 00003370 20 20 49 46 20 75 73 65 73 52 6c 20 54 48 45 4e | IF usesRl THEN| 00003380 20 62 63 70 6c 43 6f 6e 74 65 78 74 20 3a 3d 20 | bcplContext := | 00003390 62 63 70 6c 43 6f 6e 74 65 78 74 2b 28 31 3c 3c |bcplContext+(1<<| 000033a0 72 2e 6c 29 3b 0a 20 20 20 20 20 20 49 46 20 6c |r.l);. IF l| 000033b0 69 6e 6b 61 67 65 4e 6f 74 53 74 6f 72 65 64 20 |inkageNotStored | 000033c0 54 48 45 4e 20 62 63 70 6c 43 6f 6e 74 65 78 74 |THEN bcplContext| 000033d0 20 3a 3d 20 62 63 70 6c 43 6f 6e 74 65 78 74 7c | := bcplContext|| 000033e0 28 28 31 3c 3c 72 2e 6c 29 2b 28 31 3c 3c 72 2e |((1<<r.l)+(1<<r.| 000033f0 31 34 29 29 3b 0a 20 20 20 20 20 20 46 34 49 6e |14));. F4In| 00003400 73 74 28 66 2e 73 74 6d 2c 20 72 2e 74 73 2c 20 |st(f.stm, r.ts, | 00003410 62 63 70 6c 43 6f 6e 74 65 78 74 2c 20 73 74 6d |bcplContext, stm| 00003420 54 79 70 65 29 3b 0a 20 20 20 20 20 20 47 65 6e |Type);. Gen| 00003430 52 52 28 66 2e 6d 6f 76 2c 20 34 2c 20 30 2c 20 |RR(f.mov, 4, 0, | 00003440 72 2e 74 73 29 20 7d 0a 0a 20 20 20 47 65 6e 46 |r.ts) }.. GenF| 00003450 31 4b 28 66 2e 73 75 62 2c 20 35 2c 20 72 2e 67 |1K(f.sub, 5, r.g| 00003460 2c 20 38 30 29 3b 0a 20 20 20 46 34 49 6e 73 74 |, 80);. F4Inst| 00003470 28 66 2e 6c 64 6d 2c 20 35 2c 20 28 31 3c 3c 31 |(f.ldm, 5, (1<<1| 00003480 30 29 2b 28 31 3c 3c 31 32 29 2b 28 31 3c 3c 31 |0)+(1<<12)+(1<<1| 00003490 33 29 2c 20 66 2e 70 6f 73 74 75 70 29 3b 0a 0a |3), f.postup);..| 000034a0 20 20 20 2f 2f 20 43 6f 70 79 20 6f 76 65 72 20 | // Copy over | 000034b0 61 72 67 75 6d 65 6e 74 73 2e 20 20 57 65 20 64 |arguments. We d| 000034c0 6f 6e 27 74 20 6e 65 65 64 20 74 6f 20 77 6f 72 |on't need to wor| 000034d0 72 79 20 61 62 6f 75 74 20 74 68 65 20 6c 69 6e |ry about the lin| 000034e0 6b 61 67 65 4e 6f 74 53 74 6f 72 65 64 0a 20 20 |kageNotStored. | 000034f0 20 2f 2f 20 63 61 73 65 3a 20 69 74 20 63 61 6e | // case: it can| 00003500 27 74 20 68 61 70 70 65 6e 20 69 66 20 77 65 20 |'t happen if we | 00003510 6e 65 65 64 20 74 6f 20 63 6f 70 79 2e 0a 20 20 |need to copy.. | 00003520 20 2f 2f 20 46 61 6c 6c 69 6e 67 20 73 74 61 63 | // Falling stac| 00003530 6b 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 |ks not supported| 00003540 20 21 21 21 21 21 0a 20 20 20 54 45 53 54 20 61 | !!!!!. TEST a| 00003550 72 67 6d 61 78 3d 35 20 54 48 45 4e 20 7b 0a 20 |rgmax=5 THEN {. | 00003560 20 20 20 20 20 47 65 6e 46 32 28 66 2e 6c 64 72 | GenF2(f.ldr| 00003570 2c 20 35 2c 20 72 2e 74 73 2c 20 30 2c 20 6e 65 |, 5, r.ts, 0, ne| 00003580 78 74 53 74 61 63 6b 57 6f 72 64 2a 28 73 61 76 |xtStackWord*(sav| 00003590 65 53 70 61 63 65 53 69 7a 65 2b 34 29 29 3b 0a |eSpaceSize+4));.| 000035a0 20 20 20 20 20 20 46 34 49 6e 73 74 28 66 2e 73 | F4Inst(f.s| 000035b0 74 6d 2c 20 31 32 2c 20 31 3c 3c 35 2c 20 66 2e |tm, 12, 1<<5, f.| 000035c0 70 72 65 64 6f 77 6e 2b 66 2e 77 62 29 20 7d 0a |predown+f.wb) }.| 000035d0 20 20 20 45 4c 53 45 20 49 46 20 61 72 67 6d 61 | ELSE IF argma| 000035e0 78 3e 35 20 54 48 45 4e 20 7b 0a 20 20 20 20 20 |x>5 THEN {. | 000035f0 20 4c 45 54 20 6e 20 3d 20 61 72 67 6d 61 78 2d | LET n = argmax-| 00003600 34 3b 0a 20 20 20 20 20 20 53 65 74 52 54 6f 52 |4;. SetRToR| 00003610 50 6c 75 73 4b 28 72 2e 74 73 2c 20 72 2e 74 73 |PlusK(r.ts, r.ts| 00003620 2c 20 6e 65 78 74 53 74 61 63 6b 57 6f 72 64 2a |, nextStackWord*| 00003630 28 73 61 76 65 53 70 61 63 65 53 69 7a 65 2b 61 |(saveSpaceSize+a| 00003640 72 67 4d 61 78 29 29 3b 0a 20 20 20 20 20 20 57 |rgMax));. W| 00003650 48 49 4c 45 20 6e 3e 30 20 44 4f 20 7b 0a 09 20 |HILE n>0 DO {.. | 00003660 4c 45 54 20 72 65 67 53 65 74 20 3d 20 6e 3d 31 |LET regSet = n=1| 00003670 20 2d 3e 20 28 31 3c 3c 35 29 2c 0a 09 09 20 20 | -> (1<<5),... | 00003680 20 20 20 20 6e 3d 32 20 2d 3e 20 28 31 3c 3c 35 | n=2 -> (1<<5| 00003690 29 2b 28 31 3c 3c 38 29 2c 0a 09 09 09 20 20 20 |)+(1<<8),.... | 000036a0 20 20 28 31 3c 3c 35 29 2b 28 31 3c 3c 38 29 2b | (1<<5)+(1<<8)+| 000036b0 28 31 3c 3c 31 34 29 3b 0a 09 20 46 34 49 6e 73 |(1<<14);.. F4Ins| 000036c0 74 28 66 2e 6c 64 6d 2c 20 72 2e 74 73 2c 20 72 |t(f.ldm, r.ts, r| 000036d0 65 67 53 65 74 2c 20 66 2e 70 72 65 64 6f 77 6e |egSet, f.predown| 000036e0 29 3b 0a 09 20 46 34 49 6e 73 74 28 66 2e 73 74 |);.. F4Inst(f.st| 000036f0 6d 2c 20 31 32 2c 20 72 65 67 53 65 74 2c 20 66 |m, 12, regSet, f| 00003700 2e 70 72 65 64 6f 77 6e 2b 66 2e 77 62 29 3b 0a |.predown+f.wb);.| 00003710 09 20 6e 20 3a 3d 20 6e 2d 33 20 7d 20 7d 3b 0a |. n := n-3 } };.| 00003720 0a 20 20 20 46 35 49 6e 73 74 58 28 66 2e 62 6c |. F5InstX(f.bl| 00003730 2c 20 41 64 64 58 53 79 6d 62 6f 6c 28 78 73 79 |, AddXSymbol(xsy| 00003740 6d 2c 20 30 2c 20 30 29 2c 20 6d 2e 61 6c 77 61 |m, 0, 0), m.alwa| 00003750 79 73 29 3b 0a 20 20 20 49 46 20 63 61 6c 6c 54 |ys);. IF callT| 00003760 79 70 65 3d 73 2e 66 6e 61 70 20 54 48 45 4e 20 |ype=s.fnap THEN | 00003770 47 65 6e 52 52 28 66 2e 6d 6f 76 2c 20 41 72 67 |GenRR(f.mov, Arg| 00003780 75 6d 65 6e 74 52 65 67 69 73 74 65 72 28 31 29 |umentRegister(1)| 00003790 2c 20 30 2c 20 72 2e 30 29 3b 0a 20 20 20 7b 20 |, 0, r.0);. { | 000037a0 20 4c 45 54 20 6c 64 6d 54 79 70 65 20 3d 20 72 | LET ldmType = r| 000037b0 65 76 65 72 73 65 64 53 74 61 63 6b 20 2d 3e 20 |eversedStack -> | 000037c0 66 2e 70 6f 73 74 64 6f 77 6e 2c 20 66 2e 70 6f |f.postdown, f.po| 000037d0 73 74 75 70 3b 0a 20 20 20 20 20 20 46 34 49 6e |stup;. F4In| 000037e0 73 74 28 66 2e 6c 64 6d 2c 20 34 2c 20 62 63 70 |st(f.ldm, 4, bcp| 000037f0 6c 43 6f 6e 74 65 78 74 2c 20 6c 64 6d 54 79 70 |lContext, ldmTyp| 00003800 65 29 20 7d 0a 0a 20 20 20 44 69 73 63 61 72 64 |e) }.. Discard| 00003810 52 65 67 73 28 29 3b 0a 20 20 20 53 74 61 63 6b |Regs();. Stack| 00003820 28 6b 29 3b 0a 20 20 20 49 46 20 63 61 6c 6c 54 |(k);. IF callT| 00003830 79 70 65 3d 73 2e 66 6e 61 70 20 54 48 45 4e 20 |ype=s.fnap THEN | 00003840 4c 6f 61 64 28 6b 2e 72 65 67 2c 20 41 72 67 75 |Load(k.reg, Argu| 00003850 6d 65 6e 74 52 65 67 69 73 74 65 72 28 31 29 29 |mentRegister(1))| 00003860 3b 0a 20 20 20 49 46 20 73 74 61 63 6b 41 74 45 |;. IF stackAtE| 00003870 6e 64 7e 3d 6b 20 54 48 45 4e 20 53 74 61 63 6b |nd~=k THEN Stack| 00003880 28 73 74 61 63 6b 41 74 45 6e 64 29 3b 0a 20 20 |(stackAtEnd);. | 00003890 20 74 6f 73 4f 66 66 73 65 74 20 3a 3d 20 4e 75 | tosOffset := Nu| 000038a0 6c 6c 20 7d 0a 0a |ll }..| 000038a6