1 /*
2 * Copyright (c) 1997, 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 *
1301 void set_terminated(TerminatedTypes t);
1302 // special for Threads::remove() which is static:
1303 void set_terminated_value();
1304 void block_if_vm_exited();
1305
1306 bool doing_unsafe_access() { return _doing_unsafe_access; }
1307 void set_doing_unsafe_access(bool val) { _doing_unsafe_access = val; }
1308
1309 bool do_not_unlock_if_synchronized() { return _do_not_unlock_if_synchronized; }
1310 void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; }
1311
1312 inline void set_polling_page_release(void* poll_value);
1313 inline void set_polling_page(void* poll_value);
1314 inline volatile void* get_polling_page();
1315
1316 private:
1317 // Support for thread handshake operations
1318 HandshakeState _handshake;
1319 public:
1320 void set_handshake_operation(HandshakeOperation* op) {
1321 _handshake.set_operation(this, op);
1322 }
1323
1324 bool has_handshake() const {
1325 return _handshake.has_operation();
1326 }
1327
1328 void handshake_process_by_self() {
1329 _handshake.process_by_self(this);
1330 }
1331
1332 bool handshake_try_process_by_vmThread() {
1333 return _handshake.try_process_by_vmThread(this);
1334 }
1335
1336 #ifdef ASSERT
1337 bool is_vmthread_processing_handshake() const {
1338 return _handshake.is_vmthread_processing_handshake();
1339 }
1340 #endif
1341
1342 // Suspend/resume support for JavaThread
1343 private:
1344 inline void set_ext_suspended();
1345 inline void clear_ext_suspended();
1346
1347 public:
1348 void java_suspend(); // higher-level suspension logic called by the public APIs
1349 void java_resume(); // higher-level resume logic called by the public APIs
1350 int java_suspend_self(); // low-level self-suspension mechanics
1351
1352 private:
1353 // mid-level wrapper around java_suspend_self to set up correct state and
1354 // check for a pending safepoint at the end
1355 void java_suspend_self_with_safepoint_check();
1356
1357 public:
1358 void check_and_wait_while_suspended() {
|
1 /*
2 * Copyright (c) 1997, 2020, 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 *
1301 void set_terminated(TerminatedTypes t);
1302 // special for Threads::remove() which is static:
1303 void set_terminated_value();
1304 void block_if_vm_exited();
1305
1306 bool doing_unsafe_access() { return _doing_unsafe_access; }
1307 void set_doing_unsafe_access(bool val) { _doing_unsafe_access = val; }
1308
1309 bool do_not_unlock_if_synchronized() { return _do_not_unlock_if_synchronized; }
1310 void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; }
1311
1312 inline void set_polling_page_release(void* poll_value);
1313 inline void set_polling_page(void* poll_value);
1314 inline volatile void* get_polling_page();
1315
1316 private:
1317 // Support for thread handshake operations
1318 HandshakeState _handshake;
1319 public:
1320 void set_handshake_operation(HandshakeOperation* op) {
1321 _handshake.set_operation(op);
1322 }
1323
1324 bool has_handshake() const {
1325 return _handshake.has_operation();
1326 }
1327
1328 void handshake_process_by_self() {
1329 _handshake.process_by_self();
1330 }
1331
1332 bool handshake_try_process(HandshakeOperation* op) {
1333 return _handshake.try_process(op);
1334 }
1335
1336 #ifdef ASSERT
1337 Thread* get_active_handshaker() const {
1338 return _handshake.get_active_handshaker();
1339 }
1340 #endif
1341
1342 // Suspend/resume support for JavaThread
1343 private:
1344 inline void set_ext_suspended();
1345 inline void clear_ext_suspended();
1346
1347 public:
1348 void java_suspend(); // higher-level suspension logic called by the public APIs
1349 void java_resume(); // higher-level resume logic called by the public APIs
1350 int java_suspend_self(); // low-level self-suspension mechanics
1351
1352 private:
1353 // mid-level wrapper around java_suspend_self to set up correct state and
1354 // check for a pending safepoint at the end
1355 void java_suspend_self_with_safepoint_check();
1356
1357 public:
1358 void check_and_wait_while_suspended() {
|