--- old/src/hotspot/share/gc/g1/g1FromCardCache.hpp 2018-05-16 17:25:42.808207996 +0200 +++ new/src/hotspot/share/gc/g1/g1FromCardCache.hpp 2018-05-16 17:25:42.500198523 +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