2 Values and their Representation integer 32 bits, untagged. Unboxed (i.e., not region allocated). One bit is used for tagging when GC is enabled. real 64 bits, untagged. Boxed (i.e., allocated in region) string Unbounded size. Allocated in region. bool one 32-bit word. Unboxed. α list nil and :: cells unboxed (i.e., not region allocated). Auxiliary pairs in one region; elements in zero or more regions. Size of auxiliary pairs: two 32-bit words (three when GC is enabled). exn Exception values are boxed and are always stored in a global region. fn pat => exp An anonymous function is represented by a boxed, untagged closure. Its size is one 32-bit word plus one word for each free variable of the function. Free region variables also count as variables. One extra word is used when GC is enabled. fun f. .. Mutually recursive region-polymorphic functions share the same closure, which is region-allocated, untagged, and whose size (in words) is the number of variables that occur free in the recursive declaration. One extra word is used when GC is enabled. Regions and their Representation Finite (ρ:n) Region whose size can be determined at compile time. During compilation , a finite region size is given as a non-negative integer. After multiplicity inference, this integer indicates the number of times a value (of the appropriate type) is written into the region. Later, after physical size inference, the integer indicates the physical region size in words. At runtime, a finite region is allocated on the runtime stack. Infinite (ρ:INF) All other regions. At runtime, an infinite region consists of a stack allocated region descriptor, which contains pointers to the beginning and the end of a linked list of fixed size region pages. Storage Modes (only significant for infinite regions) atbot Reset region, then store value. sat Determine actual storage mode (attop/atbot) at runtime. attop Store at top of region, without destroying any values already in the region.
[1]
Mads Tofte,et al.
A theory of stack allocation in polymorphically typed languages
,
1993
.
[2]
Martin Elsman.
Polymorphic Equality - No Tags Required
,
1998,
Types in Compilation.
[3]
Niels Hallenberg.
A Region Profiler for a Standard ML compiler based on Region Inference
,
1996
.
[4]
Mads Tofte,et al.
Region-based Memory Management
,
1997,
Inf. Comput..
[5]
Lars Birkedal,et al.
From region inference to von Neumann machines via region representation inference
,
1996,
POPL '96.
[6]
Martin Elsman.
Program modules, separate compilation, and intermodule optimisation
,
1999,
Technical report / University of Copenhagen / Datalogisk institut.
[7]
Lars Birkedal,et al.
A region inference algorithm
,
1998,
TOPL.
[8]
Martin Elsman,et al.
An Optimizing Backend for the ML Kit Using a Stack of Regions
,
1995
.
[9]
Niels Hallenberg,et al.
Combining Garbage Collection and Region Inference in The ML Kit
,
1999
.
[10]
Aleksy Schubert,et al.
The EML Kit Version 1
,
1996
.
[11]
Martin Elsman.
Static interpretation of modules
,
1999,
ICFP '99.