[9] RFR(S): 8061436: Processing of options related to segmented code cache could be enhanced

Tobias Hartmann tobias.hartmann at oracle.com
Wed Nov 11 08:40:30 UTC 2015

Hi Vladimir,

thanks for the review!

On 11.11.2015 03:03, Vladimir Kozlov wrote:
> In arguments.cpp we printed all sizes when sum was not equal to ReservedCodeCacheSize. Can you do the same? Currently you print only total size.

I changed the code to print a detailed error message if the sizes set by the user are inconsistent with the ReservedCodeCacheSize.

> I don't see where you do *5 scaling of default values as we did in arguments.cpp

The scaling is still done in arguments.cpp but only for the ReservedCodeCacheSize:

1448   // Increase the code cache size - tiered compiles a lot more.
1449   if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
1450     FLAG_SET_ERGO(uintx, ReservedCodeCacheSize,
1451                   MIN2(CODE_CACHE_DEFAULT_LIMIT, ReservedCodeCacheSize * 5));
1452   }

The default sizes of the individual code heaps are adapted accordingly in CodeCache::initialize_heaps():

191   // Calculate default CodeHeap sizes if not set by user


195   // Use the default value for non_nmethod_size and one half of the
196   // remaining size for non-profiled and one half for profiled methods

I verified that the default code cache sizes are the same with and without my changes.

New webrev:


> On 11/10/15 4:33 AM, Tobias Hartmann wrote:
>> Hi,
>> please review the following patch:
>> https://bugs.openjdk.java.net/browse/JDK-8061436
>> http://cr.openjdk.java.net/~thartmann/8061436/webrev.00/
>> I enhanced processing of code cache related size flags to allow the user to specify the size of an arbitrary code heap while the sizes of the other heaps are adjusted according to the ReservedCodeCacheSize. Before, either none or all flags had to be set. I removed the fragile code from arguments.cpp and implemented all the functionality in CodeCache::initialize_heaps().
>> The implementation works by checking which code heap sizes were explicitly set by the user and first verifies that their total size does not exceed the ReservedCodeCacheSize (with all other heaps set to the minimal size). If this is guaranteed, the sizes of the other heaps are adapted (increased or decreased) to make full use of the available ReservedCodeCacheSize. Hereby, we only change the size of the non-nmethod code heap if absolutely necessary. An assert verifies that the resulting code heap sizes correctly add up and all space is used.
>> Tested with RBT (hotspot_all and jdk_jfr). Additionally, I used a script to test many different size combinations and manually checked the (error) output.
>> Thanks,
>> Tobias

More information about the hotspot-compiler-dev mailing list