author | sjohanss |
Wed, 02 May 2018 13:44:49 +0200 | |
changeset 49946 | 2143feab681a |
parent 47676 | b1c020fc35a3 |
child 51546 | b9f6a4427da9 |
permissions | -rw-r--r-- |
47648
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
1 |
/* |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
4 |
* |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
8 |
* |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
13 |
* accompanied this code). |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
14 |
* |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
18 |
* |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
21 |
* questions. |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
22 |
* |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
23 |
*/ |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
24 |
|
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_GC_SHARED_WEAKPROCESSOR_HPP |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
26 |
#define SHARE_VM_GC_SHARED_WEAKPROCESSOR_HPP |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
27 |
|
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
28 |
#include "memory/allocation.hpp" |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
29 |
#include "memory/iterator.hpp" |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
30 |
|
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
31 |
// Helper class to aid in root scanning and cleaning of weak oops in the VM. |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
32 |
// |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
33 |
// New containers of weak oops added to this class will automatically |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
34 |
// be cleaned by all GCs, including the young generation GCs. |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
35 |
class WeakProcessor : AllStatic { |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
36 |
public: |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
37 |
// Visit all oop*s and apply the keep_alive closure if the referenced |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
38 |
// object is considered alive by the is_alive closure, otherwise do some |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
39 |
// container specific cleanup of element holding the oop. |
47676
b1c020fc35a3
8189748: More precise closures for WeakProcessor::weak_oops_do calls
stefank
parents:
47648
diff
changeset
|
40 |
static void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive); |
47648
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
41 |
|
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
42 |
// Visit all oop*s and apply the given closure. |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
43 |
static void oops_do(OopClosure* closure); |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
44 |
}; |
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
45 |
|
226b1fc611b9
8189359: Move native weak oops cleaning out of ReferenceProcessor
stefank
parents:
diff
changeset
|
46 |
#endif // SHARE_VM_GC_SHARED_WEAKPROCESSOR_HPP |