diff src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp @ 438:122d10c82f3f

6765804: GC "dead ratios" should be unsigned Reviewed-by: ysr, tonyp
author jcoomes
date Wed, 29 Oct 2008 06:30:02 -0700
parents a4b729f5b611
children 7d7a7c599c17
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp	Fri Oct 31 10:34:20 2008 -0700
+++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp	Wed Oct 29 06:30:02 2008 -0700
@@ -90,10 +90,10 @@
    */
   bool skip_dead = ((PSMarkSweep::total_invocations() % MarkSweepAlwaysCompactCount) != 0);
 
-  ssize_t allowed_deadspace = 0;
+  size_t allowed_deadspace = 0;
   if (skip_dead) {
-    int ratio = allowed_dead_ratio();
-    allowed_deadspace = (space()->capacity_in_bytes() * ratio / 100) / HeapWordSize;
+    const size_t ratio = allowed_dead_ratio();
+    allowed_deadspace = space()->capacity_in_words() * ratio / 100;
   }
 
   // Fetch the current destination decorator
@@ -271,10 +271,10 @@
   dest->set_compaction_top(compact_top);
 }
 
-bool PSMarkSweepDecorator::insert_deadspace(ssize_t& allowed_deadspace_words,
-                                       HeapWord* q, size_t deadlength) {
-  allowed_deadspace_words -= deadlength;
-  if (allowed_deadspace_words >= 0) {
+bool PSMarkSweepDecorator::insert_deadspace(size_t& allowed_deadspace_words,
+                                            HeapWord* q, size_t deadlength) {
+  if (allowed_deadspace_words >= deadlength) {
+    allowed_deadspace_words -= deadlength;
     oop(q)->set_mark(markOopDesc::prototype()->set_marked());
     const size_t aligned_min_int_array_size =
       align_object_size(typeArrayOopDesc::header_size(T_INT));