/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "gc_implementation/shared/concurrentGCThread.hpp"
#include "oops/instanceRefKlass.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/javaCalls.hpp"
// CopyrightVersion 1.2
_should_terminate(false), _has_terminated(false) {
_sts.initialize();
};
_sts.suspend_all();
}
_sts.resume_all();
}
// XXX: need to set this to low priority
// unless "agressive mode" set; priority
// should be just less than that of VMThread.
if (!_should_terminate && !DisableStartThread) {
os::start_thread(this);
}
}
}
this->record_stack_base_and_size();
this->initialize_thread_local_storage();
// From this time Thread::current() should be working.
}
while (!is_init_completed() && !_should_terminate) {
}
}
// Signal that it is terminated
{
_has_terminated = true;
}
// Thread destructor usually does this..
}
if (!_initialized) {
"SuspendibleThreadSetLock", true);
_async = 0;
_async_stop = false;
_async_stopped = 0;
_initialized = true;
}
}
initialize();
_async++;
}
_async--;
}
if (_async_stop) {
if (_async_stop) {
if (_async_stopped == _async) {
if (ConcGCYieldTimeout > 0) {
(double)ConcGCYieldTimeout,
"Long delay; whodunit?");
}
}
_m->notify_all();
_m->notify_all();
}
}
}
initialize(); // If necessary.
if (ConcGCYieldTimeout > 0) {
}
_async_stop = true;
}
_async_stop = false;
_m->notify_all();
}
}
{}
klassOop k =
true, CHECK_NULL);
// Initialize thread_oop to put it into the system threadGroup
{
res = new SurrogateLockerThread();
// At this point it may be possible that no osthread was created for the
// JavaThread due to lack of memory. We would have to throw an exception
// in that case. However, since this must work and we do not allow
// exceptions anyway, check and abort if this fails.
vm_exit_during_initialization("java.lang.OutOfMemoryError",
"unable to create new native thread");
}
}
return res;
}
}
}
// ======= Surrogate Locker Thread =============
debug_only(unsigned int owned = 0;)
while (/* !isTerminated() */ 1) {
{
MutexLocker x(&_monitor);
// Since we are a JavaThread, we can't be here at a safepoint.
"SLT is a JavaThread");
// wait for msg buffer to become non-empty
}
}
switch(msg) {
case acquirePLL: {
debug_only(owned++;)
break;
}
case releaseAndNotifyPLL: {
debug_only(owned--;)
break;
}
case empty:
default: {
guarantee(false,"Unexpected message in _buffer");
break;
}
}
{
MutexLocker x(&_monitor);
// Since we are a JavaThread, we can't be here at a safepoint.
"SLT is a JavaThread");
}
}
}
// ===== STS Access From Outside CGCT =====
"only a conc GC thread can call this" );
}
"only a conc GC thread can call this" );
return _sts.should_yield();
}
"only a conc GC thread can call this" );
}
"only a conc GC thread can call this" );
}