<> <> <> <> <<>> <> <<>> DIRECTORY MonitorSmallCachePmCode, Rope, SmallCacheUtils; <<>> TestMonitorSmallCachePmCode: CEDAR PROGRAM IMPORTS MonitorSmallCachePmCode, SmallCacheUtils ~ BEGIN IndexType: TYPE = {Label, ReturnAddress, IOAddr}; Index: ARRAY IndexType OF NAT _ ALL [0]; <<>> -- Begin Labels PC0: NAT = Next[Label]; PC1: NAT = Next[Label]; PC2: NAT = Next[Label]; PC3: NAT = Next[Label]; PC4: NAT = Next[Label]; PC5: NAT = Next[Label]; -- End Labels MaxPC: NAT = Next[Label]; Next: PROC [it: IndexType] RETURNS [index: NAT] = { index _ Index[it]; Index[it] _ Index[it]+1; }; Simple: PROC [p, newPC: NAT] = { vs: PROC [ix: NAT] RETURNS [NAT] = { RETURN[ix] }; Jmp: PROC [dest: NAT] = { PC _ dest; MonitorSmallCachePmCode.RecordPC[h, PC] }; SELECT p FROM = 0 => NULL; = 1 => NULL; = 2 => { SELECT vs[PC] FROM -- Begin Transitions = PC0 => { Jmp[PC1]; }; = PC1 => { SELECT newPC FROM = 2 => Jmp[PC2]; ENDCASE => Jmp[PC3] }; = PC2 => { Jmp[PC4]; }; = PC3 => { Jmp[PC4]; }; = PC4 => { Jmp[PC5]; }; = PC5 => { Jmp[PC0]; }; ENDCASE => ERROR; -- End Transitions }; ENDCASE => ERROR; }; Test: PROC [] = { PC _ PC0; MonitorSmallCachePmCode.RecordPC[h, PC]; Simple[2, 0]; --> PC1 Simple[2, 2]; --> PC2 Simple[2, 0]; --> PC4 Simple[2, 0]; --> PC5 Simple[2, 0]; --> PC0 Simple[2, 0]; --> PC1 Simple[2, 3]; --> PC3 Simple[2, 0]; --> PC4 Simple[2, 0]; --> PC5 Simple[2, 0]; --> PC0 Simple[2, 0]; --> PC1 Simple[2, 3]; --> PC3 Simple[2, 0]; --> PC4 Simple[2, 0]; --> PC5 Simple[2, 0]; --> PC0 Simple[2, 0]; --> PC1 Simple[2, 2]; --> PC2 Simple[2, 0]; --> PC4 Simple[2, 0]; --> PC5 <> MonitorSmallCachePmCode.RecordPC[h, PC5]; MonitorSmallCachePmCode.PrintUnVisitedPaths[h, LAST[NAT]]; ERROR }; PC: NAT; h: MonitorSmallCachePmCode.Handle _ MonitorSmallCachePmCode.ParseMCode["TestMonitorSmallCachePmCode.mesa", SmallCacheUtils.workingDirectory]; END.