--- old/src/share/vm/gc/g1/satbMarkQueue.cpp 2016-03-04 02:58:11.251968537 -0500 +++ new/src/share/vm/gc/g1/satbMarkQueue.cpp 2016-03-04 02:58:11.155968061 -0500 @@ -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 @@ -128,12 +128,17 @@ void* entry = *src; if (retain_entry(entry, g1h)) { // Found keeper. Search high to low for an entry to discard. - while ((src < --dst) && retain_entry(*dst, g1h)) { } - if (src >= dst) break; // Done if no discard found. - *dst = entry; // Replace discard with keeper. + while (src < --dst) { + if (!retain_entry(*dst, g1h)) { + *dst = entry; // Replace discard with keeper. + break; + } + } + // If discard search failed (src == dst), the outer loop will also end. } } - assert(src == dst, "invariant"); + // dst points to the lowest retained entry, or the end of the buffer + // if all the entries were filtered out. _index = pointer_delta(dst, buf, 1); }