[Rubycocoa-devel 978] Re: defining missing methods

Back to archive index

Laurent Sansonetti lsans****@apple*****
Mon Jun 11 01:45:28 JST 2007


Hi Kimura-san,

On Jun 10, 2007, at 8:03 AM, kimura wataru wrote:

> Great!
>
> I have a few questions.
> - It seems the method cache mechanism is disable at framework/src/ 
> objc/mdl_objwrapper.m.
>  Is the mechanism disable by default under the latest revision?
>  I changed the value of OCM_AUTO_REGISTER to "1", then got a good  
> result
>  from Laurent's bench.rb.

Oops, I forgot to set it to "1" :-)

I will commit it as enabled by default.

(The #define was just for benchmarking.)

> - I'm not clear about ffi. I wonder the
> method cache mechanism ignores
>  overriding methods by ObjC categories. ObjC runtime flushes its  
> cache against
>  some occasions, such as loading a bundle. This mechanism need not  
> flush
>  like ObjC runtime?

Good question, and normally everything should be fine as before.

The fact is that methods can be added via categories (when loading a  
bundle), but not removed.

What this new change does is just to define the Ruby method, but it  
still calls ocm_send (from a FFI closure) which will at runtime  
retrieve the ObjC implementation (IMP) and call it.

So even if the ObjC method implementation changes, it will call the  
new one.

Laurent

> On Fri, 8 Jun 2007 00:24:11 -0700, Laurent Sansonetti wrote:
>> I committed a working experiment as r1821!
>>
>> It automatically defines the method directly in C by generating  
>> Libffi
>> closures.
>>
>
> -- 
> kimura wataru
>
> _______________________________________________
> Rubycocoa-devel mailing list
> Rubyc****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel




More information about the Rubycocoa-devel mailing list
Back to archive index