home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
oberon-a-1.4ß.lha
/
Oberon-A
/
texts
/
TechNotes.Text
< prev
next >
Wrap
Text File
|
1994-05-12
|
53KB
|
1,360 lines
Departement Informatik
Institut für Computersysteme
Eidgenössische Technische Hochschule
Zürich
----------------------------------------------------------------------------
Oberon Technical Notes
Cuno Pfister (ed.)
The purpose of the Oberon technical notes is to provide the implementor
of an Oberon system with the experience gained during the implementation
efforts undertaken at the Institut für Computersysteme at ETH.
Furthermore they give an overview over work already done or under way.
This report contains the first five technical notes.
Table of Contents
1. Oberon Implementations page 28
2. An Integrated Heap Allocator/Garbage Collector page 30
3. Type Guards and Type Tests page 40
4. A Symmetric Solution to the Load/Store Problem page 42
5. Garbage Collection on Open Arrays page 48
----------------------------------------------------------------------------
1. Oberon Implementations
Cuno Pfister
The original Oberon implementation [1] has been realized by N. Wirth and
J. Gutknecht for the Ceres workstation [2]. Several ports of the system
to other machines have been completed since then. We will give a short
description of each of those projects. Differences to the original
implementations are described.
Ceres (National Semiconductor NS32x32)
The original implementation. Oberon is the basic operating system.
Module Display is written in assembly language. The garbage collector is
a mark-and-sweep garbage collector which runs only between commands,
i.e. it does not need to handle pointers on the stack. An access to a
freed module results in a trap on the Ceres-1 and Ceres-2, but goes
undetected on the Ceres-3. The heap allocator/garbage collector is
written in assembly language and linked together with the inner core
modules.
Sun SPARCstation (Sun SPARC)
This implementation [3] runs on top of SunOS as a Unix process. Oberon
takes over the whole screen. The display operations are based on the SUN
Pixrect routines. Oberon files are mapped to Unix files. A variant of
the buddy system strategy is used for heap allocation. The garbage
collector is a mark-and-sweep garbage collector which usually runs
between commands, but when NEW fails due to a memory shortage, the
garbage collector is started also. This collector also takes pointers on
the stack into account. This is done by treating each memory location on
the stack as a possible pointer value. To find out whether a memory word
is a pointer, it is subjected to some plausibility tests, such as
testing whether the value points to a possible block address in the heap
and whether a possibly valid type tag is found there. If the
plausibility tests succeed, the heap is traversed sequentially to find
the corresponding block. If the block is found, the tested memory
location is treated as a root for the garbage collector. Modules are
never freed but merely removed from the module list, i.e. an access to a
freed module cannot be detected and aborted. The loader and heap
allocator/garbage collector are written in Modula-2 and linked as a Unix
application.
Apple Macintosh II (Motorola MC68020)
This implementation [4, 5] runs on top of the MacOS as a (MultiFinder
friendly) application. Oberon runs in one Macintosh window. The display
operations are largely based on the Apple QuickDraw routines. Oberon
files are mapped to Macintosh files. An integrated allocator/collector
is used (see technical note # 2). Modules are never freed but merely
removed from the module list, i.e. an access to a freed module cannot be
detected and aborted. The type descriptors contain information about
procedure variables in records, such that a checked version of the
System.Free command could be implemented in the future. The loader, heap
allocator/garbage collector and some raster operations are written in
assembly language and linked as a Macintosh application.
DEC DECstation (MIPS R2000)
This implementation runs on top of Ultrix as a process. Oberon runs in
an X-window. The display operations are based on X-windows. Oberon files
are mapped to Ultrix files. An integrated allocator/collector is used
(see technical note # 2). Modules are never freed but merely removed
from the module list, i.e. an access to a freed module cannot be
detected and aborted. The loader is written in C and linked as a Unix
application.
IBM S/6000 (IBM S/6000)
This project has recently been started.
IBM PS/2 (Intel 80386)
This project has recently been started.
Others
Other Oberon compiler back-ends have been written by students, but the
system was not ported. The compiler back-ends available produce code for
the following processors:
- a virtual stack machine (similar to P-Code or M-Code)
- Intel 8086
- Intel 80386
- INMOS T800 Transputer
- C language (Oberon subset to C translator, for bootstrapping a compiler)
References
1. Wirth N, Gutknecht J (1989), The Oberon System, Software-Practice and
Experience, 19 (9), 857-893
2. Eberle H (1987), Development and Analysis of a Workstation Computer,
Ph. D. thesis no. 8431, ETH Zürich
3. Templ J (1990), SPARC-Oberon, User's Guide and Implementation, Report
133, ETH Zürich
4. Franz M (1990), The Implementation of MacOberon, Report 141, ETH
Zürich
5. Franz M (1990), MacOberon Reference Manual, Report 142, ETH Zürich
----------------------------------------------------------------------------
2. An Integrated Heap Allocator/Garbage Collector
Beat Heeb, Cuno Pfister
Abstract
Heap Allocation and Garbage Collection are fundamental services of an
Oberon implementation. It is shown how a simple and efficient
implementation of these services can be attained.
Introduction
Programs for personal computers become increasingly loaded with
features, most of them rarely needed. The reason for that is, apart from
the marketing pressure to advertise more features than the competition,
the desire to provide all the features that anyone might ever need or
want. The result is that programs become ever larger, more complex,
buggier, more expensive and sometimes delivered years after their
announcements. Even then they often fail to provide features useful for
a particular task. A solution to this problem lies in the development of
extensible programs. Extensibility here means that a program can provide
the customer with only the features needed most of the time and with
some means to extend it. If the customer needs some special service, he
(or usually a third party) can implement this service himself, without
having access to the original program's source code.
For example, imagine an extensible page layout program which supports
text boxes, draw boxes and bitmap boxes as standard box types, and
commands to operate upon them. A user may have special needs concerning
the available commands, like e.g. a command which aligns the selected
objects in a document in a special way. It should be possible for him to
write such a command, which operates on the exported document data
structure. This poses a subtle problem, though. The command implementor
may generate references, i.e. pointers, to an exported data structure,
and these references are not known to the basic layout program. This
means in particular that when the layout program disposes of the storage
used by a document, there may still be pointers around which reference
this storage. Such pointers are called dangling pointers . Dangling
pointers are one of the most frequent and most dangerous sources of
program malfunctions. Their use often results in the destruction of data
not belonging to the erroneous module, and the destruction may not be
detected for a long time. Such an error is difficult to track down,
consequently it is difficult to determine who is responsible for an
accident caused by the error. So extensibility leads to a loss of
control over references and thereby to an increased probability for
dangling pointers. We will come back to that shortly.
The user of a program like the one described above should also be able
to write an extension that supports special table boxes, for instance.
Such an extension consists of a module which implements the data type
Table, together with the particular behaviour