Welcome to the Ranch.
The JVM specification does not specify this, because it's an implementation detail. It's up to the particular JVM implementation to do this when appropriate. There's no definitive answer to this question that is valid for any version of any JVM implementation. If you really want to know how this works under the covers in Oracle's JVM, you could dive into the
OpenJDK source code. But beware, it's a very big and very complicated project.
Why exactly are you asking this question - what do you hope to understand by knowing the answer to this question? It's not something that Java programmers normally need to know when developing software in Java.