RFR(XS) 8223215: Shenandoah: Support verifying subset of roots

Zhengyu Gu zgu at redhat.com
Mon May 13 12:43:07 UTC 2019


Hi Aleksey,

On 5/13/19 6:39 AM, Aleksey Shipilev wrote:
> On 5/10/19 11:14 PM, Zhengyu Gu wrote:
>>
>> On 5/10/19 3:12 PM, Roman Kennke wrote:
>>> Hi Zhengyu,
>>>
>>> this looks good.
>>> Maybe the root-verifier code should be in its own files?
>>
>> Updated: http://cr.openjdk.java.net/~zgu/JDK-8223215/webrev.01/
> 
> Stylistic nits:
> 
> *) New line is missing here in shenandoahRootVerifier.cpp?
> 
>    54   }
>    55   if (verify(CLDGRoots)) {

Fixed.
> 
> *) You sure uint is not too narrow here? I think it's fine, but maybe casting through uintptr_t is
> safer?
> 
>    42 void ShenandoahRootVerifier::excludes(RootTypes types) {
>    43   _types = static_cast<ShenandoahRootVerifier::RootTypes>(static_cast<uint>(_types) &
> (~static_cast<uint>(types)));
>    44 }
> 

Change to uintptr_t won't do any good for newly supported 32-bit 
platforms :-) Added STATIC_ASSERT instead.

--- a/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp 
Mon May 13 08:14:19 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp 
Mon May 13 08:29:56 2019 -0400
@@ -36,6 +36,10 @@
  #include "memory/universe.hpp"
  #include "runtime/thread.hpp"
  #include "services/management.hpp"
+#include "utilities/debug.hpp"
+
+// Check for overflow of number of root types.
+STATIC_ASSERT((static_cast<uint>(ShenandoahRootVerifier::AllRoots) + 1) 
 > static_cast<uint>(ShenandoahRootVerifier::AllRoots));


Thanks,

-Zhengyu






> 
> -Aleksey
> 


More information about the shenandoah-dev mailing list