[squeak-dev] Lightweight Classes

Bergel, Alexandre bergel at iam.unibe.ch
Fri Nov 21 13:00:21 UTC 2008


It works now.

I read the paper of Hinkle and al. Lightweight classes are useful to  
debug.
Using lightweight class assumes that a programmer is able to infer  
from which object his analyze should start from. I am wondering  
whether this is not a too strong assumption. From my experience, just  
guessing from which class to start from is a big step.

Cheers,
Alexandre


On 19 Nov 2008, at 11:56, Hernán Morales Durand wrote:

> Hi Alexandre,
>  Monticello store UnstoredMethod class definition type as  
> #compiledMethod where should be #bytes in this particular case [*].  
> Try to load the attached .mcz or load the previous one using the  
> Load option in the file list (you probably need to add the .mcz  
> extension if was removed by your e-mail client).
> Best regards.
>
> Hernán
>
> [*] To fix this in MC in #typeOfClass one should invert the type  
> check order:
>
> self instSpec = CompiledMethod instSpec ifTrue:[	^ #compiledMethod].  
> "Very special!"
> self isBytes ifTrue:[^#bytes].
>
> to
>
> self isBytes ifTrue:[^#bytes].
> self instSpec = CompiledMethod instSpec ifTrue:[	^ #compiledMethod].  
> "Very special!"
>
> but maybe someone with good knowledge of MC should confirm if that's  
> ok. (I'm using Monticello-pmm.318)
>
> 2008/11/19 Bergel, Alexandre <bergel at iam.unibe.ch>
> Hi Hernán,
>
> I get an error when trying to load your file: '5 instvar names are  
> required'
> Strange.
>
> Alexandre
>
>
>
> On 16 Nov 2008, at 22:58, Hernán Morales Durand wrote:
>
> Dear all,
> In the attachment you will find an implementation of Lightweight  
> Classes for Squeak that follows the original paper "Debugging  
> Objects" of Hinkle et al. However I was unable to set up the #class  
> method in the LightweightClass to answer the real class of the  
> lightwighted object, is this possible currently in Squeak?.
>
> What I did:
> -Created the LightweightClass as in the old VisualWorks  
> implementation. The only difference here was CompiledMethod's cannot  
> be copied, so I used #clone.
> -Created and installed an UnstoredMethod (a CompiledMethod subclass)  
> in the LightweightClass's methodDictionary. Since I want to store  
> the source code but not through the changes log, I borrowed the  
> MethodWrappers idea of storing the state (sourceCode) in a class  
> instance variable, and compile without logging. The methods I  
> borrowed from MW are:
>
> -#copyWithTrailerBytes: - I think the superimplementor in  
> CompiledMethod could use "self class" to avoid reimplementors.
> -#tweakClassFormat - which set the format but I don't know why and  
> cannot find documentation on this.
> -#objectAt: I suspected the class literal was stored in the literal  
> frame everytime I accepted a method, but for the simple test below  
> still answer the LightweightClass and not the real class.
>
> Here is the test:
>
> | aDate |
> aDate := Date today.
> aDate becomeLightweight.
> aDate dispatchingClass compile: 'day ^43' notifying: nil.
> aDate day. " 43 (works) "
> aDate perform: #class. " Date ------> (works) "
> aDate class. " {Date} ------> LightweightClass (wrong) "
>
> Any hint would be appreciated.
> Best regards.
>
> Hernán
>
> PS: Just to avoid duplicate efforts, I wrote a LightweightClasses  
> Browser which will be available as soon as I find a solution to the  
> problem above.
> <LightweightClasses-hfm.1.mcz>
>
> -- 
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
>
> <LightweightClasses-hfm.2.mcz>

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.








More information about the Squeak-dev mailing list