Тема: Горе .NET
Показать сообщение отдельно
Старый 21.05.2018, 22:50   #9  
belugin is offline
belugin
Участник
Аватар для belugin
Сотрудники Microsoft Dynamics
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии 2011
Лучший по профессии 2009
 
4,622 / 2922 (107) +++++++++
Регистрация: 16.01.2004
Записей в блоге: 5
Про JRebel - тут интерпретация похоже совсем не причем. Причем тут возхможность встроиться в загрузчик:

https://www.quora.com/How-does-JRebel-work


JRebel leverages the JVM's built-in instrumentation and hot swap to redefine the core libraries and to add an extra field to each object to make it appear as if the JVM is doing something it can't do.


  • Adds a resizable layer of indirection to each object that's essentially an extra private field Map[String, Any], which holds references to new fields added to an object
  • Adds a resizable layer of indirection to each class that's essentially Map[Signature, ImplementingClass], which holds references to anonymous classes with the actual method implementation for methods added to a class
  • Modifies references in all loaded classes to fields and methods introduced after the class was loaded to account for the layers of indirection (either by referencing into the map for fields or by calling methods in anonymous classes instead of on the class itself)
  • Instruments the java.lang.reflection and stack trace libraries to mask the above changes, making them appear as if direct access to new fields and methods were possible. For example, myClass.getField("x") may internally reference into the Map[String, Any] on the object

При этом, насколько я понял, с JIT ничего не делается - компиляция не отменяется. То есть вместо внутренних эффективных структур в байткод встраиваются мэпы. За счет этого можно как-то менять и одновременно тормоза.

Все дело в структуре данных и ссылках, а не в компиляторе или интерпретаторе.

Про tiered compilation - интересная статья про то, как там устроено внутри - фичу практически сделали, но вместо интерпретатора там неоптимизированный JIT в качестве первого звена. См Why not ‘Interpreted’? и Why not LLVM? в конце статьи.