author | stefank |
Tue, 26 Nov 2019 10:47:46 +0100 | |
changeset 59290 | 97d13893ec3c |
parent 59252 | 623722a6aeb9 |
permissions | -rw-r--r-- |
57510 | 1 |
/* |
2 |
* Copyright (c) 2019, 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 |
#include "precompiled.hpp" |
|
26 |
||
27 |
#include "gc/g1/g1ParallelCleaning.hpp" |
|
59290
97d13893ec3c
8234748: Clean up atomic and orderAccess includes
stefank
parents:
59252
diff
changeset
|
28 |
#include "runtime/atomic.hpp" |
57510 | 29 |
#if INCLUDE_JVMCI |
30 |
#include "jvmci/jvmci.hpp" |
|
31 |
#endif |
|
32 |
||
33 |
#if INCLUDE_JVMCI |
|
34 |
JVMCICleaningTask::JVMCICleaningTask() : |
|
35 |
_cleaning_claimed(0) { |
|
36 |
} |
|
37 |
||
38 |
bool JVMCICleaningTask::claim_cleaning_task() { |
|
39 |
if (_cleaning_claimed) { |
|
40 |
return false; |
|
41 |
} |
|
42 |
||
59252
623722a6aeb9
8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents:
57510
diff
changeset
|
43 |
return Atomic::cmpxchg(&_cleaning_claimed, 0, 1) == 0; |
57510 | 44 |
} |
45 |
||
46 |
void JVMCICleaningTask::work(bool unloading_occurred) { |
|
47 |
// One worker will clean JVMCI metadata handles. |
|
48 |
if (unloading_occurred && EnableJVMCI && claim_cleaning_task()) { |
|
49 |
JVMCI::do_unloading(unloading_occurred); |
|
50 |
} |
|
51 |
} |
|
52 |
#endif // INCLUDE_JVMCI |
|
53 |
||
54 |
G1ParallelCleaningTask::G1ParallelCleaningTask(BoolObjectClosure* is_alive, |
|
55 |
uint num_workers, |
|
56 |
bool unloading_occurred, |
|
57 |
bool resize_dedup_table) : |
|
58 |
AbstractGangTask("G1 Parallel Cleaning"), |
|
59 |
_unloading_occurred(unloading_occurred), |
|
60 |
_string_dedup_task(is_alive, NULL, resize_dedup_table), |
|
61 |
_code_cache_task(num_workers, is_alive, unloading_occurred), |
|
62 |
JVMCI_ONLY(_jvmci_cleaning_task() COMMA) |
|
63 |
_klass_cleaning_task() { |
|
64 |
} |
|
65 |
||
66 |
// The parallel work done by all worker threads. |
|
67 |
void G1ParallelCleaningTask::work(uint worker_id) { |
|
68 |
// Clean JVMCI metadata handles. |
|
69 |
// Execute this task first because it is serial task. |
|
70 |
JVMCI_ONLY(_jvmci_cleaning_task.work(_unloading_occurred);) |
|
71 |
||
72 |
// Do first pass of code cache cleaning. |
|
73 |
_code_cache_task.work(worker_id); |
|
74 |
||
75 |
// Clean the string dedup data structures. |
|
76 |
_string_dedup_task.work(worker_id); |
|
77 |
||
78 |
// Clean all klasses that were not unloaded. |
|
79 |
// The weak metadata in klass doesn't need to be |
|
80 |
// processed if there was no unloading. |
|
81 |
if (_unloading_occurred) { |
|
82 |
_klass_cleaning_task.work(); |
|
83 |
} |
|
84 |
} |