RCTW.mesa
Copyright Ó 1989, 1990, 1991, 1992 by Xerox Corporation. All rights reserved.
Hopcroft August 18, 1989 11:44:06 am PDT
Sturgis, August 18, 1989 11:57:05 am PDT
Last changed by Theimer on October 9, 1989 2:06:03 pm PDT
Last tweaked by Mike Spreitzer on April 10, 1992 3:29 pm PDT
Philip James, September 4, 1991 10:38 am PDT
Laurie Horton, May 29, 1992 10:15 am PDT
Jas, December 28, 1992 1:58 pm PST
DIRECTORY
CNumericTypes USING [NumericDescriptorBody],
CirioMemory USING [MemClass],
CirioNubAccess USING [Handle, RemoteAddress],
CirioTypes USING [BasicTypeInfo, BasicTypeInfoPrivate, BitAddr, bitsPerAu, bitsPerPtr, BitStretch, CC, CompilerContext, Mem, ModuleScope, Nat, Node, noMem, ptrSize, Type, unspecdBA, zeroBA],
IO USING [STREAM],
LoadStateAccess USING [BasicPCInfo, LoadedModuleInfo, LoadStateHandle],
NewRMTW USING [CedarModuleSet],
ObjectFiles USING [BracketNest, FileSegmentPC, Module, Stab, VarLoc, VarLocBody],
SGI USING [WireTables],
Records USING [FieldCase, RecordTypeProcs],
RefTab USING [Ref],
Rope USING [ROPE],
SourceFileOpsExtras,
SymTab USING [Ref],
SystemInterface USING [CirioFile, FileSet];
Note: (Sturgis) modified following notes made on August 25, 1989 2:07:31 pm PDT. Here is the note:
modified by Howard so that GetCCAndFrameFromDotO takes a module, rather than a parsed
RCTW: CEDAR DEFINITIONS =
BEGIN OPEN ObjF:ObjectFiles, LSA:LoadStateAccess;
ROPE: TYPE = Rope.ROPE;
RopeList: TYPE = LIST OF ROPE;
Nat: TYPE = CirioTypes.Nat;
CC: TYPE = CirioTypes.CompilerContext;
Type: TYPE = CirioTypes.Type;
Node: TYPE = CirioTypes.Node;
Mem: TYPE = CirioTypes.Mem;
BitStretch: TYPE = CirioTypes.BitStretch;
BitAddr: TYPE = CirioTypes.BitAddr;
BasicTypeInfo: TYPE = CirioTypes.BasicTypeInfo;
BasicTypeInfoPrivate: TYPE = CirioTypes.BasicTypeInfoPrivate;
bitsPerAu: Nat = CirioTypes.bitsPerAu;
bitsPerPtr: Nat = CirioTypes.bitsPerPtr;
unspecdBA: BitAddr = CirioTypes.unspecdBA;
zeroBA: BitAddr = CirioTypes.zeroBA;
ptrSize: BitAddr = CirioTypes.ptrSize;
noMem: Mem = CirioTypes.noMem;
RCTWData: TYPE = REF RCTWDataBody;
RCTWDataBody: TYPE = RECORD[
module: ObjF.Module,
bracketNest: ObjF.BracketNest,
bracketHashTable: RefTab.Ref,
typeRefHashTable: SymTab.Ref --typeRef -> AnalyzedTypeInfo - Private--,
serverName: ROPE,
lsh: LSA.LoadStateHandle,
nub: CirioNubAccess.Handle,
cc: CC];
FrameNodeInfo: TYPE ~ RECORD [
node: Node,
cc: CC,
following permits the debugger to display diagnostic info
getDiagnosticInfo: PROC[frame: REF FrameNodeInfo] RETURNS[RopeList],
data: REF ANY
];
AnalyzedTypeInfo is type time information.
AnalyzedTypeInfo: TYPE = REF AnalyzedTypeInfoBody;
AnalyzedTypeInfoBody: TYPE = RECORD[
atiValid, atiIsProc: BOOLEAN,
directType: Type,
rctw: RCTWData];
Record Contexts
Contexts are used to describe record types both by ordinary records (defined by some TypeStab) and by various frame components (nested blocks, arguments, and results). Consequently we provide a separate analysis to be used by both clients.
(The createNodeSchema procedure is intended for use by global frames. The fields of a global frame behave like fields of a normal record, (that is, the fields are never represented as a C variable), but there is no corresponding TypeStab from which to build a node schema.) I am not sure if this procedure will work in any other situation.)
AnalyzedCTX: TYPE = REF AnalyzedCTXBody;
AnalyzedCTXBody: TYPE = RECORD[
blockRecord: BOOL,
rctw: RCTWData,
recordType: Type, --the direct one
bitSize: BitAddr,
fields: SEQUENCE nFields: CARDINAL OF FieldInfo];
FieldInfo: TYPE = RECORD[
name: ROPE,
directType: Type, --valid only for ordinary records
idStab: DotOListings, --valid only for block records
fiValid: BOOLEANFALSE,
fiIsProc: BOOLEANFALSE,
fieldDirectType: Type, -- valid iff fiValid & fieldCase#typeTimeConstant
fieldCase: Records.FieldCase, --valid iff fiValid
fieldLoc: REF ANY];
fieldLoc is either a DotOAccess.VarLoc (if this context describes an ArgRecord, ResultRecord, or NestedBlockRecord) or is a REF BitStretch (if this context describes an ordinary Record). The appropriate value will be filled in at first use.
DotOListings: TYPE = REF DotOGlorp;
DotOListing: TYPE = REF ordinary DotOGlorp;
DotOEnumr: TYPE = REF enumerator DotOGlorp;
DotOGlorp: TYPE ~ RECORD [
rest: DotOListings,
first: SELECT kind: GlorpKind FROM
enumerator => [name: ROPE, value: INT, type: Type],
ordinary => [
descriptor: ROPE,
directType: Type,
stab: ObjF.Stab],
ENDCASE];
GlorpKind: TYPE ~ {enumerator, ordinary};
RemoteAddress: TYPE = CirioNubAccess.RemoteAddress;
InvalidRemoteAddress: RemoteAddress ~ [NIL, 0, 0, FALSE, FALSE];
var info
VarLoc: TYPE = ObjF.VarLoc;
VarLocBody: TYPE = ObjF.VarLocBody;
Mem
CreateSimpleMem: PROC[addr: CirioNubAccess.RemoteAddress, size: BitAddr ← unspecdBA] RETURNS[Mem];
Create a Simple Mem.
Procedure stuff
BracketEntry: TYPE = REF BracketEntryBody;
BracketEntryBody: TYPE = RECORD[
typeHashTable: SymTab.Ref,
symbolHashTable: SymTab.Ref--name -> DotOListings--,
typeNameHashTable: SymTab.Ref--name -> Type--
typeRefHashTable was moved into RCTWDataBody because we have observed that C compilers do not reuse typeRefs as so we don't need to scope them. (LH May 29, 1992 10:13:07 am PDT)
typeRefHashTable: SymTab.Ref --typeRef -> AnalyzedTypeInfo - Private--
];
EnumDef: TYPE = REF EnumDefBody;
EnumDefBody: TYPE = RECORD[
symbol: ROPE,
value: INT];
ProcedureFrameInfo: TYPE = REF ProcedureFrameInfoBody;
ProcedureFrameInfoBody: TYPE = RECORD[
folowing concern the dotO of the procedure invoking the frame
dotOLongName: ROPE,
mTime: CARD,
size: CARD,
codeBase: CARD,
dataBase: CARD,
bssBase: CARD,
following concern the frame itself
relativePC: CARD,
framePointer: CARD,
stackPointer: CARD];
Breakpoint stuff
CBreakAddress: TYPE = RECORD [
source: SystemInterface.CirioFile,
givenLineNumber: CARD,
moduleRelativePC: ObjectFiles.FileSegmentPC,
absPC: CARD,
stmtLineNumber: CARD,
loadedModule: REF LSA.LoadedModuleInfo];
GetAbsAddressForBreak: PROC [fileSet: SystemInterface.FileSet, src: SystemInterface.CirioFile, loadState: LSA.LoadStateHandle, sourceLine: CARD] RETURNS [REF CBreakAddress];
NIL means failure to compute
DescribeCBreakAddress: PROC [addr: REF CBreakAddress] RETURNS [RopeList];
In RCTWFrames.mesa:
The old ways are still with us:
EnsureAbsValid: PUBLIC PROC [nub: CirioNubAccess.Handle, nc: REF namedCommon VarLocBody];
In RCTWFrames.mesa:
ReallyAnalyzeTypeStab: PROC[sourceStream: IO.STREAM, bracketEntry: BracketEntry, rctw: RCTWData] RETURNS[AnalyzedTypeInfo];
When stream contains a TypeRef, returns the definition.
GetTokenRope: PROC [stream: IO.STREAM] RETURNS [ROPE];
VarLocFromDotOListings: PROC [dotOListings: DotOListings, rctw: RCTWData] RETURNS [VarLoc];
MakeSimpleFrame: PROC[frameInfo: ProcedureFrameInfo, rctw: RCTWData] RETURNS[Node];
GetModuleScope: PROC [RCTWData] RETURNS [CirioTypes.ModuleScope];
In RCTWOrdinaries.mesa:
AnalyzeType: PROC[sourceStream: IO.STREAM, bracketEntry: BracketEntry, rctw: RCTWData] RETURNS[AnalyzedTypeInfo];
Returns an unanalyzed one if stream contains a TypeRef.
AnalyzeTypeFromFile: PROC[auxIndex: INT32, wireTables: SGI.WireTables, bracketEntry: BracketEntry, rctw: RCTWData, stab: ObjF.Stab, symTabIndex: CARD] RETURNS[ati: RCTW.AnalyzedTypeInfo];
AnalyzeNumericFileStab: PROC[body: CNumericTypes.NumericDescriptorBody, length: CARD, rctw: RCTWData] RETURNS[AnalyzedTypeInfo];
AnalyzePointerTypeFileStab: PROC[auxIndex: INT32, wireTables: SGI.WireTables, bracketEntry: BracketEntry, rctw: RCTWData, stab: ObjF.Stab, symTabIndex: CARD] RETURNS[AnalyzedTypeInfo];
AnalyzeProcedureTypeFileStab: PROC [auxIndex: INT32, wireTables: SGI.WireTables, bracketEntry: BracketEntry, rctw: RCTWData, stab: ObjF.Stab, symTabIndex: CARD] RETURNS[AnalyzedTypeInfo];
CTXRecordTypeProcs: REF Records.RecordTypeProcs;
AnalyzedUnknownType: PROC[typeRef: Rope.ROPE, rctw: RCTWData] RETURNS [AnalyzedTypeInfo];
RCTWModules.mesa:
GetFrameNodeInfo: PROC [serverName: ROPE, frameInfo: ProcedureFrameInfo, handle: CirioNubAccess.Handle, lsh: LSA.LoadStateHandle, module: ObjF.Module] RETURNS [REF FrameNodeInfo];
GetCCAndFrameFromDotO: PROC [serverName: ROPE, frameInfo: ProcedureFrameInfo, handle: CirioNubAccess.Handle, lsh: LSA.LoadStateHandle, module: ObjF.Module] RETURNS [CC, Node];
CreateRCTW: PROC[cc: CC, serverName: ROPE, cirioNub: CirioNubAccess.Handle, lsh: LSA.LoadStateHandle, module: ObjF.Module, bracketNest: ObjF.BracketNest] RETURNS[RCTWData];
GetCCAndFrame: PROC[serverName: ROPE, frameInfo: ProcedureFrameInfo, handle: CirioNubAccess.Handle, lsh: LSA.LoadStateHandle] RETURNS [CC, Node];
RCTWSchemas.mesa:
GetSourcePosition: PROC [absPC: CARD, cms: NewRMTW.CedarModuleSet, basicInfo: REF LSA.BasicPCInfo, ledo: REF LSA.LoadedModuleInfo] RETURNS [SourceFileOpsExtras.Position];
END..