First public push of the first step of the hazelnut GSoC project :)
In a nutshell
For those who didn't know SystemTracer (the father):
It is a tool that traces a graph of objects and writes an image from it.
ImageWriter is a refactored, renamed and repackaged version of SystemTracer2 with the following changes:
- The image format can be provided as a parameter.
- You have to provide an SmalltalkImage object as root to write the image (so in the future we can write bootstrap with this).
- The object format was reified in objects.� So the code is easier to understand + change, and people can learn how are our objects in memory easily :D.
Right now, only 32 bit image format is supported.
Structure
- ImageWriter-Core has the image formats and the image writer in itself
- ImageWriter-ObjectFormats contains objects that represent the memory layout of the objects and it's headers.
- ImageWriter-Tests has some tests.
Tests done
�- Only tested in Pharo-1.4
�- There are specific tests written for the size and headers of the objects
�- Also, I've written a Pharo-1.4 image and then run the tests in the copied image.� Only one failure compared to the original :)
Known Bugs :)
�- WeakRegistryTest>>#testFinalizationWithOnFork is failing, and when I run it manually it works :/.� In the image I use to write, it does not happen, only in the clone.
�- When opening the new image, the window is too small.� It is not respecting the original image size.� Don't know yet what is the problem.
How To Download
Gofer it
��� squeaksource3: 'ImageWriter';
��� package: 'ImageWriter-Core';
��� package: 'ImageWriter-ObjectFormats';
��� package: 'ImageWriter-Tests';
��� load
How to Use it
� HzImageWriter new
��� format: HzCogImageFormat new; "or HzInterpreterImageFormat new"
��� imageFileName: 'someFile.image';
��� onInitializeDo: [ "Some initialization?" ];�� "this is optional, probably the same as an startup script, probably nonsense"
��� writeImage: Smalltalk� "Yes, we provide the our lovely global Smalltak, but any SmalltalkImage instance could be"
Next steps on this direction
�- support to write an isolated image different from the host one (I'll know what I need later, hehe)
�- class comments!
�- metacello configuration
�- better api :)
Links
http://ss3.gemstone.com/ss/ImageWriter.html
Cheers,
Guille