RFR: 8133805: Remove the bot_updates parameter from G1Allocator's allocation methods

Leo Korinth leo.korinth at oracle.com
Mon Dec 11 14:32:03 UTC 2017


The bot_updates parameter is removed so that the code is easier to read. 
The original idea behind the parameter is that the compiler will be able 
to remove a branch instruction (in certain cases) because the value will 
be known at compile time. As several classes inherits from the base 
G1AllocRegion the member variable _bot_updates is not known to the base 
class though it is always set to the same value in each of the separate 
sub classes.

I made the constructor G1GCAllocRegion protected (from public) to better 
show that that each *AllocRegion class with public constructor will have 
a fixed _bot_updates value (per class).

Another solution (not the proposed solution) is to use templates. This 
will give the compiler exact knowledge of the _bot_updates value at 
compile time. Templates could also be used to give compile time 
information about the value of InCSetState _purpose in the classes 
SurvivorGCAllocRegion and OldGCAllocRegion.

The template solution is quite verbose as parts of the code is located 
in a cpp file. Because of this I think just removing the parameter (the 
propose solution) is the way to go. The code becomes easier to read, the 
change is smaller, and energy can be put in code paths that will make a 
real difference.



mach5 hs-tier1,hs-tier2


More information about the hotspot-gc-dev mailing list