Thanks Vladimir! This is how I understood it, but I did not see the place in code where
the actual switch between those "modes" is done, as I have seen they are
compiled-up-front.
The decision is made in LambdaForm.prepare() and
LF.checkInvocationCounter().
MethodHandleStatics.COMPILE_THRESHOLD controls when the switch happens.
Theoretically at some point, the LFI code could be removed from JDK, right?
Yes, it's optional now. But LFI comprises tiny fraction of j.l.i code
and it's invaluable when debugging LambdaForm issues. So, I expect it to
stay.
Also, LambdaForm instances are still much more lightweight than classes
they are compiled to. So, if we face a situation when too many
LambdaForms are created, it's better so switch back to LFI than flooding
the system with classes.
Best regards,
Vladimir Ivanov