DIRECTORY BasicTime USING[GMT], CardTab, CirioNubAccess USING[Handle, RemoteAddress], CirioTypes, LoadStateAccess USING[BasicPCInfo, LoadedModuleInfo, LoadedSegmentInfo, LoadStateHandle], MobAccess USING[BodySE, BTH, CTXH, CTXR, MobCookie, SEH, SER, TypeInfoConsSE], MobObjectFiles, MobDefs USING[VersionStamp], NewRMTW USING[CedarModuleSet], PFS, PFSNames USING [PATH], Records USING[FieldCase], RefTab USING[Ref], Rope USING[ROPE], Symbols USING[SEIndex, SENull], SystemInterface USING[CirioFile]; RMTWPrivate: CEDAR DEFINITIONS = BEGIN OPEN LSA:LoadStateAccess; ROPE: TYPE ~ Rope.ROPE; PATH: TYPE = PFSNames.PATH; Nat: TYPE = CirioTypes.Nat; Node: TYPE = CirioTypes.Node; Type: TYPE = CirioTypes.Type; CC: TYPE = CirioTypes.CompilerContext; BitAddr: TYPE = CirioTypes.BitAddr; BitStretch: TYPE = CirioTypes.BitStretch; Mem: TYPE = CirioTypes.Mem; BasicTypeInfo: TYPE = CirioTypes.BasicTypeInfo; BasicTypeInfoPrivate: TYPE = CirioTypes.BasicTypeInfoPrivate; ModuleScope: TYPE = CirioTypes.ModuleScope; SEH: TYPE = MobAccess.SEH; SER: TYPE = MobAccess.SER; CTXH: TYPE = MobAccess.CTXH; CTXR: TYPE = MobAccess.CTXR; bitsPerAu: Nat = CirioTypes.bitsPerAu; bitsPerPtr: Nat = CirioTypes.bitsPerPtr; unspecdBA: BitAddr = CirioTypes.unspecdBA; zeroBA: BitAddr = CirioTypes.zeroBA; ptrSize: BitAddr = CirioTypes.ptrSize; noMem: Mem = CirioTypes.noMem; RemoteMimosaTargetWorld: TYPE = REF RemoteMimosaTargetWorldBody; RemoteMimosaTargetWorldBody: TYPE = RECORD[ sehHash: SehHashTable, bthHash: BthHashTable, ctxHash: CtxHashTable, tcHash: CardTab.Ref--type code -> Type--, unknownSymbolFlushTime: BasicTime.GMT, ropeStudyTime: BasicTime.GMT, atomSei: Symbols.SEIndex _ Symbols.SENull, atomRecSeh: SEH, atomRecRT: Type, serverName: ROPE, nub: CirioNubAccess.Handle, cc: CC, moduleScope: ModuleScope, cedarModules: NewRMTW.CedarModuleSet, lsh: LSA.LoadStateHandle, setCTC: BOOL]; CtxHashTable: TYPE = REF CtxHashTableBody; CtxHashTableBody: TYPE = RECORD[table: RefTab.Ref]; CreateCtxHashTable: PROC RETURNS[CtxHashTable]; StudyRopes: PROC [rmtw: RemoteMimosaTargetWorld]; FindHelpingSehs: PROC [ctxh: CTXH, rmtw: RemoteMimosaTargetWorld] RETURNS [atomRecSeh: SEH]; FindSeh: PROC [ctxh: CTXH, name: ROPE, rmtw: RemoteMimosaTargetWorld] RETURNS [n, t: SEH]; BthHashTable: TYPE = REF BthHashTableBody; BthHashTableBody: TYPE = RECORD[table: RefTab.Ref]; CreateBthHashTable: PROC RETURNS[BthHashTable]; SehHashTable: TYPE = REF SehHashTableBody; SehHashTableBody: TYPE = RECORD[table: RefTab.Ref]; CreateSehHashTable: PROC RETURNS[SehHashTable]; UnderTypeSEH: PROC[seh: SEH, rmtw: RemoteMimosaTargetWorld] RETURNS[SEH]; SehKnowledge: TYPE ~ {none, notSpecial, ROPE, RopeRep, ATOM}; AnalyzeSEH: PROC[seh: SEH, rmtw: RemoteMimosaTargetWorld, sk: SehKnowledge] RETURNS[Type]; FmtSeh: PROC [seh: SEH, name: ROPE] RETURNS [ROPE]; TsDict: TYPE ~ REF TsDictPrivate; TsDictPrivate: TYPE ~ RECORD [ tc: CARD, ts: ROPE, defs: ARRAY CHAR OF TsDef _ ALL[[]] ]; TsDef: TYPE ~ RECORD [ start: INT _ INT.FIRST, type: Type _ NIL]; AnalyzeTc: PROC [rmtw: RemoteMimosaTargetWorld, tc: CARD] RETURNS [Type]; AnalyzeTs: PROC [rmtw: RemoteMimosaTargetWorld, tsd: TsDict, i: INT, opts: TsOptions _ ALL[FALSE]] RETURNS [Type, INT]; TsOptions: TYPE ~ PACKED ARRAY TsOption OF BOOL _ ALL[FALSE]; TsOption: TYPE ~ {mds, ordered, packed, readOnly, safe}; TsoSet: PROC [old: TsOptions, opt: TsOption] RETURNS [TsOptions] ~ INLINE {old[opt] _ TRUE; RETURN [old]}; AnalyzedCTX: TYPE = REF AnalyzedCTXBody; AnalyzedCTXBody: TYPE = RECORD[ painted, blockRecord, hasNtConst: BOOLEAN, recordType: Type, --direct fieldListType: Type, --direct ampersandFields: LIST OF FieldInfo, typeFields: LIST OF FieldInfo, rmtw: RemoteMimosaTargetWorld, bitSize: BitAddr, AnalyzeField: PROC [ctxInfo: AnalyzedCTX, index: CARDINAL, fi: FieldInfo] RETURNS [FieldInfo], repData: MobCtxRep, fields: SEQUENCE nFields: CARDINAL OF FieldInfo]; MobCtxRep: TYPE ~ REF MobCtxRepPrivate; MobCtxRepPrivate: TYPE ~ RECORD [ mob: MobAccess.MobCookie, jmpi: MobObjectFiles.JointMobParsedInfo, bth: MobAccess.BTH --present iff blockRecord ]; FieldInfo: TYPE = RECORD[ name: ROPE, rmtw: RemoteMimosaTargetWorld, fieldCase: Records.FieldCase, analysisValid: BOOLEAN _ FALSE, fieldDirectType: Type, -- valid only if analysisValid unionAnalysis: Type _ NIL, fieldLoc: REF BitStretch _ NIL, varLoc: MobObjectFiles.VarLoc _ NIL, repData: MobFieldRep ]; MobFieldRep: TYPE ~ REF MobFieldRepPrivate; MobFieldRepPrivate: TYPE ~ RECORD [ seh: SEH, ser: SER, serBody: REF id MobAccess.BodySE, sk: SehKnowledge]; AnalyzeTsRecord: PROC [rmtw: RemoteMimosaTargetWorld, tsd: TsDict, i: INT] RETURNS [Type, INT]; AnalyzeCTX: PROC[ctxh: CTXH, bindSeh: SEH, painted, unpackedArgResultRecord, blockRecord, maybeVariant, variantCases, isHelper, defer: BOOL, rmtw: RemoteMimosaTargetWorld, bitSize: BitAddr _ unspecdBA, jmpi: MobObjectFiles.JointMobParsedInfo _ NIL, bth: MobAccess.BTH _ NIL] RETURNS[ctxInfo: AnalyzedCTX, recType: Type]; GetCompleteContext: PROC[ctxh: CTXH, rmtw: RemoteMimosaTargetWorld] RETURNS[CTXH, CTXR]; CreateSimpleMem: PROC[addr: CirioNubAccess.RemoteAddress, size: BitAddr _ unspecdBA] RETURNS[Mem]; MakeDualMem: PROC [nub: CirioNubAccess.Handle, fp, sp: CARD, text, data, bss: LSA.LoadedSegmentInfo, fep, simple: BitStretch] RETURNS [mem: Mem]; SelectVarLoc: PROC [nub: CirioNubAccess.Handle, fm: Mem, vl: MobObjectFiles.VarLoc] RETURNS [Mem]; GetDefinitionMob: PROC[modules: NewRMTW.CedarModuleSet, vs: MobDefs.VersionStamp, stem: PATH _ NIL] RETURNS[MobAccess.MobCookie]; AnalyzeArraySEH: PROC[seh: SEH, ser: SER, cons: REF cons MobAccess.BodySE, ti: REF array MobAccess.TypeInfoConsSE, rmtw: RemoteMimosaTargetWorld] RETURNS[Type]; AnalArrayTs: PROC [rmtw: RemoteMimosaTargetWorld, tsd: TsDict, i: INT, opts: TsOptions] RETURNS [Type, INT]; AnalyzeRecordSEH: PROC[seh: SEH, ser: SER, cons: REF cons MobAccess.BodySE, ti: REF record MobAccess.TypeInfoConsSE, rmtw: RemoteMimosaTargetWorld, isRopeRep: BOOL] RETURNS[Type]; EnumeratedTypeIndexToName: PROC [type: Type, index: INT, cc: CC] RETURNS [ROPE]; ConvertFromIndirectToPointer: PROC[indirect: CirioTypes.Node, mem: Mem, rmtw: RemoteMimosaTargetWorld] RETURNS[CirioTypes.Node]; AnalyzeRefSEH: PROC[dft: Type, seh: SEH, ser: SER, cons: REF cons MobAccess.BodySE, ti: REF ref MobAccess.TypeInfoConsSE, rmtw: RemoteMimosaTargetWorld, sk: SehKnowledge] RETURNS[Type]; AnalyzeProcedureSEH: PROC[ti: REF transfer MobAccess.TypeInfoConsSE, cons: REF cons MobAccess.BodySE, ser: SER, seh: SEH, rmtw: RemoteMimosaTargetWorld] RETURNS[Type]; AnalProcTs: PROC [rmtw: RemoteMimosaTargetWorld, tsd: TsDict, i: INT, opts: TsOptions] RETURNS [Type, INT]; AnalyzedUnknownSEH: PROC[seh: SEH, rmtw: RemoteMimosaTargetWorld, explanation: ROPE, bits: INT] RETURNS[Type]; MakeBrokenType: PROC [rmtw: RemoteMimosaTargetWorld, explanation: ROPE, bits: INT] RETURNS [Type]; UnimplementedTypeNode: PROC[targetType: Type, rmtw: RemoteMimosaTargetWorld, explanation: ROPE] RETURNS[Node]; CreateProcConstant: PROC [rmtw: RemoteMimosaTargetWorld, jmpi: MobObjectFiles.JointMobParsedInfo, searchMem: Mem, textBase: CARD, bth: MobAccess.BTH] RETURNS [Node]; GenRecordFields: PROC[type: Type, cc: CC, nFields: PROC[CARD], eachField: PROC[index: CARD, byteOffset: INT, bitOffset: INT, bitSize: CARD] ]; NameParts: TYPE = RECORD[ principalDirectory: PATH, nameStem: ROPE ]; GetNamePartsFromFullPathName: PROC [fullPathName: PATH] RETURNS [NameParts]; SeekCSource: PROC [cms: NewRMTW.CedarModuleSet, basicInfo: REF LSA.BasicPCInfo, ledo: REF LSA.LoadedModuleInfo] RETURNS [foundFile: SystemInterface.CirioFile]; END.. 6 RMTWPrivate.mesa Copyright Σ 1991 by Xerox Corporation. All rights reserved. Sturgis, April 20, 1990 2:22 pm PDT Last changed by Theimer on November 29, 1989 1:34:53 am PST Last tweaked by Mike Spreitzer on April 10, 1992 3:57 pm PDT Coolidge, July 5, 1990 11:10 pm GMT Philip James, August 27, 1991 1:44 pm PDT Laurie Horton, September 19, 1991 3:52 pm PDT TargetWorlds The entries in this hash table are CTXInfo. Some Comments We construct three classes of information: Type information, Structural information, and Node information. Roughly speaking, for a given SEH, there is only one piece of Type information, there is a different piece of Structural information for each logical place that the type appears, and there is a different piece of Node information for each physical place that the type appears. Thus, if we have some type which occurs exactly as the type of two variables in some procedure, then there will be two pieces of Structural information for that type, one for each of the two variables, and there will be many pieces of Node information, two for each invocation of the procedure. All types in this module are nominally represented as a contiguous sequence of bits in memory and their Cedar type is defined by some SEH. However, it is conceivable that the presumed contiguous sequence of bits is actualy stored in some other way. This other way is independent of the structure of the represented value, but rather, it is dependent upon where the bits themselves are stored. For example, some of these values will be found embedded in the interior of some C variables. These may turn out to be multi-register C variables. We may not have direct access to the values in these registers as consecutive bytes in memory. We use Mems, defined below, to make it appear that these bits are, in fact, consecutive. BTH Info Three different kinds of information are keyed off of BTHs. (1) nested blocks have record structures that are defined by the localCtx of a BTH (2) the outermost structure of a procedure frame (procedure, arguments record, results record, enclosing context) is defined by assorted symbol information reached from the outermost BTH (3) the set of nested blocks and outermost BTH of a procedure are defined by the BTH associated with the bracket pair that most tightly encloses a given pc. implemented in RMTWFrames.mesa SEH info implemented in RMTWAtomics.mesa implemented in RMTWAtomics.mesa Represents knowledge about an seh. ROPE means REF RopeRep. RopeRep includes partially bound variants. Implemented in RMTWAtomics.mesa. Typestring info Record Contexts Contexts are used to describe record types both by ordinary records and by various frame components (nested blocks, arguments, and results). Consequently we provide a separate analysis to be used by both clients. If the last type in the sequence is a sequence or union (as viewed from a mob) then the record type will report an unknown type for the last type. The corresponding field info will contain the correct name, seh, ser, serBody, and fieldLoc; but the analyzedFieldSEH will be for an unknown type (when valid). The field list type will always report one less field, thus it can be used by Cirio Sequences and Cirio variant records as the preamble type. Read by RecordIndexToNTConstant and AnalyzeField. Meaningful for variantCases contexts. Meaningful for ordinary records. Meaningful for block records. Read by RecordIndexToNTConstant and AnalyzeField. this is the idSEH that occurs in the context list the SEH for the type of the value in the field is to be found at serBody.idType Normally returns an AnalyzedCTX and its recordType; may instead return NIL and a variant or sequence-containing record type. As a special dispensation, in order to handle empty argument/result records, this procedure will accept ctxh=NIL to produce an effectively empty record. jmpi and bth needed iff blockRecord. unpackedArgResultRecord triggers a workaround. (problem in mobs) shouldbe true exactly when we are dealing with an unpacked reocord that is a proc arg or result record. blockRecord indicates whether the Mem given to the record and fieldlist types should be a Frame Mem, wherein the fields are located by VarLocs, or a Simple Mem, wherein the fields are located according to their offsets in the mob. If the record may have node-time constant (ie, constant procedure) fields, the supplied Mem must be able to read the "text" segment register. bitSize is meaningful when blockRecord is FALSE. maybeVariant => last field may indicate sequence or variant record. bindSeh#NIL => last field *will* indicate variant record; return the bound variant type described by bindSeh (which is, unfortunately, the constructor, not the name); nobody cares about the returned AnalyzedCTX. variantCases => this context describes the cases of a variant record. isHelper => We're working on CirioRopeHelper, so invent some SehKnowledge. defer => refrain from analyzing element types. Get a completely copied context from some definitions mob Mems Create a Simple Mem. Create a Mem that is both Frame and Simple. Given a Frame Mem. definition files (implementation is in RMTWModules) returns nil if can't be found one should try later if search path characteristics change Interface between AnalyzeSEH and some of its more specialized equivalents; namely AnalyzeRecordSEH and AnalyzeArraySEH. (RMTWCompounds contains the code for handling records, sequences, arrays, and variant records.) Negative bits make Unknown, non-negative make Transparent. Negative bits make Unknown, non-negative make Transparent. Procedures for Constants searchMem describes where to look for the proc descriptor (the pair of startPC and flag). Special procedure for procedure call mechanism the following is a special purpose routine used in RMTWAtomics.CallProc to obtain info about each argument parameter. This works only due to many special dispensations. Source assistance. Syntactically an absolute directory, up to but not including the "sun4*" component (if any). sun4: PATH, The part of the last component before any extension. c2c: PATH At this point no one seems to use sun4 or c2c... Κ »•NewlineDelimiter ™codešœ™K™