Supplementary Information for the Implementation of Version 9 of Icon
Ralph E. Griswold
| Department of Computer
The University of Arizona
April 7, 1996
The Icon programming language  is fairly stable now, although the implementation
of Version 9 of Icon contains major changes from preceding versions. The
most notable change is the use of RTL  for writing the run-time system.
The run-time system now also supports both the compiler and interpreter,
with conditional code as appropriate.
RTL is a superset of C and contains constructions for describing the abstract
semantics of Icon that are needed by the Icon compiler. RTL also has constructions
for expressing type checking, conversion, and selection in ways that are
close to the semantics of Icon.
Functions and operations written in RTL look substantially different from
their former C versions, especially in their headers. However, most of the
actual code is the same or similar to that for earlier versions.
Some aspects of data representation and the way parts of the run-time system
work are new with Version 9. These changes are summarized in the next section.
Several documents are be useful in understanding the implementation of Icon.
The implementation of Version 6 is described in considerable detail in a
book . Although much has changed since Version 6, the material in this
book still is sound and is the best source of information about the basic
aspects of the implementation. A supplementary report  describes changes
made between Version 6 and 8 and also lists corrections to . The Icon
compiler is described in  and RTL is described in .
2. Significant Changes in Version 9
The information that follows assumes a basic knowledge of the implementation
of Icon and the terminology used in it.
The organization of the files for the implementation of Icon and its related
components has changed in Version 9. See the appendix at the the end of
Type Checking, Conversion, and Selection
As mentioned above, RTL contains constructions for dealing with Icon type
checking, conversion, and selection. The code for these operations is cast
differently than before. See .
Some descriptors in Version 9 are different from earlier implementations.
There is now a flag in the d-word of descriptors that contain type codes
(as opposed to string qualifiers and descriptors for plain variables).
The trapped-variable flag is no longer used to distinguish plain variables
from special ones, such as for keywords. Instead, the latter are represented
by type codes.
Icon keywords are now implemented by C functions. There are no longer trapped-variable
blocks for keywords to which assignment can be made.
Tended Pointers and Storage Allocation
RTL provides a tended declaration for values that may contain pointers to
allocated storage that must be processed during garbage collection. Predictive
need is no longer used to assure that adequate free space exists before
an allocation request. Instead, an allocation request causes a garbage collection
if there is not adequate free space.
Multiple Storage Regions
Storage regions do not expand. Additional storage regions are allocated
if garbage collection fails to provide enough free space to satisfy an allocation
Translator Table Expansion
The tables used by the Icon translator and linker (
are expanded automatically as necessary. The former
is no longer used. As a side effect of this change, the sizes of procedures
are no longer given as part of the advisory output of
Removal of Unreferenced Globals
The linker now removes unreferenced globals (including procedures and record
3. Summary of Changes to the Implementation Book
The list that follows indicates recent changes to the implementation of
Icon that affect the material in . Note: Almost all the code segments
shown in the book have been changed in some way since Version 6.
Chapter 1: Still valid.
Chapter 2: See  and  for recent changes to the Icon language itself
Chapter 3: Still valid.
Chapter 4: See  for changes to the handling of integers. See Section
2 above concerning the representation of descriptors and trapped variables.
Chapter 5: Mostly still valid. See  for changes related to csets.
Chapter 6: See  for changes to the method for adding elements to lists
and the use of pointers in place of descriptors to link blocks.
Chapter 7: See  for a description of dynamic hashing that now is used
for sets and tables, as well as for the use of pointers to link blocks.
Chapter 8: Mostly still valid.
Chapter 9: See  for improvements to the handling of scanning environments.
Chapter 10: See  for improved handling of co-expression activation.
Chapter 11: Mostly still valid. See  for fixed-region implementations
and Section 2 above for multiple fixed regions. See Section 2 above concerning
tended pointers and the removal of predictive need.
Chapter 12: See  for the handling of type conversion and errors.
Appendix A: In addition to the changes in Chapters 4, 5, and 6 mentioned
above, there are numerous minor changes in block layouts.
Appendix B: Keywords are now represented by names instead of numbers.
Appendix C: Still valid.
Appendix D: See Section 2 above regarding the file hierarchy. See  for
information on adding functions, operations, and new data types to Version
9. See the source code itself for current macro definitions.
Appendix E: Still valid except for extensions that require the addition
of new data types. Some of the projects listed have been done since Version
Many persons have contributed to the implementation of Icon. Clint Jeffery
and Gregg Townsend collaborated with the author on the implementation of
1. R. E. Griswold and M. T. Griswold, The Icon Programming Language,
Prentice-Hall, Inc., Englewood Cliffs, NJ, second edition, 1990.
2. K. Walker,
The Run-Time Implementation Language for Icon,
The Univ. of Arizona Icon Project Document IPD261,
3. R. E. Griswold and M. T. Griswold,
of the Icon Programming Language, Princeton University Press, 1986.
4. R. E. Griswold, Supplementary Information for the Implementation of Version
8 of Icon, The Univ. of Arizona Icon Project Document IPD112,
5. K. Walker,
The Implementation of an Optimizing Compiler
for Icon, The Univ. of Arizona Tech. Rep. 91-16, 1991.
6. R. E. Griswold, C. L. Jeffery and G. M. Townsend,
of the Icon Programming Language, The Univ. of Arizona Icon Project
Document IPD267, 1995.
Appendix -- Icon Hierarchy
|-bin------ executable binaries and support files
|-config--- configuration directories
|-ipl------ Icon program library
| |-common---- common source
| |-h--------- header files
| |-iconc----- Icon compiler source
|-icon-----|-src---------|-icont----- Icon translator source
| |-preproc--- preprocessor source
| |-rtt------- run-time translator source
| |-runtime--- run-time source
| |-vtran----- variant translator source
| |-bench----- benchmarks
|-tests----|-calling--- Icon-C interface tests
| |-general--- general tests
|-samples--- sample programs
|-vtran----- variant translator tests
In some cases there is additional sub-structure not shown here.
Icon home page