JEP 276: Dynamic Linking of Language-Defined Object Models

Attila Szegedi attila.szegedi at oracle.com
Tue Oct 20 08:23:39 UTC 2015


> On Oct 20, 2015, at 10:17 AM, Jochen Theodorou <blackdrag at gmx.org> wrote:
> 
> On 19.10.2015 12:56, Attila Szegedi wrote:
>> On Oct 19, 2015, at 10:46 AM, Jochen Theodorou <blackdrag at gmx.org
>> <mailto:blackdrag at gmx.org>> wrote:
>> 
>>> since it is dynalink there is I guess only one master linker in the
>>> end. Can you point me to some code showing how the composition of
>>> linkers is done to refresh my memory on that?
>> 
>> Sure, here’s how Nashorn does it:
>> 
>> http://hg.openjdk.java.net/jdk9/dev/nashorn/file/f93753325c7b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java#l92
>> 
>> You’ll notice that Nashorn has a total of 10 linkers - they’re
>> modularized per purpose.
> [...]
> 
> interesting... I will take a closer look at those some time later this week
> 
> So am I right in assuming that if for example there is the public nashorn linker and the linker from Groovy, that we simply go through the list of linkers (from a service based lookup I guess) and the first linker claiming to be able to link that gets to do it?

Indeed. That’s exactly how it works :-)

Additionally, if a linker claiming to be able to link it is asked to do it and it returns null instead of producing a linkage, then the next applicable will be consulted too. Therefore, TypeBasedGuardingDynamicLinker’s “boolean canLinkType()” expresses a conditional ability to link (it’s “likely can”, not “always can”).

Attila.

> 
> bye Jochen
> 




More information about the core-libs-dev mailing list