comparison src/share/vm/gc_implementation/g1/ptrQueue.hpp @ 2149:7e37af9d69ef

7011379: G1: overly long concurrent marking cycles Summary: This changeset introduces filtering of SATB buffers at the point when they are about to be enqueued. If this filtering clears enough entries on each buffer, the buffer can then be re-used and not enqueued. This cuts down the number of SATB buffers that need to be processed by the concurrent marking threads. Reviewed-by: johnc, ysr
author tonyp
date Wed, 19 Jan 2011 09:35:17 -0500
parents f95d63e2154a
children 2ace1c4ee8da
comparison
equal deleted inserted replaced
2137:ffd725ff6943 2149:7e37af9d69ef
1 /* 1 /*
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
66 PtrQueueSet* qset() { return _qset; } 66 PtrQueueSet* qset() { return _qset; }
67 67
68 public: 68 public:
69 // Initialize this queue to contain a null buffer, and be part of the 69 // Initialize this queue to contain a null buffer, and be part of the
70 // given PtrQueueSet. 70 // given PtrQueueSet.
71 PtrQueue(PtrQueueSet*, bool perm = false, bool active = false); 71 PtrQueue(PtrQueueSet* qset, bool perm = false, bool active = false);
72 // Release any contained resources. 72 // Release any contained resources.
73 void flush(); 73 void flush();
74 // Calls flush() when destroyed. 74 // Calls flush() when destroyed.
75 ~PtrQueue() { flush(); } 75 ~PtrQueue() { flush(); }
76 76
83 void enqueue(void* ptr) { 83 void enqueue(void* ptr) {
84 if (!_active) return; 84 if (!_active) return;
85 else enqueue_known_active(ptr); 85 else enqueue_known_active(ptr);
86 } 86 }
87 87
88 // This method is called when we're doing the zero index handling
89 // and gives a chance to the queues to do any pre-enqueueing
90 // processing they might want to do on the buffer. It should return
91 // true if the buffer should be enqueued, or false if enough
92 // entries were cleared from it so that it can be re-used. It should
93 // not return false if the buffer is still full (otherwise we can
94 // get into an infinite loop).
95 virtual bool should_enqueue_buffer() { return true; }
88 void handle_zero_index(); 96 void handle_zero_index();
89 void locking_enqueue_completed_buffer(void** buf); 97 void locking_enqueue_completed_buffer(void** buf);
90 98
91 void enqueue_known_active(void* ptr); 99 void enqueue_known_active(void* ptr);
92 100