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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 // ReferenceProcessor class encapsulates the per-"collector" processing 26 // of java.lang.Reference objects for GC. The interface is useful for supporting 27 // a generational abstraction, in particular when there are multiple 28 // generations that are being independently collected -- possibly 29 // concurrently and/or incrementally. Note, however, that the 30 // ReferenceProcessor class abstracts away from a generational setting 31 // by using only a heap interval (called "span" below), thus allowing 32 // its use in a straightforward manner in a general, non-generational 33 // setting. 34 // 35 // The basic idea is that each ReferenceProcessor object concerns 36 // itself with ("weak") reference processing in a specific "span" 37 // of the heap of interest to a specific collector. Currently, 38 // the span is a convex interval of the heap, but, efficiency 39 // apart, there seems to be no reason it couldn't be extended 40 // (with appropriate modifications) to any "non-convex interval". 41 42 // forward references 43 class ReferencePolicy; 44 class AbstractRefProcTaskExecutor; 518 HeapWord* pending_list_addr, 519 oop sentinel_ref, 520 int n_queues) 521 : _ref_processor(ref_processor), 522 _refs_lists(refs_lists), 523 _pending_list_addr(pending_list_addr), 524 _sentinel_ref(sentinel_ref), 525 _n_queues(n_queues) 526 { } 527 528 public: 529 virtual void work(unsigned int work_id) = 0; 530 531 protected: 532 ReferenceProcessor& _ref_processor; 533 DiscoveredList* _refs_lists; 534 HeapWord* _pending_list_addr; 535 oop _sentinel_ref; 536 int _n_queues; 537 }; | 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP 26 #define SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP 27 28 #include "memory/referencePolicy.hpp" 29 #include "oops/instanceRefKlass.hpp" 30 31 // ReferenceProcessor class encapsulates the per-"collector" processing 32 // of java.lang.Reference objects for GC. The interface is useful for supporting 33 // a generational abstraction, in particular when there are multiple 34 // generations that are being independently collected -- possibly 35 // concurrently and/or incrementally. Note, however, that the 36 // ReferenceProcessor class abstracts away from a generational setting 37 // by using only a heap interval (called "span" below), thus allowing 38 // its use in a straightforward manner in a general, non-generational 39 // setting. 40 // 41 // The basic idea is that each ReferenceProcessor object concerns 42 // itself with ("weak") reference processing in a specific "span" 43 // of the heap of interest to a specific collector. Currently, 44 // the span is a convex interval of the heap, but, efficiency 45 // apart, there seems to be no reason it couldn't be extended 46 // (with appropriate modifications) to any "non-convex interval". 47 48 // forward references 49 class ReferencePolicy; 50 class AbstractRefProcTaskExecutor; 524 HeapWord* pending_list_addr, 525 oop sentinel_ref, 526 int n_queues) 527 : _ref_processor(ref_processor), 528 _refs_lists(refs_lists), 529 _pending_list_addr(pending_list_addr), 530 _sentinel_ref(sentinel_ref), 531 _n_queues(n_queues) 532 { } 533 534 public: 535 virtual void work(unsigned int work_id) = 0; 536 537 protected: 538 ReferenceProcessor& _ref_processor; 539 DiscoveredList* _refs_lists; 540 HeapWord* _pending_list_addr; 541 oop _sentinel_ref; 542 int _n_queues; 543 }; 544 545 #endif // SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP |