1 /*
2 * Copyright (c) 2001, 2016, 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 *
115 virtual void cleared_all_soft_refs();
116
117 // Identification methods.
118 virtual GenCollectorPolicy* as_generation_policy() { return NULL; }
119 virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; }
120 #if INCLUDE_ALL_GCS
121 virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; }
122 #endif // INCLUDE_ALL_GCS
123 // Note that these are not virtual.
124 bool is_generation_policy() { return as_generation_policy() != NULL; }
125 bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; }
126 #if INCLUDE_ALL_GCS
127 bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
128 #else // INCLUDE_ALL_GCS
129 bool is_concurrent_mark_sweep_policy() { return false; }
130 #endif // INCLUDE_ALL_GCS
131
132
133 virtual CardTableRS* create_rem_set(MemRegion reserved);
134
135 MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
136 size_t size,
137 Metaspace::MetadataType mdtype);
138 };
139
140 class ClearedAllSoftRefs : public StackObj {
141 bool _clear_all_soft_refs;
142 CollectorPolicy* _collector_policy;
143 public:
144 ClearedAllSoftRefs(bool clear_all_soft_refs,
145 CollectorPolicy* collector_policy) :
146 _clear_all_soft_refs(clear_all_soft_refs),
147 _collector_policy(collector_policy) {}
148
149 ~ClearedAllSoftRefs() {
150 if (_clear_all_soft_refs) {
151 _collector_policy->cleared_all_soft_refs();
152 }
153 }
154
155 bool should_clear() { return _clear_all_soft_refs; }
|
1 /*
2 * Copyright (c) 2001, 2018, 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 *
115 virtual void cleared_all_soft_refs();
116
117 // Identification methods.
118 virtual GenCollectorPolicy* as_generation_policy() { return NULL; }
119 virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; }
120 #if INCLUDE_ALL_GCS
121 virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; }
122 #endif // INCLUDE_ALL_GCS
123 // Note that these are not virtual.
124 bool is_generation_policy() { return as_generation_policy() != NULL; }
125 bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; }
126 #if INCLUDE_ALL_GCS
127 bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
128 #else // INCLUDE_ALL_GCS
129 bool is_concurrent_mark_sweep_policy() { return false; }
130 #endif // INCLUDE_ALL_GCS
131
132
133 virtual CardTableRS* create_rem_set(MemRegion reserved);
134
135 virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
136 size_t size,
137 Metaspace::MetadataType mdtype);
138 };
139
140 class ClearedAllSoftRefs : public StackObj {
141 bool _clear_all_soft_refs;
142 CollectorPolicy* _collector_policy;
143 public:
144 ClearedAllSoftRefs(bool clear_all_soft_refs,
145 CollectorPolicy* collector_policy) :
146 _clear_all_soft_refs(clear_all_soft_refs),
147 _collector_policy(collector_policy) {}
148
149 ~ClearedAllSoftRefs() {
150 if (_clear_all_soft_refs) {
151 _collector_policy->cleared_all_soft_refs();
152 }
153 }
154
155 bool should_clear() { return _clear_all_soft_refs; }
|