|
From: | Gwenaël Casaccio |
Subject: | Re: [Help-smalltalk] [ANN] Mirrors for GST |
Date: | Tue, 28 Feb 2012 15:00:17 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
On 27/02/2012 08:49, Paolo Bonzini wrote:
I've made a MirrorPrimitive and two pragmas; the first pragma calls the primitive but the second has an extra argument an error block (i.e. vmPrimitive for: ... at: ifFailed: []) Thus no exceptions are raised (and thus no possible leaked vmPrimitves objects). The primitive number is added at the end by the pragma. I've added the compiledOn 02/26/2012 08:07 PM, Gwenaël Casaccio wrote:classFor: anObject [ ^ ##(MirrorPrimitive class>> privateClass) valueWithReceiver: anObject withArguments: #() ] ##() is interesting because the compiled method (thus the primitive call) will be "injected" as a literal thus I don't need to do a lookup all the time (for getting the compiled method). Now I can execute the primitive on the object.What about for even faster execution: classFor: anObject [ <primitive VMpr_MirrorPrimitive_executePrimitive> ^##(VMpr_Object_class) ] Paolo
method as an extra parameter to the execute_primitive function. classFor: anObject [ <mirrorPrimtive: VMpr_Object_Class> ] for: anObject at: anIndex ifFailed: aBlock [ <mirrorPrimtiveWithBlock: VMpr_Object_basicAt> ^aBlock value ] Cheers, Gwen
mirrorPrimitive.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |