DIRECTORY CirioTypes USING[CompilerContext, Node, Type], Rope USING[ROPE]; Frames: CEDAR DEFINITIONS = BEGIN CC: TYPE = CirioTypes.CompilerContext; Type: TYPE = CirioTypes.Type; Node: TYPE = CirioTypes.Node; IndirectFrameTypeData: TYPE = RECORD[ enclosingContext: Type, -- an IndirectFrameType or IndirectGlobalFrameType args: Type, -- an Indirect Record or FieldList Type results: Type, -- an Indirect Record or FieldList Type blocks: SEQUENCE nBlocks: CARDINAL OF Type]; -- each is an Indirect FieldListType CreateIndirectFrameType: PROC[data: REF IndirectFrameTypeData, cc: CC] RETURNS[Type]; IndirectGlobalFrameTypeData: TYPE = RECORD[ globalVars: Type]; -- globalVars is a record type CreateIndirectGlobalFrameType: PROC[data: REF IndirectGlobalFrameTypeData, cc: CC] RETURNS[Type]; IndirectFrameData: TYPE = RECORD[ procedure: Node, -- eventually I have to decide what to do about catch phrases enclosingContext: Node, -- an IndirectFrame or IndirectGlobalFrame descriptor: Node, -- a Rope args: Node, -- an Indirect FieldList results: Node, -- an Indirect FieldList getSourcePosition: PROC[procData: REF ANY, cc: CC] RETURNS[Node], getCallingNode: PROC[procData: REF ANY, cc: CC] RETURNS[Node], procData: REF ANY, blocks: SEQUENCE nBlocks: CARDINAL OF Node]; -- each is an Indirect FieldList CreateIndirectFrameNode: PROC[data: REF IndirectFrameData, type: Type, cc: CC] RETURNS[Node]; IndirectGlobalFrameData: TYPE = RECORD[ descriptor: Node, -- RopeNode globalVars: Node]; -- globalVars is a record type CreateIndirectGlobalFrameNode: PROC[data: REF IndirectGlobalFrameData, type: Type, cc: CC] RETURNS[Node]; CreateSourcePositionNode: PROC[name: Rope.ROPE, index: INT, cc: CC] RETURNS[Node]; FrameAdvanceNameScope: PROC [node: Node, cc: CC] RETURNS [Node]; SourcePositionRep: TYPE = RECORD[name: Rope.ROPE, index: INT]; StackOfFrames: TYPE = REF StackOfFramesBody; StackOfFramesBody: TYPE = RECORD[ data: REF ANY, procs: REF StackOfFramesProcs]; StackOfFramesProcs: TYPE = RECORD[ walkStack: PROC[StackOfFrames, INT] RETURNS[Node]]; TargetWorld: TYPE = REF TargetWorldBody; TargetWorldBody: TYPE = RECORD[ twData: REF ANY, procs: REF TargetWorldProcs]; TargetWorldProcs: TYPE = RECORD[ getCodePositionFromSource: PROC[sourcePosition: Node, twData: REF ANY, cc: CC, atExit: BOOLEAN _ FALSE] RETURNS[Node], getSourcePositionFromCode: PROC[codePosition: Node, twData: REF ANY, cc: CC] RETURNS[Node], setBreak: PROC[codePosition: Node, twData: REF ANY, cc: CC] RETURNS[brkIndex: CARD], listBreaks: PROC[for: PROC[brkIndex: CARD, codePosition: Node], twData: REF ANY, cc: CC], getBrkIndexFromCodePos: PROC[codePosition: Node, twData: REF ANY, cc: CC] RETURNS[brkIndex: CARD], getCodePositionFromBrkIndex: PROC[brkIndex: CARD, twData: REF ANY, cc: CC] RETURNS[Node], clearOneBreak: PROC[brkIndex: CARD, twData: REF ANY, cc: CC], clearAllBreaks: PROC[twData: REF ANY, cc: CC], getBrkIndexFromBreakInfo: PROC[breakInfo: Node, twData: REF ANY, cc: CC] RETURNS[brkIndex: CARD], clearBrkFromBreakInfo: PROC[breakInfo: Node, twData: REF ANY, cc: CC] ]; CreateTargetWorldNode: PROC[tw: TargetWorld, cc: CC] RETURNS[Node]; CreateCodePosition: PROC[info: REF ANY, cc: CC] RETURNS[Node]; CreateBreakInfo: PROC[info: REF ANY, cc: CC] RETURNS[Node]; END.. € Frames.mesa Copyright Σ 1991 by Xerox Corporation. All rights reserved. Sturgis, November 20, 1988 Sturgis, March 24, 1990 4:14:55 pm PST Last changed by Theimer on July 16, 1989 4:46:23 pm PDT Spreitze, August 14, 1991 8:41 am PDT Types Identifiers will be looked up in the following order: iftd[nBlocks-1], ..., iftd[0], results, args, enclosingContext Note: There are two substantial limitations implied by this definition. (1) we do not acknowledge the existence of opens. (2) there is no provision for the enclosing module (or is this simpley a frame) nor for items obtained through interfaces. (1) can not be solved easily, because the symbol tables do not include information about opens. (Of course, one could parse the source file and reconstruct such information if one wanted to. Or, one could change the compiler to include such information in the symbol tables. (2) We shall tackle in due time. CCTypes.GetTypeRepresentation will return NIL. CCTypes.GetTypeRepresentation will return NIL. Hypothesis (MJS, May 16, 1991): these don't need to know how to CreateIndirect, because that's done for them in RMTWFrames. nodes Frame nodes respond to the following field extractions: &sourcePosition returns a SourcePositionNode &procedure returns the ProcedureNode for the procedure that the frame is an instance of. &descriptor returns the descriptor RopeNode &caller returns an indirect frame node for caller &enclosingContext returns an indirect frame node or globalframe node for enclosing context Note: one can determine the source position associated with the pc of an indirectFrameNode as follows: CedarCode.ExtractFieldFromNode["&sourcePosition", indirectFrameNodeType, indirectFrameNode, cc] will return a SourcePositionNode. Indirect Global Frame nodes respond to the following field extraction &descriptor returns the descriptor RopeNode A SourcePositionNode accepts no operations except getNodeRepresentation. CedarCode.GetNodeRepresentation[node, cc] returns REF SourcePositionRep. The following is experimental Frames occur on stacks. We offer the following Cedar type for a stack. The debugger will use values of this type for obtaining frames. Target worlds will offer procedures which, when given the equivalent of a frame pointer, return a relevant stack, whose current frame is that given by the initial frame pointer. walkStack moves the currentFrame pointer, and returns a Node for the resulting curretnFrame. 0 just returns the currentFrame. +1 sets the currentFrame pointer to the caller of currentFrame. -1 sets the currentFrame pointer to the frame called by the currentFrame. One may move in units of more than 1. moves that would carry one beyond the ends of the stack leave one positioned on the appropriate end frame of the stack. (At the moment, no error is generated.) The following is even more experimental Stacks (and other data) occur in target worlds positions If, when calling getCodePositionFromSource, atExit is true, then the codePoint is at the exit of whatever procedure contains the source position. Otherwise, the codePoint is at some (implementation dependent) convenient position preceeding (or equal to) the given source position. In any case, several source positions may produce the same code position. Thus, one would not expect the source position obtained from a code position to agree with the source position from which the code position was obtained. breakpoints brkIndex = 0 means we don't recognize it brkIndex = 0 means we don't recognize it Note: these breakpoint procedures invoke ENTRY procedures. There will be a monitor deadlock if one attempts to call clearOneBreak from inside listBreaks.for. getCodePositionFromBrkIndex returns NIL if there is no corresponding break entry. CedarCode.GetNodeRepresentation[node, cc] will return tw. We hide this information inside a Node so that CCTypes will not depend on Frames. (Because CCTypes traffics in target worlds.) BreakPoints are installed at CodePositions. These are target world dependent nodes. One must be careful when calling target world procedures that involve code positions to be sure one is using the target world of the code position. CedarCode.ExtractFieldFromNode["&targetWorld", CedarCode.GetTypeOfNode[codePositionNode], codePositionNode, cc] will return the target world of the code position. CedarCode.GetNodeRepresentation[codePositionNode, cc] returns the info used to create the code position node. When breakpoints occur, they are identified by a BreakInfo node. These are target world dependent nodes. As usual, one must be sure that the target world of the node corresponds to the target world of the break procedure that one is calling. CedarCode.ExtractFieldFromNode["&targetWorld", CedarCode.GetTypeOfNode[breakInfoNode], breakInfoNode, cc] will return the target world of the breakpoint. CedarCode.GetNodeRepresentation[breakInfoNode, cc] returns the info used to create the BreakInfo node. Κ^•NewlineDelimiter ™codešœ ™ K™Kšœ œœ˜Kšœœ œœŸ ˜M—K˜Kš žœœœ$œœ˜]K˜šœ7™7Kšœ-™-KšœY™YK™,K™1K™Z—K™K˜Kšœι™ιK™šœœœ˜'Kšœ  ˜KšœŸ˜1—K˜š žœœœ*œœ˜išœE™EKšœ,™,——K™š žœœ œ œœœ˜RKšœ’™’—K™Kšžœœœœ˜@K˜Kš œœœ œ œ˜>—K˜K˜K˜šœ™Kšœ™Kšœ.™.Kšœ?™?Kšœ±™±K˜Kšœœœ˜,šœœœ˜!Kšœœœ˜Kšœœ˜—K˜šœœœ˜"Kšœ œœœ˜3K˜KšœΣ™Σ——K™šœ'™'K™Kšœ.™.K˜Kšœ œœ˜(šœœœ˜Kšœœœ˜Kšœœ˜—K˜šœœœ˜ K˜šœ ™ Kšœœœœœ œœœ˜vKš œœœœœœ˜[K˜Kšœ™™™K™Kšœδ™δ—K™Kšœ ™ ˜Kš œ œœœœœ œ˜TKš œ œœ œœœœ˜Yš œœœœœœ œ˜bKšœ(™(—Kš œœ œ œœœœ˜YKš œœ œ œœœ˜=Kš œœ œœœ˜.š œœœœœœ œ˜aKšœ(™(—Kš œœœœœ˜EK™Kšœρ™ρ—K™˜K™——K™K™šžœœœœ˜CKšœΊ™Ί—K™K˜K˜Kšœι™ι™š žœœœœœœ˜>Kšœ‘™‘——K˜šœσ™σK˜š žœœœœœœ˜;Kšœ™——K™—Kšœ˜——…— Ξ&¬