Hello,
I'm experimenting (or I plan to do it) with smalltalk VM. One thing is still hidden for me - the image assembling process. What's done, when gst is run with -i? I've read the gst code, but this part was very complicated to read. I realized, that before everything kernel/Builtins.st is read. However, before this could be done, i thing some infracture have to be set up such as some classes like SmallInteger Symbol, Class, MethodDictionary, MethodDescriptor and MetaClass and MetaClass class. How and where this is done? How the rest is loaded? I was unable to find any order when reading kernel/*.st. Can you give me a little overview and/or point me to the source code? Thanks. Jan _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
> Can you give me a little overview and/or
> point me to the source code? The source code is dict.c and lib.c. Here is a short LaTeX document that describes it (you can of course read it from here). Paolo \documentclass{article} \usepackage{hyperref} \begin{document} \newcommand{\code}[1]{% \texorpdfstring{% {\texttt{\hyphenchar\font=`-% \begingroup\protect\frenchspacing#1\endgroup}}}{% #1}} Unlike most other image-based Smalltalk systems, GNU Smalltalk is able to create an image from scratch, only starting from the definitions of the base classes and the source code to them (that is, the definitions are not expressed as Smalltalk source code, but separately). Other systems, instead, always create an image from a pre-existing one, possibly stripping out unneeded components. The bootstrapping process is complex due to the necessity of recreating the parallel hierarchy of classes and metaclasses, and then merging them together. First of all, the system creates the builtin objects (nil, true, false and the 256 instances of \code{Character}). The pointer to their class is not known yet, but the system can store pointers to them even if they are still in an embryonal state: it is easier to plug the 259 pointers to the classes \code{UndefinedObject}, \code{True}, \code{False} and \code{Character}, than to put back all the pointers to \code{nil} where they are needed. As mentioned, the virtual machine code contains the description on the core classes\footnote{It would be possible to load them from an external source, with a parser for a subset of Smalltalk or from an XML description.}. The hierarchy tree is visited breadth-first, creating classes and metaclasses along the way. A few fields are initialized in class objects: the superclass field, the pointer to the metaclass, and the \code{instanceSpec}. This is enough for the system to create their instances. Now, builtin objects are given a class and other objects can be created: these include namespaces, and some \code{VariableBinding} objects through which the virtual machine can pass some information about the system to the Smalltalk code\footnote{Such as the underlying operating system, or \code{sizeof(void *)}.}. C code manipulates namespaces and fills them with \code{VariableBinding} objects for the classes. The remaining fields of class and metaclass objects are filled in, including linking metaclasses back to their sole instance, making Metaclass the class of metaclasses and making Class the superclass of `Object class'. In order to compile the source code for the core classes, GNU Smalltalk includes a compiler written in C. This compiler is invoked once manually to compile the \code{methodsFor:} primitive, and then to file in the sources for the kernel. As more and more classes are loaded, the system takes shape: later on, it will be complete enough to be able to create new classes, and possibly to run another compiler which is written in Smalltalk. At this point, the system has bootstrapped. \end{document} _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |