On 14.11.2008, at 16:59, Antoine Marot wrote:
Hi all,
I have a very strange bug when I use method wrappers.
Here is my wrapper code (actually it does nothing but calling the method) :
ProtoObject variableSubclass: #Wrapper instanceVariableNames: 'compiledMethod' classVariableNames: '' poolDictionaries: '' category: 'Wrapper-Core'
Wrapper>>#doesNotUnderstand: aMessage ^aMessage sendTo: compiledMethod
Wrapper>>#run: aSymbol with: arguments in: rec ^rec withArgs: arguments executeMethod: compiledMethod
Wrapper>>#compiledMethod: c compiledMethod:=c. ^self
Now I want to execute this :
SequenceableCollection methodDict at: #copyFrom:to: put: (Wrapper new compiledMethod: (SequenceableCollection>>#copyFrom:to:)).
Very strage... I think in general it is not good to use the doesNotUnderstand trick so deeply in the system... for example, even #hash and #= and will be taken from the wrappee (the compiledMethod), but not #==, as it's in ProtoObject. And #class will never get forwarded (as it's a bytecode). So maybe the #hash is the problem: on the image side, #hash gets forwarded to the wrappee, but what does the VM do? There could be a mismatch. (and recompiling the whole image, what bytesurgeon installer does, could change something wrt. to hashing that this makes it a problem whereas it might not been a problem before) Another thing: you need to empty the VM cashes when installing a method by calling #flushCache (or use Bahvior>>#basicAddSelector:withMethod:). Marcus -- Marcus Denker -- denker@iam.unibe.ch http://www.iam.unibe.ch/~denker