RFR: 8134797: Remove explicit casts in CollectorPolicy hierarchy

Jesper Wilhelmsson jesper.wilhelmsson at oracle.com
Tue Sep 1 07:25:34 UTC 2015


Hi Kim,

Nice cleanup!
Looks good!
/Jesper

Den 1/9/15 kl. 03:04, skrev Kim Barrett:
> Please review this change to eliminate explicit casts within the
> CollectorPolicy hierarchy.  All of the casts being eliminated were
> C-style casts; there are no C++ style casts in this hierarchy.
>
> For downcasts to GenCollectorPolicy* the policy was being obtained
> from a GenCollectedHeap, so we just use gen_policy instead of an
> unchecked downcast of collector_policy.
>
> For the remaining downcast (to ConcurrentMarkSweepPolicy*) we now
> assert the corresponding is_xxx_policy and use as_xxx_policy to
> perform the conversion.
>
> Changed the explicit upcasts to CollectorPolicy* to implict
> conversions.  For the problematic one, moved to a scope where
> G1CollectorPolicy is complete, so the now implicit conversion works.
> I'm kind of surprised that one didn't cause obvious problems.
>
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8134797
>
> Webrev:
> http://cr.openjdk.java.net/~kbarrett/8134797/webrev.00/
>
> Testing:
> jprt
>



More information about the hotspot-gc-dev mailing list