Le 02/08/2009 11:41, Attila Szegedi a écrit :
> Hi Rémi,
>
> thanks for the input. My idea is somewhat different. I no longer think
> of any kind of MOP interface. Rather, I'm thinking in terms of a
> linker framework that recognizes some special method names (I
> discussed this with John Rose last year at the lang summit, and I
> think his thinking is along the same lines). The way it'd work would be:
>
> Source code: obj.foo
> Bytecode:
> ALOAD 2 (or wherever "obj" is)
> INVOKEDYNAMIC "dyn:getprop:foo"(Ljava/lang/Object;)Ljava/lang/Object;
>
> The linker framework is such that it has a master linker that contains
> sub-linkers for all available language runtimes on the classpath + has
> a fallback POJO linker. It first links the call site to a "relink"
> method that queries every sub-linker for a resolution of the name with
> particular arguments. These sub-linkers return an invocation MH + a
> guard MH when they recognize the receiver and the master linker then
> installs a guardWithTest(guard, invocation, relink) - where "relink"
> is a method handle to the same method doing the relinking, so it
> repeats the linking on guard failure (that is, then it'll again go
> around all the language sub-linkers).
>    

Ok, having different linkers that are able to say if an object
belong to it or not is better than having a method getMOP().

[...]
> Attila.
>    

I've quickly browse the source code.

I've found a small error in 
CompositeTypeBasedGuardingDynamicLinker#addTypeBased,
case 1 should be:

case  1: {
   llinkers.addAll(tblinkers);
   tblinkers.clear();
   break;
}


I think you can simplify drastically the way you
find a linker for a given object.

The JSR292 already recognizes that a class is responsible
to register itself to handle all invokedynamic
of all methods of that class.

I think you can follow exactly the same way and says
that a class should register its own linker.
More that one class can have the same linker and
the way linkers are managed must be let to the dyn language
runtime.

class ADynamicClass {
   static {
     MOPLinkage.registerLinker(ADynamicClass.class, 
MyDynamicLanguageRuntime.LINKER);
   }
}
// with
classMyDynamicLanguageRuntime  {
   public static final LinkerLINKER = ...
}

registerLinker will do two things :
- use Linkage.registerBootstrapMethod with the MOP bootstrap method
- register that the linker should be used for all receivers of class 
ADynamicClass.



Rémi




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to