Class reshaping and GC in ClassBuilder

Andreas Raab andreas.raab at gmx.de
Wed Aug 17 17:48:35 UTC 2005


Daniel Vainsencher wrote:
> Yes, I had read your comment my question was whether anyone had actually 
> played with the alternatives.

In my infinite amount of spare time? No ;-)

> Yesterday I read it again more closely, and have tried to quickly (not 
> carefully) implement the first option you mention. Tonight I've let it 
> reshape Behavior twice quickly in a row, which operation seems to have 
> completed. I have not yet really looked at the resulting image, I'll 
> report again when I have.
> 
> Any particular suggestions on how to test that the image is still valid?

I would write a test in which I:
* create a (temporary) class and some instances
* perform a particular operation to tests, such as:
   - adding iVar(s)
   - removing iVar(s)
   - swizzling iVar(s)
* walk memory and do a sanity check for any object in which the class 
name is the same as that of your test class:
   - does it have the right values for its (old/new) class?
   - does it have the right length for its (old/new) class?

If you want to get fancy throw in an extra high-priority process which 
randomly creates new objects of that class (just to improve the fun 
factor ;-) Any failure will likely crash your image but it should be 
good for testing if you save your image often.

Also, you should probably run various combinations of the test in rapid 
succession since it is not clear what happens when you perform multiple 
reshaping steps.

Cheers,
   - Andreas




More information about the Squeak-dev mailing list