MakeDoPrivate.Mesa
Last Edited by: Spreitzer, September 3, 1985 8:48:20 pm PDT
Carl Hauser, April 11, 1985 3:34:27 pm PST
DIRECTORY BasicTime, CedarProcess, Commander, IO, List, MakeDo, RedBlackTree, Rope, TimeStamp;
MakeDoPrivate: CEDAR DEFINITIONS =
BEGIN OPEN MakeDo;
Locking Order:
n downward
c = n.producer.c downward
n = c.from.first(.cNext)*.n downward
...
Watch out for cycles in the dependency graph.
...
n upward
c = n.to.first(.nNext)*.c upward
n = c.makes.first(.cNext)*.c upward
NodeList: TYPE = LIST OF Node;
Node: TYPE = REF NodeRep;
NodeRep:
TYPE =
RECORD [
Invariant:
name: ROPE,
class: NodeClass,
Downward:
down: MyMonitorLock,
producer: Edge ← NIL,
props: PropList ← NIL,
Downward(producer):
lastVisit: Visit ← noVisit,
needed: BOOL ← FALSE,
Upward:
up: MONITORLOCK,
suspect:
BOOL ←
TRUE,
Suspect needs to be rederived.
to: ARRAY CmdDep OF EdgeRingHead ← ALL[emptyHead],
timeValid: BOOL ← FALSE,
forceNotExist: BOOL ← FALSE,
created: Time ← unknownTime,
Process stuff:
lockedOuts: LockoutList ← NIL
Yet Unclassified (i.e., wrong):
];
Command: TYPE = REF CommandRep;
CommandRep:
TYPE =
RECORD [
Invariant:
class: CommandClass,
foundData: REF ANY,
makes: EdgeRingHead ← emptyHead,
Downward:
down: MyMonitorLock,
cmd: ROPE,
from: ARRAY CmdDep OF EdgeRingHead ← ALL[emptyHead],
lastVisit: Visit ← noVisit,
missedSources: NodeList ← NIL,
outdatedAsked, outdated: BOOL ← FALSE,
suspectNeed, canBeDone: BOOL ← TRUE,
dataRecurse: BOOL ← FALSE,
failed, succeeded, aborted: BOOL ← FALSE,
whyOutdated: ROPE ← NIL,
reasonWhyLastDone: ROPE ← NIL,
Upward:
up: MONITORLOCK,
suspect:
ARRAY CmdDep
OF
BOOL ←
ALL[
TRUE],
Suspect this cmd needs to be rederived/rerun.
Process stuff:
lockedOuts: LockoutList ← NIL
Yet Unclassified (i.e., wrong):
];
MyMonitorLock:
TYPE =
RECORD [
locked: BOOL ← FALSE,
change: CONDITION];
NewMonitorLock: PROC RETURNS [mml: MyMonitorLock];
LockoutList: TYPE = LIST OF Lockout;
Lockout: TYPE = RECORD [sg: Subgoal, work: WorkRef];
EdgeRingHead: TYPE = RECORD [first, last: Edge];
emptyHead: EdgeRingHead = [NIL, NIL];
Edge: TYPE = REF EdgeRep;
EdgeRep:
TYPE =
RECORD [
Invariant:
optional: BOOL,
Invariant for c.from-n.to, Irrelevant for c.makes-n.producer:
traverseCreated: Time ← unknownTime,
Create time of some version (hopefully latest) extant before latest use certain to (have) happen(ed).
Invariant for cmd.makes, Downward for cmd.from
n: Node,
cNext, cPrev: Edge,
Upward for n.to, Downward for n.producer
c: Command,
nNext, nPrev: Edge
Yet Unclassified (i.e., wrong):
];
Visit: TYPE = RECORD [key: CARDINAL];
noVisit: Visit = [0];
Job: TYPE = REF JobRep;
JobRep:
TYPE =
RECORD [
wDir: ROPE,
visit: Visit,
goals, modifiable: Table,
boundaryKnown, assumeAllInconsistent, do, record: BOOL,
nSteps: NAT ← 0,
failedSteps: CommandList ← NIL,
cmds: ROPE ← NIL
];
WorkList: TYPE = LIST OF WorkRef;
WorkRef: TYPE = REF WorkRec;
WorkRec:
TYPE =
RECORD [
Arguments:
job: Job,
depth: INTEGER,
Callee temps:
change, cChange, dChange: BOOL ← FALSE,
Caller temps:
e: Edge ← NIL,
More Arguments:
subject:
SELECT kind: *
FROM
node => [goal: Node],
cmd => [c: Command, possibleNewNeed: Node],
ENDCASE
];
CWork: TYPE = REF WorkRec[cmd];
NWork: TYPE = REF WorkRec[node];
SubgoalList: TYPE = LIST OF Subgoal;
Subgoal: TYPE = REF SubgoalRep;
SubgoalRep:
TYPE =
RECORD [
job: Job,
toDo: Table--of Work not yet started--,
parent: WorkRef,
PerFinish: PROC [parent, sub: WorkRef] ← NIL,
AllDone: Continuation ← NIL,
state: SubgoalState ← unspecified,
locked: WorkRef ← NIL,
working: Table--of Work started but not yet finished-- ← NIL,
lockoutCount: INTEGER--# of ex-toDo's locked-- ← 0,
recursing: Table--of Subgoals started but not yet finished-- ← NIL,
caller: Subgoal ← NIL
];
SubgoalState: TYPE = {unspecified, workToDo, waitForWork, waitForLocks, waitForRecursion, needToFinish, waitForFinish, waitForTail, done};
Continuation: TYPE = PROC [parent: WorkRef] RETURNS [Subgoal];
debugging: BOOL;
leaf: Command;
Log: PROC [depth: INTEGER, fmt: ROPE, v1, v2, v3, v4, v5: IO.Value ← [null[]]];
Confirm: PROC [depth: INTEGER, action: ROPE];
GetCommanderHandle: PROC RETURNS [Commander.Handle];
AchieveGoal: PROC [Subgoal];
DestroyQueues: PROC;
NewVisit: PROC RETURNS [Visit];
EnumerateFinders: PROC [to: PROC [Finder]];
NewWorkTable: PROC RETURNS [Table];
InsertWork: PROC [Table, WorkRef];
IncrementStepCount: PROC [Job];
AddFailedCmd: PROC [Job, Command];
AddCommand: PROC [Job, ROPE];
IdGetKey: RedBlackTree.GetKey;
CompareNodes: RedBlackTree.Compare;
CompareRefs: RedBlackTree.Compare;
EnglishList: PROC [NodeList] RETURNS [el: ROPE, ec: CARDINAL];
NodeInTable: PROC [n: Node, t: Table] RETURNS [BOOL];
IsRootGoal: PROC [job: Job, n: Node] RETURNS [BOOL];
IsLeaf: PROC [job: Job, n: Node] RETURNS [BOOL];
Link: PROC [c: Command, ch: EdgeRingHead, n: Node, nh: EdgeRingHead, optional, suspect: BOOL] RETURNS [chNew, nhNew: EdgeRingHead];
EnumerateConsumerEdges: PROC [n: Node, which: CmdDep, to: PROC [Edge, CmdDep]];
ReallySuspectNodeChange:
PROC [n: Node, op: NTOp, stack: Table];
NTOp: TYPE = {forceNotExist, unforceNotExist, leaveNotExist};
UnlinkToFrom: PROC [e: Edge--on n.to=c.from--, which: CmdDep];
ShouldRemakeNode: PROC [n: Node, callerPromisesToDoIt: BOOL] RETURNS [BOOL];
CmdMayNeedRemaking: PROC [c: Command, which: CmdDep, stack: Table];
ShouldRemakeCmd: PROC [c: Command, which: CmdDep, callerPromisesToDoIt: BOOL] RETURNS [BOOL];
MayEnterDownNode: PROC [Node] RETURNS [in: BOOL];
ExitDownNode: PROC [n: Node];
NodeWork: PROC [nWork: NWork] RETURNS [sg: Subgoal];
MayEnterDownCmd: PROC [Command] RETURNS [in: BOOL];
ExitDownCmd: PROC [Command];
CmdWork: PROC [cWork: CWork] RETURNS [sg: Subgoal];
AddConsumption: PROC [c: Command, nl: NodeList, which: CmdDep, optional: BOOL];
RemoveConsumption: PROC [c: Command, which: CmdDep];
NeedsToBeDone: PROC [job: Job, c: Command, alwaysAsk: BOOL] RETURNS [missedResults: NodeList, outdated: BOOL];
END.