DIRECTORY Alloc USING [Base, Notifier], Literals USING [LTIndex, LTNull, STIndex], PrincOps USING [MaxFrameSize], SourceMap USING [Loc], Symbols USING [BTIndex, ContextLevel, HTIndex, ISEIndex, ISENull, lZ, RecordSEIndex], SymbolSegment USING [Tables], Table USING [Selector]; CodeDefs: DEFINITIONS = { OPEN Symbols; Byte: TYPE = [0..256); bitsPerWord: NAT = 16; OpWordCount: TYPE = CARDINAL; -- size of operands for builtins Base: TYPE = Alloc.Base; Limit: CARDINAL = 77777B; Lexeme: TYPE = MACHINE DEPENDENT RECORD [ lexvalue(0): SELECT lextag(0): * FROM se => [lexsei(1): ISEIndex], literal => [ index(1): SELECT littag(1: 0..0): * FROM word => [lexlti(1: 1..15): Literals.LTIndex], string => [lexsti(1: 1..15): Literals.STIndex] ENDCASE], bdo => [lexbdoi(1): VarIndex], stack => [lexsti(1): StackIndex] ENDCASE]; NullLex: Lexeme.se = Lexeme[se[Symbols.ISENull]]; MoveDirection: TYPE = {load, store}; VarSpace: TYPE = {faddr, frame, frameup, caddr, code, link, linkup, stack, const, pdesc}; VarTag: TYPE = {o, bo, bdo, ind}; VarComponent: TYPE = RECORD [ wSize: CARDINAL _ 0 | TRASH, bSize: [0..bitsPerWord) _ 0 | TRASH, space: SELECT tag: VarSpace FROM frame => [ immutable: BOOL _ FALSE, level: ContextLevel _ lZ, wd: CARDINAL _ 0, bd: [0..bitsPerWord) _ 0], code => [ bd: [0..bitsPerWord) _ 0, wd: CARDINAL _ 0, lti: Literals.LTIndex _ Literals.LTNull], faddr => [wd: CARDINAL, level: ContextLevel], frameup => [ level: ContextLevel _ lZ, pwSize: [1..2] _ 1, immutable: BOOL _ FALSE, wd: CARDINAL _ 0, delta: [0..PrincOps.MaxFrameSize) _ 0], caddr, link => [wd: CARDINAL], linkup => [ wd: CARDINAL, delta: [0..PrincOps.MaxFrameSize) _ 0], stack => [ bd: [0..bitsPerWord) _ 0, wd: CARDINAL _ 0, sti: StackIndex], const => [bd: [0..bitsPerWord) _ 0, d1, d2: UNSPECIFIED _ TRASH], pdesc => [ep: CARDINAL] ENDCASE]; VarItem: TYPE = RECORD [ -- not many around simultaneously free: BOOL _ FALSE, -- required by allocator body: SELECT tag: VarTag FROM o => [var: VarComponent], bo => [offset, base: VarComponent], bdo => [offset, base, disp: VarComponent], ind => [ offset, base, index: VarComponent, simple: BOOL, packinfo: SELECT packtag: * FROM packed => [grain: [1..bitsPerWord)], notPacked => [eWords: [0..PrincOps.MaxFrameSize)] ENDCASE] ENDCASE]; VarIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO VarItem; OVarIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO VarItem.o; BoVarIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO VarItem.bo; BdoVarIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO VarItem.bdo; IndVarIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO VarItem.ind; VarNull: VarIndex = VarIndex.FIRST; RelativePC: TYPE = [0..177777B]; CCInfoType: TYPE = {generating, binding, coding}; CodeChunkType: TYPE = {code, label, jump, other}; CCItem: TYPE = RECORD [ free: BOOL, flink, blink: CCIndex, ccvalue: SELECT cctag: CodeChunkType FROM code => [ realinst: BOOL, inst: Byte, isize: [0..7], fill: [0..3], parameters: ARRAY [1..1) OF WORD], label => [ labelseen: BOOL, labelinfo: SELECT OVERLAID CCInfoType FROM generating => [fillword, jumplist: JumpCCIndex], binding => [minPC, maxPC: RelativePC], coding => [fillword, pc: RelativePC], ENDCASE], jump => [ jsize: [0..7], jparam: Byte, fixedup, completed: BOOL, forward: BOOL, jtype: JumpType, destlabel: LabelCCIndex, jumpinfo: SELECT OVERLAID CCInfoType FROM generating => [fillword, thread: JumpCCIndex], binding => [minPC, maxPC: RelativePC], coding => [fillword, pc: RelativePC] ENDCASE], other => [obody: SELECT otag: * FROM table => [ btab: BOOL, tablecodebytes: [0..7], taboffset: INTEGER], markbody => [ start: BOOL, index: BTIndex], relSource => [relLoc: RelSourceLoc], -- relative to proc body absSource => [loc: SourceMap.Loc] ENDCASE] ENDCASE]; RelSourceLoc: TYPE = [0..7777B]; CCIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO CCItem; CCNull: CCIndex = CCIndex.FIRST; JumpCCIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO CCItem.jump; JumpCCNull: JumpCCIndex = LOOPHOLE[CCNull]; LabelCCIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO CCItem.label; LabelCCNull: LabelCCIndex = LOOPHOLE[CCNull]; CodeCCIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO CCItem.code; CodeCCNull: CodeCCIndex = LOOPHOLE[CCNull]; OtherCCIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO CCItem.other; TableCCIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO CCItem.other.table; TableCCNull: TableCCIndex = LOOPHOLE[CCNull]; CJItem: TYPE = RECORD [ inst: CCIndex, variant: SELECT tag:* FROM fallIn => [lc: LabelCCIndex], jumpIn => [jc: JumpCCIndex] ENDCASE]; CompareClass: TYPE = {word, byte}; JumpType: TYPE = { JumpE, JumpN, JumpL, JumpGE, JumpG, JumpLE, UJumpL, UJumpGE, UJumpG, UJumpLE, ZJumpE, ZJumpN, Jump, JumpA, JumpC, JumpCA, JumpRet, NILJumpE, NILJumpN, PAIRJumpL, PAIRJumpG, BYTEJumpE, BYTEJumpN, BITJumpE, BITJumpN}; LabelInfoRecord: TYPE = RECORD [ free: BOOL _ FALSE, thread: LabelInfoIndex, catchLevel: [0..37777b], body: SELECT tag:* FROM named => [hti: HTIndex, cci: LabelCCIndex], loop => [exit, loop: LabelCCIndex], stmt => [retry, continue: LabelCCIndex] ENDCASE]; LabelInfoIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO LabelInfoRecord; NamedLabelInfoIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO LabelInfoRecord.named; LabelInfoNull: LabelInfoIndex = LabelInfoIndex.FIRST; StackIndex: TYPE = Base RELATIVE POINTER [0..Limit) TO StackItem; StackNull: StackIndex = StackIndex.FIRST; StackItem: TYPE = RECORD [ free: BOOL _ FALSE, uplink, downlink: StackIndex _ StackNull, data: SELECT tag:* FROM mark => [label: LabelCCIndex], onStack => [ alsoLink: BOOL _ FALSE, tLevel: Symbols.ContextLevel _ lZ, tOffset: TempAddr _ TRASH], inTemp => [ tLevel: Symbols.ContextLevel, tOffset: TempAddr], inLink => [link: Byte] ENDCASE]; StackPos: TYPE = [0..16); StackLocRec: TYPE = RECORD [SELECT tag:* FROM onStack => [depth: CARDINAL], inTemp => [ tSize: TempSize, tLevel: Symbols.ContextLevel, tOffset: TempAddr], inLink => [link: [0..256)], mixed => [] ENDCASE]; EvalStackSize: CARDINAL = 14; MaxParmsInStack: CARDINAL = EvalStackSize - 3; TempAddr: TYPE = [0..PrincOps.MaxFrameSize); TempSize: TYPE = [0..PrincOps.MaxFrameSize); TempStateRecord: TYPE = RECORD[pendtemplist, heaplist: ISEIndex]; FrameStateRecord: TYPE = RECORD[ pendtemplist, heaplist: ISEIndex, tempctxlvl: ContextLevel, firstTemp, tempstart, framesz: INTEGER]; CaseCVState: TYPE = {single, singleLoaded, multi, none}; StoreOptions: TYPE = RECORD [ expr: BOOL _ FALSE, init: BOOL _ FALSE, counted: BOOL _ FALSE, composite: BOOL _ FALSE]; ConsDestination: TYPE = RECORD [ bd: [0..bitsPerWord) _ TRASH, bSize: [0..bitsPerWord) _ TRASH, inFrame: BOOL _ FALSE, -- can store directly into frame fLevel: Symbols.ContextLevel _ TRASH, pLength: [1..2] _ 1, ignoreSafen: BOOL _ FALSE, fOffset: CARDINAL _ TRASH, -- offset of first word of record pLoaded: BOOL _ FALSE, -- pointer already on virtual stack pSti: StackIndex _ TRASH, -- the sti of the pointer if pLoaded pDelta: INTEGER _ 0, -- word offset into record of pointer pLink: BOOL _ FALSE, -- pointer also in a link pLevel: Symbols.ContextLevel _ lZ, -- if not lZ, then ptr is in temp pOffset: TempAddr _ TRASH, -- frame offset of temp or link remaining: CARDINAL _ 0, wSize: CARDINAL _ TRASH, options: StoreOptions _ []]; StatementStateRecord: TYPE = RECORD [ retLabel, comRetLabel: LabelCCIndex, outRecord: RecordSEIndex, pendtemplist: ISEIndex, stkPtr: UNSPECIFIED, inlineFileLoc: SourceMap.Loc]; ChunkIndex: TYPE = Base RELATIVE POINTER [0..Limit); codeType: Table.Selector = SymbolSegment.Tables.LAST+1; AddressNotify, CallsNotify, ConstructorNotify, CountingNotify, CrossJumpNotify, DJumpsNotify, ExpressionNotify, FinalNotify, FlowNotify, FlowExpressionNotify, OutCodeNotify, PeepholeNotify, StatementNotify, SelectionNotify, StoreNotify, TempNotify, VarBasicsNotify, VarMoveNotify, VarUtilsNotify: Alloc.Notifier; }. xCodeDefs.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Sweet, June 20, 1980 3:57 PM Satterthwaite, November 26, 1985 9:46:09 am PST Russ Atkinson (RRA) March 6, 1985 11:02:19 pm PST if alsoTemp for onStack element, it has been previously dumped by the stack machinery into the given temp. StackLocRec semantics: obtained by lr: StackLocRec _ Stack.Loc[s, count]; Tag Meaning onStack The "count" words are all on the stack. There are "depth" words above them in the model inTemp The "count" words are in contiguous temporaries inLink "count" = 1 and value is in link "link" mixed None of the above Κ Π˜codešœ ™ Kšœ Οmœ1™K˜Kšœžœ˜Kšœžœ ˜K˜šœžœžœ˜)šœ žœž˜%K˜˜ šœ žœž˜(K˜-K˜.Kšžœ˜ ——K˜K˜ Kšžœ˜ K˜K˜——K˜1K˜K˜Kšœžœ˜$K˜Kšœ žœK˜YK˜Kšœžœ˜!K˜šœžœžœ˜Kšœžœžœ˜Kšœžœ˜$šœžœž˜ ˜ Kšœ žœžœ˜K˜Kšœžœ˜K˜—˜ K˜Kšœžœ˜K˜)—Kšœžœ˜-˜ K˜K˜Kšœ žœžœ˜Kšœžœ˜K˜'—Kšœžœ˜˜ Kšœžœ˜ K˜'—˜ K˜Kšœžœ˜K˜—Kšœ,ž œžœ˜AKšœžœ˜Kšžœ˜ K˜——šœ žœžœŸ!˜:KšœžœžœŸ˜,šœžœ ž˜K˜K˜#K˜*˜K˜"Kšœžœ˜ šœ žœ ž˜ K˜$K˜1Kšžœ˜——Kšžœ˜ K˜——Kš œ žœ žœžœ žœ ˜@Kš œ žœ žœžœ žœ ˜BKš œ žœ žœžœ žœ ˜CKš œ žœžœžœ žœ ˜DKš œ žœžœžœ žœ ˜DKšœžœ˜#K˜Kšœ žœ˜ Kšœ žœ!˜1Kšœžœ˜1K˜šœžœžœ˜Kšœžœ˜ K˜šœ žœž˜)˜ Kšœ žœ˜K˜ K˜K˜ Kšœ žœžœžœ˜"—˜ Kšœ žœ˜šœ žœžœ ž˜*K˜0K˜&K˜%Kšžœ˜ ——˜ K˜K˜ Kšœžœ˜Kšœ žœ˜K˜K˜šœ žœžœ ž˜)K˜.K˜&K˜$Kšžœ˜ ——šœžœ ž˜$˜ Kšœžœ˜ K˜Kšœ žœ˜—˜ Kšœžœ˜ K˜—Kšœ&Ÿ˜>Kšœ!˜!Kšžœ˜—Kšžœ˜ K˜——Kšœžœ˜ K˜Kš œ žœžœžœ žœ˜;Kšœžœ˜ Kš œ žœžœžœ žœ ˜DKšœžœ ˜+Kš œžœžœžœ žœ˜FKšœžœ ˜-Kš œ žœžœžœ žœ ˜DKšœžœ ˜+Kš œžœžœžœ žœ˜FKš œžœžœžœ žœ˜LKšœžœ ˜-K˜šœžœžœ˜K˜šœ žœž˜K˜K˜Kšžœ˜ K˜——Kšœžœ˜"K˜šœ žœ˜K˜+K˜2K˜$K˜)K˜*K˜—šœžœžœ˜ Kšœžœžœ˜K˜K˜šœžœž˜K˜+K˜#K˜'Kšžœ˜ ——Kš œžœžœžœ žœ˜KKš œžœžœžœ žœ˜VKšœ/žœ˜5K˜K˜Kš œ žœžœžœ žœ ˜AKšœ#žœ˜)K˜šœ žœžœ˜Kšœžœžœ˜K˜)šœžœž˜K˜˜ Kšœ žœžœ˜K˜"Kšœžœ˜—˜ K˜K˜—K˜Kšžœ˜ K˜———Kšœ>™>Kšœ+™+˜Kšœ žœ ˜K˜šœ žœžœžœž˜-Kšœžœ˜˜ K˜K˜K˜—K˜K˜ Kšžœ˜ K˜——Kšœ™Kšœ2™2K™Kšœ ™ K™Kšœ0™0Kšœ/™/Kšœ7™7Kšœ/™/Kšœ™K˜˜Kšœžœ˜Kšœžœ˜.K˜Kšœ žœ˜,Kšœ žœ˜,K˜šœžœžœ#˜AK˜—šœžœžœ˜ K˜!K˜Kšœžœ˜(K˜—Kšœ žœ'˜8K˜K˜šœžœžœ˜Kšœžœžœ˜Kšœžœžœ˜Kšœ žœžœ˜Kšœ žœžœ˜K˜K˜—šœžœžœ˜ Kšœžœ˜Kšœžœ˜ Kšœ žœžœŸ ˜7Kšœžœ˜%K˜Kšœ žœžœ˜Kšœ žœžœŸ!˜KšœžœŸ%˜:KšœžœžœŸ˜.Kšœ#Ÿ!˜DKšœžœŸ˜:Kšœ žœ˜Kšœžœžœ˜K˜K˜K˜—šœžœžœ˜%K˜$K˜K˜Kšœž œ˜Kšœ˜K˜—Kšœ žœžœžœ ˜4K˜Kšœ0žœ˜7K˜K˜>K˜=K˜@K˜:˜/K˜K˜—K˜K˜——…—Θ+