next up previous
Next: Features of the core Up: Experiences with modularizing the Previous: Experiences with modularizing the


Overview

ActiveState was given the task of reducing both the static and stack memory requirements of the Tcl core. A previous attempt by Karl Lehenbauer to fit Tcl into smaller machines [1] used an older and smaller versions of Tcl, version 6.7 as its base. In contrast to this our customer explicitly requested the usage of the 8.3.4 core, as part of an upgrade of his systems from the 7.x series to 8.3.4.

It is not known which version of Tcl was the base for the even earlier attempt of using Tcl in the Mars Pathfinder [2], except that it definitely was a version released before the introduction of bytecode compilation. Their approach was even more radical than ours, by reducing the interpreter to an absolutely minimal core of parser and basic supporting facilities (tclParse.c, tclBasic.c), and then adding facilities as required by their scripts.

Another project of interest is Rivendell by John Hall, sometimes called PalmTcl [3]. This project is based upon Tcl 7.4 and ports the language to PalmOS-based PDA's. The changes to the base 7.4 core ANSIfy the code base, changed the memory allocation, and split the code into sections, essentially a number of interdependent dynamic libraries, to deal with limits placed upon the size of such libraries (They have to be smaller than 64 K). Although the description claims that the code has been enhanced with reduced stack usage no such changes were found.

Similar to Rivendell is Ashok Nadkarni's Palm Tcl, again a port of Tcl to the Palm OS, based on Tcl 7.6 [4]. This project was not investigated.

We on the other hand have now modularized the Tcl core (version 8.3.4) so that the features not required by our customer can be compiled out of the core, at the discretion of the user of the modified core.

We also reduced the load on the C stack through shrinking big structures on the stack, or moving them to the heap wholesale where shrinking was not possible. In this context it is interesting to know that Karl Lehenbauer noted in his paper [1] the stack requirements of the Tcl interpreter as the major problem he encountered when doing the port.

The remainder of the paper is structured as follows. In chapter 2 we explain which features were selected for modularization and how the excisable code was determined. In the next chapter, 3 we present the results of the modularization and compare the static size of the core with various features removed.

Chapter 4 discusses the second major topic, the reduction of the usage of the C stack by the Tcl interpreter to allow its use in environments with limited stack space. The results of our changes are presented chapter 5.

At last, chapter 6 discusses our conclusions, and chapter 7 possible future work in this area.


next up previous
Next: Features of the core Up: Experiences with modularizing the Previous: Experiences with modularizing the
andreas_kupries@users.sourceforge.net