changeset 35864:40e215ce799a

8145192: 'count' variable can overflow in PSMarkSweep::invoke on 64 bit JVM Summary: Changed MarkSweepAlwaysCompactCount from uintx to uint Reviewed-by: tschatzl, tbenson
author sangheki
date Wed, 27 Jan 2016 10:30:27 -0800
parents 1c930000fd18
children d8e935332e13
files hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp hotspot/src/share/vm/gc/shared/collectorPolicy.cpp hotspot/src/share/vm/runtime/globals.hpp
diffstat 3 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp	Wed Jan 27 16:13:02 2016 +0000
+++ b/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp	Wed Jan 27 10:30:27 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -99,7 +99,7 @@
     heap->collector_policy()->should_clear_all_soft_refs();
 
   uint count = maximum_heap_compaction ? 1 : MarkSweepAlwaysCompactCount;
-  UIntXFlagSetting flag_setting(MarkSweepAlwaysCompactCount, count);
+  UIntFlagSetting flag_setting(MarkSweepAlwaysCompactCount, count);
   PSMarkSweep::invoke_no_policy(clear_all_soft_refs || maximum_heap_compaction);
 }
 
--- a/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp	Wed Jan 27 16:13:02 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.cpp	Wed Jan 27 10:30:27 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -774,7 +774,7 @@
   // free memory should be here, especially if they are expensive. If this
   // attempt fails, an OOM exception will be thrown.
   {
-    UIntXFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted
+    UIntFlagSetting flag_change(MarkSweepAlwaysCompactCount, 1); // Make sure the heap is fully compacted
 
     gch->do_collection(true,                      // full
                        true,                      // clear_all_soft_refs
--- a/hotspot/src/share/vm/runtime/globals.hpp	Wed Jan 27 16:13:02 2016 +0000
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jan 27 10:30:27 2016 -0800
@@ -3395,10 +3395,10 @@
           "also has a smaller default value; see arguments.cpp.")           \
           range(0, 100)                                                     \
                                                                             \
-  product(uintx, MarkSweepAlwaysCompactCount,     4,                        \
+  product(uint, MarkSweepAlwaysCompactCount,     4,                         \
           "How often should we fully compact the heap (ignoring the dead "  \
           "space parameters)")                                              \
-          range(1, max_uintx)                                               \
+          range(1, max_juint)                                               \
                                                                             \
   develop(uintx, GCExpandToAllocateDelayMillis, 0,                          \
           "Delay between expansion and allocation (in milliseconds)")       \