M3 Core Standalone Library
January 15, 1996
Motivation
Modula-3 is a high level language which strong typing and garbage
collection. It takes a lot of work behind the scenes to support these
services on a real computer. The m3core library does that work.
Overview
The SRC Modula-3 distribution comes with 2 standard libraries of
code that are necessary for running most Modula-3 programs. The first
library, m3core contains essential interfaces for all programs, such
as Word, Thread, Text and Float. It also has the runtime support for
linking modules together, performing garbage collection, converting
Modula-3 types to C, etc.
For SPIN, we have made standalone versions of these libararies which
contain the standard library services that we need while omitting
some that we don't need. These libraries are statically linked with
the kernel and some of the standard library interfaces, such as
Thread, are now implemented by SPIN kernel code.
The components of m3core_sa
The m3core_sa library is made up of the following parts:
- C
- Interfaces describing C types and standard C libraries.
- Csupport
- C code which implements SET operations.
- fingerprint
- A fingerprint is a 64-bit checksum. It can be used to quickly determine
if two objects are different.
- main
- The empty interface implemented by the Main module of a program.
- runtime
- Code for linking, initialization and garbage collection.
- strongref
- The StrongRef interface can be used to make a reference immovable
and uncollectable by the garbage collector.
- text
- The interface for Modula-3 TEXT objects, as described in Systems
Programming in Modula-3, page 68.
- thread
- The Modula-3 Thread interface. The implementation has changed and
is located in the SPIN kernel, but the interface is nearly
unchanged.
- weakref
- A WeakRef.T is a reference to a piece of memory which will not
prevent the memory from being garbage collected.
- word
- The builtin Modula-3 Word interface which is implemented as inline
code by the compiler. This interface is described on page 71 of
Systems Programming in Modula-3, but see this link for changes
that have happened since that book was written.
Remaining Issues
We believe that we are paying too large a performance penalty for garbage
collection at present. At some unspecified time in the future, we may
replace the SRC collector with another one.