DIRECTORY AMBridge USING[RemoteGlobalFrameHandle], AMModel USING[CharIndex, Class, Context], AMTypes USING[TV], BcdDefs USING[VersionStamp, BcdBase], LoadState USING[ConfigID], PrincOps USING[EPRange, MaxNGfi, BytePC, GlobalFrameHandle], Rope USING[ROPE], RTSymbolDefs USING[SymbolTableBase], RTTypesPrivate USING[TypedVariableRec], WorldVM USING[World]; AMModelPrivate: DEFINITIONS = BEGIN OPEN AMModel, Rope, RTSymbolDefs, WorldVM; FGIndex: TYPE = RECORD[fgCard: CARDINAL, fudge: BOOL]; FGNull: FGIndex = [LAST[CARDINAL], FALSE]; EPI: TYPE = [0..PrincOps.EPRange*PrincOps.MaxNGfi); PCOffset: TYPE = INT; -- # of bytes from start of procedure NullPCOffset: PCOffset = -1; -- indicates no such PCOffset available RefTVRec: TYPE = REF RTTypesPrivate.TypedVariableRec; SectionRec: TYPE = RECORD[ SELECT class: Class FROM model => [ configName: ROPE _ , -- require specification versionStamp: BcdDefs.VersionStamp _ , configContext: ConfigContext _ NIL -- useful if it's loaded, but not required ], prog => [ moduleName: ROPE _ , versionStamp: BcdDefs.VersionStamp _ , someGFHTV: RefTVRec _ NIL -- useful if it's loaded, not required ], interface => [ moduleName: ROPE _ , versionStamp: BcdDefs.VersionStamp _ ], proc => [ prog: REF prog SectionRec _ , entryPointIndex: EPI, procTV: RefTVRec _ NIL -- useful if it's loaded, but not required ], statement => [ prog: REF prog SectionRec _ , fgtIndex: FGIndex ] ENDCASE ]; ConfigContext: TYPE = REF ConfigContextObj; ConfigContextObj: TYPE = RECORD[world: World _ , worldIncarnation: LONG CARDINAL, configIndex: LoadState.ConfigID _ ]; StatementContext: TYPE = REF StatementContextObj; StatementContextObj: TYPE = RECORD[localFrameTV: RefTVRec]; FGIToEPI: PROC [stb: SymbolTableBase, fgi: FGIndex] RETURNS [EPI]; EPIToFirstFGI: PROC [stb: SymbolTableBase, epi: EPI, skipArgs: BOOL] RETURNS [FGIndex]; EPIToLastFGI: PROC [stb: SymbolTableBase, epi: EPI] RETURNS [FGIndex]; EPIToFirstPC: PROC [stb: SymbolTableBase, epi: EPI, skipArgs: BOOL] RETURNS [PCOffset]; EPIToLastPC: PROC [stb: SymbolTableBase, epi: EPI] RETURNS [PCOffset]; CharIndexToFGI: PROC [stb: SymbolTableBase, ci: CharIndex] RETURNS [FGIndex]; PCToFGI: PROC [stb: SymbolTableBase, epi: EPI, pc: PCOffset] RETURNS [FGIndex]; NextFGI: PROC [stb: SymbolTableBase, fgi: FGIndex, epi: EPI] RETURNS [FGIndex]; FGIToFirstChar: PROC [stb: SymbolTableBase, fgi: FGIndex] RETURNS [CharIndex]; FGIToLastChar: PROC [stb: SymbolTableBase, fgi: FGIndex] RETURNS [CharIndex]; FGIToFirstPC: PROC [stb: SymbolTableBase, fgi: FGIndex] RETURNS [PCOffset]; FGIToLastPC: PROC [stb: SymbolTableBase, fgi: FGIndex] RETURNS [PCOffset]; ProgPCToFGI: PROC [prog: AMTypes.TV, pc: PrincOps.BytePC] RETURNS [FGIndex]; GetModuleSTB: PROC [bcd: BcdDefs.BcdBase, versionStamp: BcdDefs.VersionStamp] RETURNS [SymbolTableBase]; GetLocalBCD: PROC [gfh: PrincOps.GlobalFrameHandle] RETURNS [BcdDefs.BcdBase]; GetRemoteBCD: PROC [rgfh: AMBridge.RemoteGlobalFrameHandle] RETURNS [BcdDefs.BcdBase]; FindMatchingGlobalFrames: PROC [ world: World, name: ROPE, proc: PROC [ROPE, Context] RETURNS [--stop:-- BOOL] ] RETURNS [ans: Context _ NIL]; END. ÐAMModelPrivate.Mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Russ Atkinson, February 11, 1985 11:54:56 pm PST Rovner, July 13, 1983 6:02 pm fgCard is used to index the fine grain table fudge is used to indicate that this index indicates the "missing" index for the last statement in the procedure. This kludge should be resolved when the compiler actually puts out an FGI for the last statement. Until then, if fudge is true, we will try to compensate for the missing FGI in a transparent manner. Fudge should only be true if fgCard is the last fgi for a procedure. either binder output bundle for a config, or compiler output bundle for a prog module, DEFs module, proc, or statement A Context is either a ConfigContext, a StatementContext, or a TV for a global frame, local frame or IR instance. LoadState.nullConfig represents rootContext The procedures below are implemented in AMModelPrivateImpl (Russ Atkinson). They deal with the fine grain table, entry points, and character indexes. BEWARE: there is currently no FGI for the last statement in a procedure. This will probably effect character position to fgi translation, and produce other unfortunate effects until this bug is fixed. The use of fudge is an attempt to get around this problem. returns entry point for the given fgi (epi = 0 for start proc OR invalid fgi) returns first fine grain index for the given procedure. If skipArgs, then we skip over fgi's until the point where the arguments have been popped from the stack. If there are no arguments to the procedure, then skipArgs should be FALSE! (FGNull for invalid epi) returns last fine grain index for the given procedure (FGNull for invalid epi) returns offset of first byte in the procedure. skipArgs has the same interpretation as for EPIToFirstFGI. returns offset of last byte in the procedure (may be padding byte) returns the "best" fine grain index for the given character position (FGNull for invalid position) returns the "best" fine grain index for the given pc offset in the given procedure (FGNull for invalid epi or invalid pc) returns FGNull if next fgi is in a different proc than entryPointIndex returns character position of first byte in the fine grain entry (-1 for invalid fgi) returns character position of last byte in the fine grain entry (-1 for invalid fgi) returns offset of first byte in the fine grain entry (NullPCOffset for invalid fgi) returns offset of last byte in the fine grain entry (NullPCOffset for invalid fgi) Êù˜codešœ™Kšœ Ïmœ1™