That doesn't make much sense unless klass initialization hasn't been
completed yet. Could all these copy calls be being made from a class
initializer? This test case has the recompilation behaviour you're
seeing.
public class abs {
public Object copy() {
return new abs();
}
static {
for (int i = 0; i < 10000000; i++) {
abs qc = new abs();
Object o = qc.copy();
}
}
public static void main(String[] args) {
}
}
The rules for dealing with classes that are in the being_initialized
state are somewhat complicated since only the initializing thread is
allowed to instantiate instances of that class while it's being
initialized. Other threads must block so a dynamic check is required
before executing the new. C2 just falls back to the interpreter through an uncommon trap with reason uninitialized which throws out the code and may end up recompiling. It should really just emit a guarded new so you only end up with on extra uncommon trap once the init completes.