Codes using the flag NewSizeThreadIncrease (size_t) would face an overflow from below cases and we need some guard for that.
As we calculates with non-daemon threads, flag validation will not work here.
1. After multiplying non-daemon threads to NewSizeThreadIncrease.
2. After an addition of desired new size and thread increase.
3. After 'align_size_up'.
DefNewGeneration::compute_new_size() {
...
int threads_count = Threads::number_of_non_daemon_threads();
size_t thread_increase_size = threads_count * NewSizeThreadIncrease;
desired_new_size = align_size_up(desired_new_size + thread_increase_size, alignment);
...
}
As we calculates with non-daemon threads, flag validation will not work here.
1. After multiplying non-daemon threads to NewSizeThreadIncrease.
2. After an addition of desired new size and thread increase.
3. After 'align_size_up'.
DefNewGeneration::compute_new_size() {
...
int threads_count = Threads::number_of_non_daemon_threads();
size_t thread_increase_size = threads_count * NewSizeThreadIncrease;
desired_new_size = align_size_up(desired_new_size + thread_increase_size, alignment);
...
}