SaffronProgramGraphPrivateTypes.Mesa
James Rauen, August 7, 1988 4:19:15 pm PDT
Last edited by: James Rauen August 23, 1988 3:55:44 pm PDT
DIRECTORY
Rope USING [ROPE],
SaffronBaseDef USING [ValueNode];
SaffronProgramGraphPrivateTypes: CEDAR DEFINITIONS = BEGIN
OPEN BD: SaffronBaseDef;
Parameterized Field Descriptor
ParameterizedFieldDescriptorNode: TYPE = REF ParameterizedFieldDescriptorNodeBody;
ParameterizedFieldDescriptorNodeBody: TYPE = RECORD [
firstCell: ParameterizedFieldDescriptorCell,
lastCell: ParameterizedFieldDescriptorCell
];
ParameterizedFieldDescriptorCell: TYPE = REF ParameterizedFieldDescriptorCellBody;
ParameterizedFieldDescriptorCellBody: TYPE = RECORD [
next: ParameterizedFieldDescriptorCell,
k: SELECT kind: * FROM
index    => [], -- find it on the stack!
index    => [index: BD.ValueNode],
nested   => [],
staticLink  => [],
vars    => [name: Rope.ROPE],
fieldName  => [name: Rope.ROPE]
ENDCASE
];
Program Graph
ProgramGraphNode: TYPE = REF ProgramGraphNodeBody;
ProgramGraphNodeBody: TYPE = RECORD [
main: ProcedureGraphNode,
firstSubroutine: ProcedureGraphCell,
lastSubroutine: ProcedureGraphCell
];
ProcedureGraphCell: TYPE = REF ProcedureGraphCellBody;
ProcedureGraphCellBody: TYPE = RECORD [
next: ProcedureGraphCell,
procedureGraph: ProcedureGraphNode
];
ProcedureGraphNode: TYPE = REF ProcedureGraphNodeBody;
ProcedureGraphNodeBody: TYPE = RECORD [
code: ProgramFragmentNode
];
Invariant: code.exitingOperations = NIL
ProgramFragmentNode: TYPE = REF ProgramFragmentNodeBody;
ProgramFragmentNodeBody: TYPE = RECORD [
firstOperation: OperationNode,
exitingOperations: LIST OF OperationNode
];
Invariant: operation: OperationNode  exitingOperations:
operation.outgoingActionEdges = [label: next, to: NIL, next: NIL]
Also note that we represent a no-op program fragment as [NIL, NIL].
OperationNode: TYPE = REF OperationNodeBody;
OperationNodeBody: TYPE = RECORD [
signalCatchNode: SignalCatchNode,
outgoingActionEdges: OutgoingActionsCell,
effects: REF ANY
];
operation: SELECT primitiveOperation: * FROM
NoOp         => [op: OpNoOp],
PushConstant      => [op: OpPushConstant],
Test         => [op: OpTest],
UnaryFunction      => [op: OpUnaryFunction],
BinaryFunction      => [op: OpBinaryFunction],
LoadLocal       => [op: OpLoadLocal],
LoadIndirect       => [op: OpLoadIndirect],
StoreLocal       => [op: OpStoreLocal],
StoreIndirect       => [op: OpStoreIndirect],
New         => [op: OpNew],
Call         => [op: OpCall],
Return        => [op: OpReturn],
CreateProcedureDescriptor   => [op: OpCreateProcedureDescriptor],
SetLock        => [op: OpSetLock],
Sleep         => [op: OpSleep],
Wake         => [op: OpWake],
LoadOwnProcess      => [op: OpLoadOwnProcess],
Fork         => [op: OpFork],
Join         => [op: OpJoin],
Detach        => [op: OpDetach],
WaitForCondition     => [op: OpWaitForCondition],
NotifyCondition      => [op: OpNotifyCondition],
BroadcastToCondition    => [op: OpBroadcastToCondition],
EnterMonitor      => [op: OpEnterMonitor],
ExitMonitor       => [op: OpExitMonitor],
EnQueueSelf       => [op: OpEnQueueSelf],
DeQueueSelf       => [op: OpDeQueueSelf],
WakeOneOnQueue     => [op: OpWakeOneOnQueue],
WakeAllOnQueue     => [op: OpWakeAllOnQueue],
LockQueue       => [op: OpLockQueue],
ReleaseQueue      => [op: OpReleaseQueue],
SaveSignalParamters     => [op: OpSaveSignalParamters],
GetCatchNode      => [op: OpGetCatchNode],
GetCatchCodeProcedureDescriptor => [op: OpGetCatchCodeProcedureDescriptor],
GetNextCatchNode     => [op: OpGetNextCatchNode],
AcquireSignalParameters   => [op: OpAcquireSignalParameters],
DeleteCallerPFrame     => [op: OpDeleteCallerPFrame],
ENDCASE
];
OutgoingActionsCell: TYPE = REF OutgoingActionsCellBody;
OutgoingActionsCellBody: TYPE = RECORD [
label: OutgoingActionKind,
to: OperationNode,
next: OutgoingActionsCell
];
OutgoingActionKind: TYPE = {next, ifTrue, ifFalse};
SignalCatchNode: TYPE = REF SignalCatchNodeBody;
SignalCatchNodeBody: TYPE = RECORD [];
Stack Primitives
OpPushConstant: TYPE = REF OpPushConstantBody;
OpPushConstantBody: TYPE = RECORD [
constant: BD.ValueNode
];
OpTest: TYPE = REF OpTestBody;
OpTestBody: TYPE = RECORD [];
OpUnaryFunction: TYPE = REF OpUnaryFunctionBody;
OpUnaryFunctionBody: TYPE = RECORD [
nextActionIfSatisfactoryArguments: OperationNode,
f: SELECT function: * FROM
negate => [], -- these fields should contain next actions for unsatisfactory arguments.
not  => [],
ENDCASE
];
OpBinaryFunction: TYPE = REF OpBinaryFunctionBody;
OpBinaryFunctionBody: TYPE = RECORD [
nextActionIfSatisfactoryArguments: OperationNode,
f: SELECT function: * FROM
add  => [],
subtract => [],
multiply => [],
divide => [],
mod  => [],
and  => [],
or   => [],
equal  => [],
notEqual => [],
ENDCASE
];
Load/Store Operations
OpLoadLocal: TYPE = REF OpLoadLocalBody;
OpLoadLocalBody: TYPE = RECORD [
pfd: ParameterizedFieldDescriptorNode,
nextActionIfSatisfactoryIndices: OperationNode,
nextActionIfUnsatisfactoryIndices: OperationNode
];
OpLoadIndirect: TYPE = REF OpLoadIndirectBody;
OpLoadIndirectBody: TYPE = RECORD [
pfd: ParameterizedFieldDescriptorNode,
nextActionIfSatisfactoryIndices: OperationNode,
nextActionIfUnsatisfactoryIndices: OperationNode,
nextActionIfNilPointer: OperationNode
];
OpStoreLocal: TYPE = REF OpStoreLocalBody;
OpStoreLocalBody: TYPE = RECORD [
pfd: ParameterizedFieldDescriptorNode,
nextActionIfSatisfactoryIndices: OperationNode,
nextActionIfUnsatisfactoryIndices: OperationNode
];
OpStoreIndirect: TYPE = REF OpStoreIndirectBody;
OpStoreIndirectBody: TYPE = RECORD [
pfd: ParameterizedFieldDescriptorNode,
nextActionIfSatisfactoryIndices: OperationNode,
nextActionIfUnsatisfactoryIndices: OperationNode,
nextActionIfNilPointer: OperationNode
];
OpReturn: TYPE = REF OpReturnBody;
OpReturnBody: TYPE = RECORD [
];
END.