[BUG][TEST] ObjectsAsMethods don't understand perform:

Andreas Raab andreas.raab at gmx.de
Thu Jan 8 20:38:23 UTC 2004


> I believe he means
>
> Interpreter >> primitivePerform and friends
>
> the according line should be
>
> self success: ((self argumentCountOf: newMethod) = argumentCount).

Almost. The above is the problematic place and should be fixed with (say)

    "Only test CompiledMethods for argument count"
    (self isCompiledMethod: newMethod) ifTrue:[
        self success: ((self argumentCountOf: newMethod) = argumentCount).
    ].
    "..."

and then

ObjectMemory>>isCompiledMethod: oop
    "Answer whether the receiver is of compiled method format"
    ^(self formatOf: oop) >= 12

Oh, and whoever does that can also fix #lookupMethodInDictionary to use
"self isCompiledMethod:" instead of the explicit format check.

Cheers,
  - Andreas

----- Original Message ----- 
From: "Markus Gaelli" <gaelli at emergent.de>
To: <squeak-dev at lists.squeakfoundation.org>
Sent: Thursday, January 08, 2004 9:14 PM
Subject: [BUG][TEST] ObjectsAsMethods don't understand perform:


> Hi folks,
>
> I am playing around with ObjectsAsMethods from Andreas to do some fast
> MethodWrappers
> with them, but when I wrap Monticello for example, I get a
> primitiveFailed error in perform:.
>
> Andreas acknowledged the bug already. He believes that some checking
> for the right number
> of parameters is only appropriate if the method at hand is a standard
> compiled method.
> He just does not have time for that right now.
>
> I believe he means
>
> Interpreter >> primitivePerform and friends
>
> the according line should be
>
> self success: ((self argumentCountOf: newMethod) = argumentCount).
>
> But I neither know how to ask in a fast manner if a method is a
> compiled one, nor do I have
> time to build several VMs. I tried the VM-Simulator yesterday and ran
> in the same problem as Stef.
>
> Maybe somebody wants to try Neds VM-Simulator fixes from today and help
> to build one of the worlds
> fastest method wrappers?
>
> Here is the test:
>
>


----------------------------------------------------------------------------
----


>
>
> Regards,
>
> Markus
>
> p.s. some totally unrelated fun script to produce some natural spirals,
> including the golden ratio (137.5),
> should be "etoyed"...
>
> backgroundColor:= Color blue muchDarker.
> leafColor:=Color orange.
> leafSize:= 15 at 15.
> anExtent:=Display extent y at Display extent y.
> aCanvas:= BalloonCanvas extent: anExtent.
> numbersOfLeafs:=400.
> [Display fillColor: backgroundColor.
> 0 to: 360 by: 0.5 do: [:anAngle |
> (1 to: numbersOfLeafs) do: [:anInt |
> |aPoint|
> aPoint:= ((anInt sqrt * ((anInt * anAngle degreesToRadians) cos @
> (anInt * anAngle degreesToRadians) sin)) * (anExtent - leafSize /
> (numbersOfLeafs sqrt))+ (anExtent - leafSize) /2) rounded.
> aCanvas fillOval: (aPoint extent: leafSize) color: leafColor].
> aCanvas showAt: (Display center - (anExtent / 2)) rounded.
> aCanvas fillColor: backgroundColor].
> [Sensor anyButtonPressed] whileFalse: []] ensure: [Display restore]
>


----------------------------------------------------------------------------
----


>
>




More information about the Squeak-dev mailing list