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 "gc_implementation/shared/gcTrace.hpp"
29 #include "memory/referencePolicy.hpp"
30 #include "memory/referenceProcessorStats.hpp"
31 #include "memory/referenceType.hpp"
32 #include "oops/instanceRefKlass.hpp"
33
34 class GCTimer;
35
36 // ReferenceProcessor class encapsulates the per-"collector" processing
37 // of java.lang.Reference objects for GC. The interface is useful for supporting
38 // a generational abstraction, in particular when there are multiple
39 // generations that are being independently collected -- possibly
40 // concurrently and/or incrementally. Note, however, that the
41 // ReferenceProcessor class abstracts away from a generational setting
42 // by using only a heap interval (called "span" below), thus allowing
43 // its use in a straightforward manner in a general, non-generational
44 // setting.
45 //
46 // The basic idea is that each ReferenceProcessor object concerns
47 // itself with ("weak") reference processing in a specific "span"
48 // of the heap of interest to a specific collector. Currently,
49 // the span is a convex interval of the heap, but, efficiency
50 // apart, there seems to be no reason it couldn't be extended
640 EnqueueTask(ReferenceProcessor& ref_processor,
641 DiscoveredList refs_lists[],
642 HeapWord* pending_list_addr,
643 int n_queues)
644 : _ref_processor(ref_processor),
645 _refs_lists(refs_lists),
646 _pending_list_addr(pending_list_addr),
647 _n_queues(n_queues)
648 { }
649
650 public:
651 virtual void work(unsigned int work_id) = 0;
652
653 protected:
654 ReferenceProcessor& _ref_processor;
655 DiscoveredList* _refs_lists;
656 HeapWord* _pending_list_addr;
657 int _n_queues;
658 };
659
660 #endif // SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP
|
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_GC_SHARED_REFERENCEPROCESSOR_HPP
26 #define SHARE_VM_GC_SHARED_REFERENCEPROCESSOR_HPP
27
28 #include "gc/shared/gcTrace.hpp"
29 #include "gc/shared/referencePolicy.hpp"
30 #include "gc/shared/referenceProcessorStats.hpp"
31 #include "memory/referenceType.hpp"
32 #include "oops/instanceRefKlass.hpp"
33
34 class GCTimer;
35
36 // ReferenceProcessor class encapsulates the per-"collector" processing
37 // of java.lang.Reference objects for GC. The interface is useful for supporting
38 // a generational abstraction, in particular when there are multiple
39 // generations that are being independently collected -- possibly
40 // concurrently and/or incrementally. Note, however, that the
41 // ReferenceProcessor class abstracts away from a generational setting
42 // by using only a heap interval (called "span" below), thus allowing
43 // its use in a straightforward manner in a general, non-generational
44 // setting.
45 //
46 // The basic idea is that each ReferenceProcessor object concerns
47 // itself with ("weak") reference processing in a specific "span"
48 // of the heap of interest to a specific collector. Currently,
49 // the span is a convex interval of the heap, but, efficiency
50 // apart, there seems to be no reason it couldn't be extended
640 EnqueueTask(ReferenceProcessor& ref_processor,
641 DiscoveredList refs_lists[],
642 HeapWord* pending_list_addr,
643 int n_queues)
644 : _ref_processor(ref_processor),
645 _refs_lists(refs_lists),
646 _pending_list_addr(pending_list_addr),
647 _n_queues(n_queues)
648 { }
649
650 public:
651 virtual void work(unsigned int work_id) = 0;
652
653 protected:
654 ReferenceProcessor& _ref_processor;
655 DiscoveredList* _refs_lists;
656 HeapWord* _pending_list_addr;
657 int _n_queues;
658 };
659
660 #endif // SHARE_VM_GC_SHARED_REFERENCEPROCESSOR_HPP
|