$RCSfile: InternalData.txt $ Description: Description of internal data structures used by the compiler Created by: fjc (Frank Copeland) $Revision: 1.3 $ $Author: fjc $ $Date: 1994/06/14 00:51:35 $ Copyright © 1994, Frank Copeland. This file is part of Oberon-A. See Oberon-A.doc for conditions of use and distribution. ________________________________________________________________________ [WARNING: this document has not been kept properly up to date] INTRODUCTION This document describes the internal data structures used by the Oberon-A compiler. It should be read with reference to section 12.3 of Project Oberon (1). This document presents the modifications made in porting the compiler from the NS32x32 processors to the MC68000. OBJECT AND ITEM MODES Object modes - basic modes of declared identifiers. Var Variable (global and local variable, value parameters) Ind Indirect (variable parameters) Con Constant Fld Record field Typ User defined and basic types LProc Local procedure XProc Exportable procedure SProc Standard procedure LibCall Amiga library function definition IProc Interrupt handler procedure Mod Module Head Head of list of objects Item modes - non-basic modes generated in expressions. Reg direct register mode (intermediate result in expression) RegI indirect register mode (dereferencing pointers, variable parameters) RegX indirect, indexed register mode (access to array element in expression) Stk stack mode (procedure parameters, saved registers) Coc condition code mode (evaluation of boolean expressions (?)) Abs absolute mode (?) DATA STRUCTURE ALIASES The Object, Item and Struct types used in the symbol table are actually variant records. For the sake of simplicity and portability (and because the Oberon language does not have variant record types) these types have a number of anonymous fields that are interpreted according to the mode or form field of the record. Table 12.2 (modified) --------+------------------+----------------------------- | Objects | Items mode | a0 a1 a2 | lev a0 a1 a2 obj --------+------------------+----------------------------- Var | adr rcvr | lev adr VarX | | lev adr RX VarR | R | lev R Ind | adr rcvr | lev adr off IndX | | lev adr off RX IndR | R | lev R Con | val val | val val | sadr leng mno | mno sadr leng mno (strings) RegI | | R off RegX | | R off RX Lab | | off size LabI | | off size Push | | R Pop | | R Coc | | CC Tjmp Fjmp Brnch | | Reg | | R Fld | off | off obj Typ | | mno tadr obj LProc | pno fwd | lev pno obj XProc | fwd | mno obj TProc | pno tlev fwd | mno pno tlev super obj SProc | fno | fno Mod | mno key | mno obj Head | lev psize | LibCall | foff | foff obj --------+---------------------- | Objects mode | left right link --------+---------------------- Var | next VarX | next VarR | next Ind | next IndX | next IndR | next LProc | pars XProc | pars TProc | next pars Head | next vars objects LibCall | next pars Fld | next ------------------------------------------------- Structures form BaseTyp link mno n adr ------------------------------------------------- Pointer PBaseTyp ProcTyp ResTyp param Array ElemTyp mno nofel DynArr ElemTyp Record BaseTyp fields mno tlev descno Explanation of field names adr - base address of object lev - lexical level of declaration obj - back pointer to object structure for item off - offset from base address or register RX - register number of index register R - register number val - value of constant (longreals use both a0 and a1, others only a0) sadr - base address of string constant leng - length of string constant CC - condition code number Tjmp - address of code executed if expression result is TRUE Fjmp - address of code executed if expression result is FALSE mno - module number tadr - address of record type descriptor (?) pars - list of procedure parameters pno - procedure number Ladr - address of procedure code fno - standard procedure number psize - no idea :-) PBaseTyp - pointer base type ResTyp - procedure result type param - list of procedure parameters ElemTyp - array element type nofel - number of elements in array bounds - address of array bounds constant BaseTyp - record base type fields - list of record fields descno - record type descripter number foff - library vector offset of function size - size of reference: 1 - byte, 2 = word, 4 = long tlev - inheritance level of record type