-- file P3S.mesa
-- last modified by Satterthwaite, 27-Apr-82 14:57:59

DIRECTORY
  P3: TYPE USING [Attr, NPUse, Safety],
  Symbols: TYPE USING [
    CSEIndex, RecordSEIndex, CTXIndex, BTIndex, ContextLevel],
  Tree: TYPE USING [Index, Link];

P3S: DEFINITIONS = {
  OPEN Symbols;
  
 -- shared state variables for pass 3

  BodyData: TYPE = RECORD[	-- shared communication record
    level: Symbols.ContextLevel,	-- current level
    bodyNode: Tree.Index,		-- current body
    argCtx: Symbols.CTXIndex,		-- ctx for inputRecord
    inputRecord: RecordSEIndex,		-- input record for current body
    returnRecord: RecordSEIndex,	-- return record for current body
    entry: BOOLEAN,			-- set for entry procedures
    lockHeld: BOOLEAN,			-- set for entry or internal procedures

    noXfers: BOOLEAN,			-- set by embedded xfer (except return)

    reachable: BOOLEAN,
    labelList: Tree.Link,		-- list of accessible labels
    loopDepth: CARDINAL,		-- depth of loop nesting

    catchDepth: CARDINAL,		-- depth of catch phrase nesting
    unwindEnabled: BOOLEAN,		-- set iff in scope of unwind
    resumeFlag: BOOLEAN,		-- set iff a resume is legal
    resumeRecord: RecordSEIndex];	-- for current catch phrase


  ImplicitInfo: TYPE = RECORD [		-- info about subtree used as an expr
    type: CSEIndex,
    tree: Tree.Link,
    attr: P3.Attr];
    
  SelfInfo: TYPE = RECORD [		-- info about x in x.op[args] => op[x, args]
    tree: Tree.Link,
    type: CSEIndex,
    attr: P3.Attr,
    np: P3.NPUse];


 -- exported by Pass3S
  
  safety: READONLY P3.Safety;
  currentBody: BodyData;
  currentScope: READONLY BTIndex;
  
 -- exported by Pass3Xa
  
  implicitRecord: RecordSEIndex;	-- type of extraction record
  markCatch: BOOLEAN;			-- reset in Stmt, set in CatchPhrase
  continued: BOOLEAN;
  self: SelfInfo;
  
 -- exported by Pass3Xb
 
  implicit: ImplicitInfo;		-- implied interpretation of Tree.Null
   
  }.