1 /*
2 * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
105 static void set_worker_id(Thread* thread, uint id) {
106 assert(thread->is_Worker_thread(), "Must be a worker thread");
107 data(thread)->_worker_id = id;
108 }
109
110 static uint worker_id(Thread* thread) {
111 assert(thread->is_Worker_thread(), "Must be a worker thread");
112 return data(thread)->_worker_id;
113 }
114
115 static void set_force_satb_flush(Thread* thread, bool v) {
116 data(thread)->_force_satb_flush = v;
117 }
118
119 static bool is_force_satb_flush(Thread* thread) {
120 return data(thread)->_force_satb_flush;
121 }
122
123 static void initialize_gclab(Thread* thread) {
124 assert (thread->is_Java_thread() || thread->is_Worker_thread(), "Only Java and GC worker threads are allowed to get GCLABs");
125 data(thread)->_gclab = new PLAB(PLAB::min_size());
126 data(thread)->_gclab_size = 0;
127 }
128
129 static PLAB* gclab(Thread* thread) {
130 return data(thread)->_gclab;
131 }
132
133 static size_t gclab_size(Thread* thread) {
134 return data(thread)->_gclab_size;
135 }
136
137 static void set_gclab_size(Thread* thread, size_t v) {
138 data(thread)->_gclab_size = v;
139 }
140
141 #ifdef ASSERT
142 static void set_evac_allowed(Thread* thread, bool evac_allowed) {
143 if (evac_allowed) {
144 data(thread)->_oom_during_evac |= 2;
|
1 /*
2 * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
105 static void set_worker_id(Thread* thread, uint id) {
106 assert(thread->is_Worker_thread(), "Must be a worker thread");
107 data(thread)->_worker_id = id;
108 }
109
110 static uint worker_id(Thread* thread) {
111 assert(thread->is_Worker_thread(), "Must be a worker thread");
112 return data(thread)->_worker_id;
113 }
114
115 static void set_force_satb_flush(Thread* thread, bool v) {
116 data(thread)->_force_satb_flush = v;
117 }
118
119 static bool is_force_satb_flush(Thread* thread) {
120 return data(thread)->_force_satb_flush;
121 }
122
123 static void initialize_gclab(Thread* thread) {
124 assert (thread->is_Java_thread() || thread->is_Worker_thread(), "Only Java and GC worker threads are allowed to get GCLABs");
125 assert(data(thread)->_gclab == NULL, "Only initialize once");
126 data(thread)->_gclab = new PLAB(PLAB::min_size());
127 data(thread)->_gclab_size = 0;
128 }
129
130 static PLAB* gclab(Thread* thread) {
131 return data(thread)->_gclab;
132 }
133
134 static size_t gclab_size(Thread* thread) {
135 return data(thread)->_gclab_size;
136 }
137
138 static void set_gclab_size(Thread* thread, size_t v) {
139 data(thread)->_gclab_size = v;
140 }
141
142 #ifdef ASSERT
143 static void set_evac_allowed(Thread* thread, bool evac_allowed) {
144 if (evac_allowed) {
145 data(thread)->_oom_during_evac |= 2;
|