diagnosticName: Rope.ROPE ← "unknown";
DoEval:
PROC = {
OPEN ClusterParams;
clusterPanel.continueTestFromAbort ← FALSE;
IF PhA
THEN {
RescheduleAB ← clusterPanel.resched;
ResetAB ← clusterPanel.reset};
[] ← RoseRun.Eval[ handle
! RoseTypes.Stop =>
IF clusterPanel.continueTestFromAbort
THEN CONTINUE ELSE REJECT ];
IF clusterPanel.reset THEN clusterPanel.instrCount ← -1;
Process.Yield[];
clusterPanel.continueTestFromAbort ← FALSE};
DoPh:
PROC [ ph: Dragon.Phase ] = {
cp: REF ClusterParams.ControlPanel ← ClusterParams.clusterPanel;
PhB ← ph=b;
PhA ← ph=a;
cp.phase ← ph;
DoEval[];
IF (cp.cycle >= cp.slowFromCycle
OR
(cp.cycle>=0
AND cp.instrCount >= cp.slowFromInstr))
AND
cp.stopInPh[ph] THEN {
Remark[
IO.PutFR["Doing cycle %g Ph%g...",
IO.int[cp.cycle], IO.char[IF ph=a THEN 'A ELSE 'B]]];
DoEval[] };
PhA ← PhB ← FALSE;
DoEval[];
WHILE cp.repeatPhase
DO
PhB ← ph=b; PhA ← ph=a; DoEval[];
Remark[
IO.PutFR["...repeating Ph%g evaluation..",
IO.char[IF ph=a THEN 'A ELSE 'B]]];
DoEval[];
PhA ← PhB ← FALSE; DoEval[];
ENDLOOP };
Chop:
PROC
RETURNS [ first, rest: Rope.
ROPE ←
NIL ] =
BEGIN
dStream: IO.STREAM = IO.RIS[ClusterParams.clusterPanel.diagnostic];
first ← dStream.GetTokenRope[IO.IDProc ! IO.EndOfStream => CONTINUE].token;
rest ← ClusterParams.clusterPanel.diagnostic.Substr[dStream.GetIndex];
END;
diagnosticFileName: Rope.ROPE ← diagnosticName ← Chop[].first;
ClusterError ← FALSE;
ClusterParams.clusterPanel.reset ← TRUE;
ClusterParams.clusterPanel.stopInPh ← ALL[TRUE];
ClusterParams.clusterPanel.repeatPhase ← ClusterParams.clusterPanel.resched ← FALSE;
ClusterParams.clusterPanel.cycle ← -1;
ClusterParams.clusterPanel.instrCount ← -1;
Cycles[5 !
DragonRosemary.AssertionFailed => RESUME;
RoseTypes.Stop => IF data = $FailedAssertion THEN RESUME ELSE REJECT ];
SELECT TRUE FROM
Rope.Equal[s1: diagnosticFileName, s2: "END", case: FALSE] => EXIT;
diagnosticFileName #
NIL =>
BEGIN
CacheOps.VirtualMemoryFromFile[ClusterParams.vm, diagnosticFileName ];
ClusterParams.lizardSimRef^ ← (IF ClusterParams.clusterPanel.lizardToo THEN LizardRosemary.StartNewLizard[ClusterParams.vm] ELSE NIL);
END;
ClusterParams.clusterPanel.randomSeed#0 =>
BEGIN
diagnosticName ← IO.PutFR["random code (seed = %d)", IO.int[ClusterParams.clusterPanel.randomSeed]];
ClusterParams.InsertRandomProgramInVM[ClusterParams.vm, ClusterParams.clusterPanel.randomSeed, ClusterParams.clusterLog];
ClusterParams.lizardSimRef^ ← (IF ClusterParams.clusterPanel.lizardToo THEN LizardRosemary.StartNewLizard[ClusterParams.vm] ELSE NIL);
END;
ENDCASE =>
EXIT;
-- test is finished!!!
DoPh[a];
ClusterError ← FALSE;
ClusterParams.clusterPanel.reset ← FALSE;
DoEval[]; -- changes ResetAB during PhA
DoPh[b];
IF ClusterParams.clusterPanel.slowFromCycle<=0 THEN Remark["Processor has been reset..."];
ClusterParams.clusterPanel.cycle ← 0;
ClusterParams.clusterLog.PutF["\n\n\n%g Dragon Rosemary simulation of %g beginning...\n\n",
IO.time[],
IO.rope[diagnosticName]];
WHILE ClusterParams.clusterPanel.randomSeed=0 OR ClusterParams.clusterPanel.cycle<=ClusterParams.clusterPanel.randomCycleLimit DO
ENABLE {
LizardRosemary.SuccessHalt => {
ClusterParams.clusterLog.PutF["\n%g Success XOP in %g at instruction %d, cycle %d.\n\n",
IO.time[],
IO.rope[diagnosticName],
IO.int[ClusterParams.clusterPanel.instrCount],
IO.int[ClusterParams.clusterPanel.cycle]];
EXIT;
};
LizardRosemary.Breakpoint => {
ClusterParams.clusterLog.PutF["\n%g Breakpoint XOP in %g at instruction %d, cycle %d.\n\n",
IO.time[],
IO.rope[diagnosticName],
IO.int[ClusterParams.clusterPanel.instrCount],
IO.int[ClusterParams.clusterPanel.cycle]];
SELECT
TRUE
FROM
ClusterParams.clusterPanel.emulateBreakpoint => RESUME;
diagnosticFileName # NIL => REJECT;
ENDCASE => EXIT;
};
DoPh[a];
IF ClusterParams.clusterPanel.ckptEveryNCycles > 0
AND ClusterParams.clusterPanel.ckptAtCycle <= ClusterParams.clusterPanel.cycle
THEN
ClusterParams.clusterPanel.ckptAtCycle ← ClusterParams.clusterPanel.cycle+ClusterParams.clusterPanel.ckptEveryNCycles;
ClusterParams.clusterPanel.cycle ← ClusterParams.clusterPanel.cycle+1;
IF ClusterParams.clusterPanel.ckpt
OR ClusterParams.clusterPanel.ckptAtCycle = ClusterParams.clusterPanel.cycle
THEN {
ClusterParams.clusterPanel.ckpt ← FALSE;
ClusterParams.CheckPoint[ClusterParams.clusterPanel.ckptFile, root]
};
ENDLOOP; -- on ClusterParams.clusterPanel.cycle
SELECT
TRUE
FROM
diagnosticFileName #
NIL =>
BEGIN
first, rest: Rope.ROPE;
[first, rest] ← Chop[];
IF first.Equal[diagnosticFileName]
THEN
ClusterParams.clusterPanel.diagnostic ← Rope.Cat[rest, " ",first];
END;
ClusterParams.clusterPanel.randomSeed # 0 =>
ClusterParams.clusterPanel.randomSeed ← ClusterParams.clusterPanel.randomSeed+1;
ENDCASE => NULL;
ENDLOOP; -- on ClusterParams.clusterPanel.randomSeed