< prev index next >

src/hotspot/share/gc/g1/g1FromCardCache.hpp

Print this page
rev 50098 : [mq]: 8202842-g1-footprint-regressions

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -29,11 +29,11 @@
 #include "utilities/ostream.hpp"
 
 // G1FromCardCache remembers the most recently processed card on the heap on
 // a per-region and per-thread basis.
 class G1FromCardCache : public AllStatic {
- private:
+private:
   // Array of card indices. Indexed by heap region (rows) and thread (columns) to minimize
   // thread contention.
   // This order minimizes the time to clear all entries for a given region during region
   // freeing. I.e. a single clear of a single memory area instead of multiple separate
   // accesses with a large stride per region.

@@ -47,13 +47,16 @@
     assert(worker_id < _max_workers, "Worker_id %u is larger than maximum %u", worker_id, _max_workers);
     assert(region_idx < _max_regions, "Region_idx %u is larger than maximum %u", region_idx, _max_regions);
   }
 #endif
 
- public:
-  static const uintptr_t InvalidCard = UINTPTR_MAX;
+  // This card index indicates "no card for that entry" yet. This allows us to use the OS
+  // lazy backing of memory with zero-filled pages to avoid initial actual memory use.
+  // This means that the heap must not contain card zero.
+  static const uintptr_t InvalidCard = 0;
 
+public:
   static void clear(uint region_idx);
 
   // Returns true if the given card is in the cache at the given location, or
   // replaces the card at that location and returns false.
   static bool contains_or_replace(uint worker_id, uint region_idx, uintptr_t card) {
< prev index next >