--- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp Tue Jan 20 10:22:43 2015 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp Thu Jul 31 11:10:02 2014 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, 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
@@ -47,6 +47,13 @@
// active field set to true.
PtrQueue(qset_, perm, true /* active */) { }
+ // Flush before destroying; queue may be used to capture pending work while
+ // doing something else, with auto-flush on completion.
+ ~DirtyCardQueue() { if (!is_permanent()) flush(); }
+
+ // Process queue entries and release resources.
+ void flush() { flush_impl(); }
+
// Apply the closure to all elements, and reset the index to make the
// buffer empty. If a closure application returns "false", return
// "false" immediately, halting the iteration. If "consume" is true,