Some code in G1CollectorPolicy in some circumstances tries to get predictions from TruncatedSeqs that have no samples.
This can be verified by adding an assert(seq->num() > 0) in G1Predictions::get_new_prediction()
At least this is a strange behavior that should either be fixed or documented.
The attached change is a reverse diff that implements the assert and initial changes. It seems that mostly calling G1CollectorPolicy::update_young_list_target_length() is affected.
Failing test case with these changes applied would be a Java program that immediately calls System.gc().