1331 } 1332 1333 bool has_handshake() const { 1334 return _handshake.has_operation(); 1335 } 1336 1337 void handshake_process_by_self() { 1338 _handshake.process_by_self(this); 1339 } 1340 1341 void handshake_process_by_vmthread() { 1342 _handshake.process_by_vmthread(this); 1343 } 1344 1345 // Suspend/resume support for JavaThread 1346 private: 1347 inline void set_ext_suspended(); 1348 inline void clear_ext_suspended(); 1349 1350 public: 1351 void java_suspend(); // higher-level suspension logic called by the public APIs 1352 void java_resume(); // higher-level resume logic called by the public APIs 1353 int java_suspend_self(); // low-level self-suspension mechanics 1354 1355 private: 1356 // mid-level wrapper around java_suspend_self to set up correct state and 1357 // check for a pending safepoint at the end 1358 void java_suspend_self_with_safepoint_check(); 1359 1360 public: 1361 void check_and_wait_while_suspended() { 1362 assert(JavaThread::current() == this, "sanity check"); 1363 1364 bool do_self_suspend; 1365 do { 1366 // were we externally suspended while we were waiting? 1367 do_self_suspend = handle_special_suspend_equivalent_condition(); 1368 if (do_self_suspend) { 1369 // don't surprise the thread that suspended us by returning 1370 java_suspend_self(); 1371 set_suspend_equivalent(); 1372 } 1373 } while (do_self_suspend); 1374 } 1375 static void check_safepoint_and_suspend_for_native_trans(JavaThread *thread); 1376 // Check for async exception in addition to safepoint and suspend request. 1377 static void check_special_condition_for_native_trans(JavaThread *thread); 1378 1379 // Same as check_special_condition_for_native_trans but finishes the 1380 // transition into thread_in_Java mode so that it can potentially | 1331 } 1332 1333 bool has_handshake() const { 1334 return _handshake.has_operation(); 1335 } 1336 1337 void handshake_process_by_self() { 1338 _handshake.process_by_self(this); 1339 } 1340 1341 void handshake_process_by_vmthread() { 1342 _handshake.process_by_vmthread(this); 1343 } 1344 1345 // Suspend/resume support for JavaThread 1346 private: 1347 inline void set_ext_suspended(); 1348 inline void clear_ext_suspended(); 1349 1350 public: 1351 void java_suspend(); 1352 void java_resume(); 1353 int java_suspend_self(); 1354 1355 void check_and_wait_while_suspended() { 1356 assert(JavaThread::current() == this, "sanity check"); 1357 1358 bool do_self_suspend; 1359 do { 1360 // were we externally suspended while we were waiting? 1361 do_self_suspend = handle_special_suspend_equivalent_condition(); 1362 if (do_self_suspend) { 1363 // don't surprise the thread that suspended us by returning 1364 java_suspend_self(); 1365 set_suspend_equivalent(); 1366 } 1367 } while (do_self_suspend); 1368 } 1369 static void check_safepoint_and_suspend_for_native_trans(JavaThread *thread); 1370 // Check for async exception in addition to safepoint and suspend request. 1371 static void check_special_condition_for_native_trans(JavaThread *thread); 1372 1373 // Same as check_special_condition_for_native_trans but finishes the 1374 // transition into thread_in_Java mode so that it can potentially |