review (S) for 6958668: repeated uncommon trapping for new of klass which is being initialized

Tom Rodriguez tom.rodriguez at oracle.com
Thu Jul 1 18:52:05 PDT 2010


http://cr.openjdk.java.net/~never/6958668

6958668: repeated uncommon trapping for new of klass which is being initialized
Reviewed-by:

During the execution of a class initializer only the initializing
thread is allowed to create instances of the class.  Currently in C2
this is handled by emitting an uncommon trap.  If an application
creates a lot of instances using this idiom it can lead to long
sequences of compile, uncommon trap, recompile, uncommon trap.
Instead C2 should emit a guarded new that allows the proper thread to
perform allocations throws out the code once initialization is
complete.  Ideally we should just be able to test that the init_thread
is the current thread but the init_thread is never set back to null so
the init_state is additionally being checked.  I'm planning to
separately fix the clearing the init_thread since C1 mistakenly
expects it to be cleared.  This fix is going to be backported to an
update at some point.  Tested with users application and test case
which I haven't bothered including though it is in the bug report.


More information about the hotspot-compiler-dev mailing list