src/hotspot/share/gc/g1/g1FromCardCache.hpp
changeset 50281 bc1336220671
parent 49608 1852b17b0efc
child 53244 9807daeb47c4
--- a/src/hotspot/share/gc/g1/g1FromCardCache.hpp	Mon May 28 09:59:11 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1FromCardCache.hpp	Mon May 28 11:13:21 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -31,7 +31,7 @@
 // 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
@@ -49,9 +49,12 @@
   }
 #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