JEP 276: Dynamic Linking of Language-Defined Object Models (original) (raw)

Attila Szegedi attila.szegedi at oracle.com
Mon Oct 19 10:56:51 UTC 2015


On Oct 19, 2015, at 10:46 AM, Jochen Theodorou <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 <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.

Some of them are internal, that is, they only operate on call sites within Nashorn:

Then we have those that could be exported:

The first 8 (prioritized) linkers all implement the TypeBasedGuardingDynamicLinker interface, meaning the factory will internally compose them into a fast (constant time) dispatch-by-receiver-type CompositeTypeBasedGuardingDynamicLinker instance; you could have any number of those without impacting the linking performance (not that finding the right linker is the slow operation usually).

Attila.



More information about the core-libs-dev mailing list