1 /*
2  * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
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_GC_SERIAL_SERIALGCREFPROCPROXYTASK_HPP
26 #define SHARE_GC_SERIAL_SERIALGCREFPROCPROXYTASK_HPP
27 
28 #include "gc/shared/referenceProcessor.hpp"
29 
30 class SerialGCRefProcProxyTask : public RefProcProxyTask {
31   BoolObjectClosure& _is_alive;
32   OopClosure& _keep_alive;
33   VoidClosure& _complete_gc;
34 
35 public:
SerialGCRefProcProxyTask(BoolObjectClosure & is_alive,OopClosure & keep_alive,VoidClosure & complete_gc)36   SerialGCRefProcProxyTask(BoolObjectClosure& is_alive, OopClosure& keep_alive, VoidClosure& complete_gc)
37     : RefProcProxyTask("SerialGCRefProcProxyTask", 1),
38       _is_alive(is_alive),
39       _keep_alive(keep_alive),
40       _complete_gc(complete_gc) {}
41 
work(uint worker_id)42   void work(uint worker_id) override {
43     assert(worker_id < _max_workers, "sanity");
44     _rp_task->rp_work(worker_id, &_is_alive, &_keep_alive, &_complete_gc);
45   }
46 };
47 
48 #endif /* SHARE_GC_SERIAL_SERIALGCREFPROCPROXYTASK_HPP */
49