8221643: Tighten up assert(_keep_alive >= 0) in CLD::inc_keep_alive
authorzgu
Fri, 29 Mar 2019 14:17:09 -0400
changeset 54343 6a1406c718ec
parent 54342 07212a29787a
child 54344 8cd2af66ac7c
8221643: Tighten up assert(_keep_alive >= 0) in CLD::inc_keep_alive Reviewed-by: coleenp
src/hotspot/share/classfile/classLoaderData.cpp
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Fri Mar 29 18:00:31 2019 +0000
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Fri Mar 29 14:17:09 2019 -0400
@@ -1,5 +1,5 @@
  /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -288,7 +288,7 @@
 // it is being defined, therefore _keep_alive is not volatile or atomic.
 void ClassLoaderData::inc_keep_alive() {
   if (is_unsafe_anonymous()) {
-    assert(_keep_alive >= 0, "Invalid keep alive increment count");
+    assert(_keep_alive > 0, "Invalid keep alive increment count");
     _keep_alive++;
   }
 }