8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket

Checkpoint do_space_filter.ksh cleanups for Contended Locking.

Reviewed-by: sspitsyn, coleenp
This commit is contained in:
Daniel D. Daugherty 2014-06-17 12:54:01 -07:00
parent 57113f7d70
commit 7d153c461e
10 changed files with 1595 additions and 1595 deletions

View File

@ -786,7 +786,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
case os::java_thread:
// Java threads use ThreadStackSize which default value can be
// changed with the flag -Xss
assert (JavaThread::stack_size_at_create() > 0, "this should be set");
assert(JavaThread::stack_size_at_create() > 0, "this should be set");
stack_size = JavaThread::stack_size_at_create();
break;
case os::compiler_thread:
@ -1303,7 +1303,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
if (pelements == NULL) {
return false;
}
for (int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
// Really shouldn't be NULL, but check can't hurt
if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
continue; // skip the empty path values
@ -1316,7 +1316,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
}
}
// release the storage
for (int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
}
@ -1467,7 +1467,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
bool failed_to_read_elf_head=
(sizeof(elf_head)!=
(::read(file_descriptor, &elf_head,sizeof(elf_head)))) ;
(::read(file_descriptor, &elf_head,sizeof(elf_head))));
::close(file_descriptor);
if (failed_to_read_elf_head) {
@ -1565,7 +1565,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
int running_arch_index=-1;
for (unsigned int i=0 ; i < ARRAY_SIZE(arch_array) ; i++ ) {
for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
if (running_arch_code == arch_array[i].code) {
running_arch_index = i;
}
@ -1596,7 +1596,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
#endif // !S390
if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) {
if ( lib_arch.name!=NULL ) {
if (lib_arch.name!=NULL) {
::snprintf(diag_msg_buf, diag_msg_max_length-1,
" (Possible cause: can't load %s-bit .so on a %s-bit platform)",
lib_arch.name, arch_array[running_arch_index].name);
@ -2598,7 +2598,7 @@ void os::yield() {
sched_yield();
}
os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN ;}
os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN; }
void os::yield_all() {
// Yields to all threads, including threads with lower priorities
@ -2686,7 +2686,7 @@ static int prio_init() {
}
OSReturn os::set_native_priority(Thread* thread, int newpri) {
if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK;
if (!UseThreadPriorities || ThreadPriorityPolicy == 0) return OS_OK;
#ifdef __OpenBSD__
// OpenBSD pthread_setprio starves low priority threads
@ -2713,7 +2713,7 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) {
}
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) {
if (!UseThreadPriorities || ThreadPriorityPolicy == 0) {
*priority_ptr = java_to_os_priority[NormPriority];
return OS_OK;
}
@ -3079,7 +3079,7 @@ bool os::Bsd::chained_handler(int sig, siginfo_t* siginfo, void* context) {
}
struct sigaction* os::Bsd::get_preinstalled_handler(int sig) {
if ((( (unsigned int)1 << sig ) & sigs) != 0) {
if ((((unsigned int)1 << sig) & sigs) != 0) {
return &sigact[sig];
}
return NULL;
@ -3300,7 +3300,7 @@ static void print_signal_handler(outputStream* st, int sig,
address rh = VMError::get_resetted_sighandler(sig);
// May be, handler was resetted by VMError?
if(rh != NULL) {
if (rh != NULL) {
handler = rh;
sa.sa_flags = VMError::get_resetted_sigflags(sig) & SIGNIFICANT_SIGNAL_MASK;
}
@ -3309,11 +3309,11 @@ static void print_signal_handler(outputStream* st, int sig,
os::Posix::print_sa_flags(st, sa.sa_flags);
// Check: is it our handler?
if(handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
if (handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) {
// It is our signal handler
// check for flags, reset system-used one!
if((int)sa.sa_flags != os::Bsd::get_our_sigflags(sig)) {
if ((int)sa.sa_flags != os::Bsd::get_our_sigflags(sig)) {
st->print(
", flags was changed from " PTR32_FORMAT ", consider using jsig library",
os::Bsd::get_our_sigflags(sig));
@ -3382,10 +3382,10 @@ void os::Bsd::check_signal_handler(int sig) {
address thisHandler = (act.sa_flags & SA_SIGINFO)
? CAST_FROM_FN_PTR(address, act.sa_sigaction)
: CAST_FROM_FN_PTR(address, act.sa_handler) ;
: CAST_FROM_FN_PTR(address, act.sa_handler);
switch(sig) {
switch (sig) {
case SIGSEGV:
case SIGBUS:
case SIGFPE:
@ -3515,22 +3515,22 @@ jint os::init_2(void)
{
// Allocate a single page and mark it as readable for safepoint polling
address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
guarantee( polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page" );
guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
os::set_polling_page( polling_page );
os::set_polling_page(polling_page);
#ifndef PRODUCT
if(Verbose && PrintMiscellaneous)
if (Verbose && PrintMiscellaneous)
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
#endif
if (!UseMembar) {
address mem_serialize_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
guarantee( mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
os::set_memory_serialize_page( mem_serialize_page );
guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if(Verbose && PrintMiscellaneous)
if (Verbose && PrintMiscellaneous)
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
#endif
}
@ -3631,13 +3631,13 @@ void os::init_3(void) { }
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
if( !guard_memory((char*)_polling_page, Bsd::page_size()) )
if (!guard_memory((char*)_polling_page, Bsd::page_size()))
fatal("Could not disable polling page");
};
// Mark the polling page as readable
void os::make_polling_page_readable(void) {
if( !bsd_mprotect((char *)_polling_page, Bsd::page_size(), PROT_READ)) {
if (!bsd_mprotect((char *)_polling_page, Bsd::page_size(), PROT_READ)) {
fatal("Could not enable polling page");
}
};
@ -4229,9 +4229,9 @@ static struct timespec* compute_abstime(struct timespec* abstime, jlong millis)
int os::PlatformEvent::TryPark() {
for (;;) {
const int v = _Event ;
guarantee ((v == 0) || (v == 1), "invariant") ;
if (Atomic::cmpxchg (0, &_Event, v) == v) return v ;
const int v = _Event;
guarantee((v == 0) || (v == 1), "invariant");
if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
}
}
@ -4239,18 +4239,18 @@ void os::PlatformEvent::park() { // AKA "down()"
// Invariant: Only the thread associated with the Event/PlatformEvent
// may call park().
// TODO: assert that _Assoc != NULL or _Assoc == Self
int v ;
int v;
for (;;) {
v = _Event ;
if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
v = _Event;
if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee (v >= 0, "invariant") ;
guarantee(v >= 0, "invariant");
if (v == 0) {
// Do this the hard way by blocking ...
int status = pthread_mutex_lock(_mutex);
assert_status(status == 0, status, "mutex_lock");
guarantee (_nParked == 0, "invariant") ;
++ _nParked ;
guarantee(_nParked == 0, "invariant");
++_nParked;
while (_Event < 0) {
status = pthread_cond_wait(_cond, _mutex);
// for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
@ -4258,28 +4258,28 @@ void os::PlatformEvent::park() { // AKA "down()"
if (status == ETIMEDOUT) { status = EINTR; }
assert_status(status == 0 || status == EINTR, status, "cond_wait");
}
-- _nParked ;
--_nParked;
_Event = 0 ;
_Event = 0;
status = pthread_mutex_unlock(_mutex);
assert_status(status == 0, status, "mutex_unlock");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other.
OrderAccess::fence();
}
guarantee (_Event >= 0, "invariant") ;
guarantee(_Event >= 0, "invariant");
}
int os::PlatformEvent::park(jlong millis) {
guarantee (_nParked == 0, "invariant") ;
guarantee(_nParked == 0, "invariant");
int v ;
int v;
for (;;) {
v = _Event ;
if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
v = _Event;
if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee (v >= 0, "invariant") ;
if (v != 0) return OS_OK ;
guarantee(v >= 0, "invariant");
if (v != 0) return OS_OK;
// We do this the hard way, by blocking the thread.
// Consider enforcing a minimum timeout value.
@ -4289,8 +4289,8 @@ int os::PlatformEvent::park(jlong millis) {
int ret = OS_TIMEOUT;
int status = pthread_mutex_lock(_mutex);
assert_status(status == 0, status, "mutex_lock");
guarantee (_nParked == 0, "invariant") ;
++_nParked ;
guarantee(_nParked == 0, "invariant");
++_nParked;
// Object.wait(timo) will return because of
// (a) notification
@ -4308,24 +4308,24 @@ int os::PlatformEvent::park(jlong millis) {
while (_Event < 0) {
status = os::Bsd::safe_cond_timedwait(_cond, _mutex, &abst);
if (status != 0 && WorkAroundNPTLTimedWaitHang) {
pthread_cond_destroy (_cond);
pthread_cond_init (_cond, NULL) ;
pthread_cond_destroy(_cond);
pthread_cond_init(_cond, NULL);
}
assert_status(status == 0 || status == EINTR ||
status == ETIMEDOUT,
status, "cond_timedwait");
if (!FilterSpuriousWakeups) break ; // previous semantics
if (status == ETIMEDOUT) break ;
if (!FilterSpuriousWakeups) break; // previous semantics
if (status == ETIMEDOUT) break;
// We consume and ignore EINTR and spurious wakeups.
}
--_nParked ;
--_nParked;
if (_Event >= 0) {
ret = OS_OK;
}
_Event = 0 ;
_Event = 0;
status = pthread_mutex_unlock(_mutex);
assert_status(status == 0, status, "mutex_unlock");
assert (_nParked == 0, "invariant") ;
assert(_nParked == 0, "invariant");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other.
OrderAccess::fence();
@ -4409,7 +4409,7 @@ void os::PlatformEvent::unpark() {
*/
static void unpackTime(struct timespec* absTime, bool isAbsolute, jlong time) {
assert (time > 0, "convertTime");
assert(time > 0, "convertTime");
struct timeval now;
int status = gettimeofday(&now, NULL);
@ -4470,7 +4470,7 @@ void Parker::park(bool isAbsolute, jlong time) {
// Next, demultiplex/decode time arguments
struct timespec absTime;
if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
if (time < 0 || (isAbsolute && time == 0)) { // don't wait at all
return;
}
if (time > 0) {
@ -4492,11 +4492,11 @@ void Parker::park(bool isAbsolute, jlong time) {
return;
}
int status ;
int status;
if (_counter > 0) { // no wait needed
_counter = 0;
status = pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other and Java-level accesses.
OrderAccess::fence();
@ -4516,12 +4516,12 @@ void Parker::park(bool isAbsolute, jlong time) {
// cleared by handle_special_suspend_equivalent_condition() or java_suspend_self()
if (time == 0) {
status = pthread_cond_wait (_cond, _mutex) ;
status = pthread_cond_wait(_cond, _mutex);
} else {
status = os::Bsd::safe_cond_timedwait (_cond, _mutex, &absTime) ;
status = os::Bsd::safe_cond_timedwait(_cond, _mutex, &absTime);
if (status != 0 && WorkAroundNPTLTimedWaitHang) {
pthread_cond_destroy (_cond) ;
pthread_cond_init (_cond, NULL);
pthread_cond_destroy(_cond);
pthread_cond_init(_cond, NULL);
}
}
assert_status(status == 0 || status == EINTR ||
@ -4532,9 +4532,9 @@ void Parker::park(bool isAbsolute, jlong time) {
pthread_sigmask(SIG_SETMASK, &oldsigs, NULL);
#endif
_counter = 0 ;
status = pthread_mutex_unlock(_mutex) ;
assert_status(status == 0, status, "invariant") ;
_counter = 0;
status = pthread_mutex_unlock(_mutex);
assert_status(status == 0, status, "invariant");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other and Java-level accesses.
OrderAccess::fence();
@ -4546,26 +4546,26 @@ void Parker::park(bool isAbsolute, jlong time) {
}
void Parker::unpark() {
int s, status ;
int s, status;
status = pthread_mutex_lock(_mutex);
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
s = _counter;
_counter = 1;
if (s < 1) {
if (WorkAroundNPTLTimedWaitHang) {
status = pthread_cond_signal (_cond) ;
assert (status == 0, "invariant") ;
status = pthread_cond_signal(_cond);
assert(status == 0, "invariant");
status = pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
} else {
status = pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant") ;
status = pthread_cond_signal (_cond) ;
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
status = pthread_cond_signal(_cond);
assert(status == 0, "invariant");
}
} else {
pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
}
}

View File

@ -862,7 +862,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
case os::java_thread:
// Java threads use ThreadStackSize which default value can be
// changed with the flag -Xss
assert (JavaThread::stack_size_at_create() > 0, "this should be set");
assert(JavaThread::stack_size_at_create() > 0, "this should be set");
stack_size = JavaThread::stack_size_at_create();
break;
case os::compiler_thread:
@ -1097,7 +1097,7 @@ static bool find_vma(address addr, address* vma_low, address* vma_high) {
if (low <= addr && addr < high) {
if (vma_low) *vma_low = low;
if (vma_high) *vma_high = high;
fclose (fp);
fclose(fp);
return true;
}
}
@ -1420,7 +1420,7 @@ void os::Linux::fast_thread_clock_init() {
// must return at least tp.tv_sec == 0 which means a resolution
// better than 1 sec. This is extra check for reliability.
if(pthread_getcpuclockid_func &&
if (pthread_getcpuclockid_func &&
pthread_getcpuclockid_func(_main_thread, &clockid) == 0 &&
sys_clock_getres(clockid, &tp) == 0 && tp.tv_sec == 0) {
@ -1630,7 +1630,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
if (pelements == NULL) {
return false;
}
for (int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
// Really shouldn't be NULL, but check can't hurt
if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
continue; // skip the empty path values
@ -1642,7 +1642,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
}
}
// release the storage
for (int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
}
@ -1906,7 +1906,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
bool failed_to_read_elf_head=
(sizeof(elf_head)!=
(::read(file_descriptor, &elf_head,sizeof(elf_head)))) ;
(::read(file_descriptor, &elf_head,sizeof(elf_head))));
::close(file_descriptor);
if (failed_to_read_elf_head) {
@ -1988,7 +1988,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
int running_arch_index=-1;
for (unsigned int i=0 ; i < ARRAY_SIZE(arch_array) ; i++ ) {
for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
if (running_arch_code == arch_array[i].code) {
running_arch_index = i;
}
@ -2019,7 +2019,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
#endif // !S390
if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) {
if ( lib_arch.name!=NULL ) {
if (lib_arch.name!=NULL) {
::snprintf(diag_msg_buf, diag_msg_max_length-1,
" (Possible cause: can't load %s-bit .so on a %s-bit platform)",
lib_arch.name, arch_array[running_arch_index].name);
@ -3793,7 +3793,7 @@ void os::yield() {
sched_yield();
}
os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN ;}
os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN; }
void os::yield_all() {
// Yields to all threads, including threads with lower priorities
@ -3858,14 +3858,14 @@ static int prio_init() {
}
OSReturn os::set_native_priority(Thread* thread, int newpri) {
if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK;
if (!UseThreadPriorities || ThreadPriorityPolicy == 0) return OS_OK;
int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri);
return (ret == 0) ? OS_OK : OS_ERR;
}
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) {
if (!UseThreadPriorities || ThreadPriorityPolicy == 0) {
*priority_ptr = java_to_os_priority[NormPriority];
return OS_OK;
}
@ -4219,7 +4219,7 @@ bool os::Linux::chained_handler(int sig, siginfo_t* siginfo, void* context) {
}
struct sigaction* os::Linux::get_preinstalled_handler(int sig) {
if ((( (unsigned int)1 << sig ) & sigs) != 0) {
if ((((unsigned int)1 << sig) & sigs) != 0) {
return &sigact[sig];
}
return NULL;
@ -4423,7 +4423,7 @@ static void print_signal_handler(outputStream* st, int sig,
address rh = VMError::get_resetted_sighandler(sig);
// May be, handler was resetted by VMError?
if(rh != NULL) {
if (rh != NULL) {
handler = rh;
sa.sa_flags = VMError::get_resetted_sigflags(sig) & SIGNIFICANT_SIGNAL_MASK;
}
@ -4432,11 +4432,11 @@ static void print_signal_handler(outputStream* st, int sig,
os::Posix::print_sa_flags(st, sa.sa_flags);
// Check: is it our handler?
if(handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
if (handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) ||
handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) {
// It is our signal handler
// check for flags, reset system-used one!
if((int)sa.sa_flags != os::Linux::get_our_sigflags(sig)) {
if ((int)sa.sa_flags != os::Linux::get_our_sigflags(sig)) {
st->print(
", flags was changed from " PTR32_FORMAT ", consider using jsig library",
os::Linux::get_our_sigflags(sig));
@ -4507,10 +4507,10 @@ void os::Linux::check_signal_handler(int sig) {
address thisHandler = (act.sa_flags & SA_SIGINFO)
? CAST_FROM_FN_PTR(address, act.sa_sigaction)
: CAST_FROM_FN_PTR(address, act.sa_handler) ;
: CAST_FROM_FN_PTR(address, act.sa_handler);
switch(sig) {
switch (sig) {
case SIGSEGV:
case SIGBUS:
case SIGFPE:
@ -4662,22 +4662,22 @@ jint os::init_2(void)
// Allocate a single page and mark it as readable for safepoint polling
address polling_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
guarantee( polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page" );
guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
os::set_polling_page( polling_page );
os::set_polling_page(polling_page);
#ifndef PRODUCT
if(Verbose && PrintMiscellaneous)
if (Verbose && PrintMiscellaneous)
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
#endif
if (!UseMembar) {
address mem_serialize_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
guarantee( mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
os::set_memory_serialize_page( mem_serialize_page );
guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if(Verbose && PrintMiscellaneous)
if (Verbose && PrintMiscellaneous)
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
#endif
}
@ -4819,13 +4819,13 @@ void os::init_3(void) {
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
if( !guard_memory((char*)_polling_page, Linux::page_size()) )
if (!guard_memory((char*)_polling_page, Linux::page_size()))
fatal("Could not disable polling page");
};
// Mark the polling page as readable
void os::make_polling_page_readable(void) {
if( !linux_mprotect((char *)_polling_page, Linux::page_size(), PROT_READ)) {
if (!linux_mprotect((char *)_polling_page, Linux::page_size(), PROT_READ)) {
fatal("Could not enable polling page");
}
};
@ -5288,7 +5288,7 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
snprintf(proc_name, 64, "/proc/self/task/%d/stat", tid);
fp = fopen(proc_name, "r");
if ( fp == NULL ) return -1;
if (fp == NULL) return -1;
statlen = fread(stat, 1, 2047, fp);
stat[statlen] = '\0';
fclose(fp);
@ -5300,7 +5300,7 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
// We don't really need to know the command string, just find the last
// occurrence of ")" and then start parsing from there. See bug 4726580.
s = strrchr(stat, ')');
if (s == NULL ) return -1;
if (s == NULL) return -1;
// Skip blank chars
do s++; while (isspace(*s));
@ -5309,7 +5309,7 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
&cdummy, &idummy, &idummy, &idummy, &idummy, &idummy,
&ldummy, &ldummy, &ldummy, &ldummy, &ldummy,
&user_time, &sys_time);
if ( count != 13 ) return -1;
if (count != 13) return -1;
if (user_sys_cpu_time) {
return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec);
} else {
@ -5468,9 +5468,9 @@ static struct timespec* compute_abstime(timespec* abstime, jlong millis) {
int os::PlatformEvent::TryPark() {
for (;;) {
const int v = _Event ;
guarantee ((v == 0) || (v == 1), "invariant") ;
if (Atomic::cmpxchg (0, &_Event, v) == v) return v ;
const int v = _Event;
guarantee((v == 0) || (v == 1), "invariant");
if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
}
}
@ -5478,18 +5478,18 @@ void os::PlatformEvent::park() { // AKA "down()"
// Invariant: Only the thread associated with the Event/PlatformEvent
// may call park().
// TODO: assert that _Assoc != NULL or _Assoc == Self
int v ;
int v;
for (;;) {
v = _Event ;
if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
v = _Event;
if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee (v >= 0, "invariant") ;
guarantee(v >= 0, "invariant");
if (v == 0) {
// Do this the hard way by blocking ...
int status = pthread_mutex_lock(_mutex);
assert_status(status == 0, status, "mutex_lock");
guarantee (_nParked == 0, "invariant") ;
++ _nParked ;
guarantee(_nParked == 0, "invariant");
++_nParked;
while (_Event < 0) {
status = pthread_cond_wait(_cond, _mutex);
// for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
@ -5497,28 +5497,28 @@ void os::PlatformEvent::park() { // AKA "down()"
if (status == ETIME) { status = EINTR; }
assert_status(status == 0 || status == EINTR, status, "cond_wait");
}
-- _nParked ;
--_nParked;
_Event = 0 ;
_Event = 0;
status = pthread_mutex_unlock(_mutex);
assert_status(status == 0, status, "mutex_unlock");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other.
OrderAccess::fence();
}
guarantee (_Event >= 0, "invariant") ;
guarantee(_Event >= 0, "invariant");
}
int os::PlatformEvent::park(jlong millis) {
guarantee (_nParked == 0, "invariant") ;
guarantee(_nParked == 0, "invariant");
int v ;
int v;
for (;;) {
v = _Event ;
if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
v = _Event;
if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee (v >= 0, "invariant") ;
if (v != 0) return OS_OK ;
guarantee(v >= 0, "invariant");
if (v != 0) return OS_OK;
// We do this the hard way, by blocking the thread.
// Consider enforcing a minimum timeout value.
@ -5528,8 +5528,8 @@ int os::PlatformEvent::park(jlong millis) {
int ret = OS_TIMEOUT;
int status = pthread_mutex_lock(_mutex);
assert_status(status == 0, status, "mutex_lock");
guarantee (_nParked == 0, "invariant") ;
++_nParked ;
guarantee(_nParked == 0, "invariant");
++_nParked;
// Object.wait(timo) will return because of
// (a) notification
@ -5547,24 +5547,24 @@ int os::PlatformEvent::park(jlong millis) {
while (_Event < 0) {
status = os::Linux::safe_cond_timedwait(_cond, _mutex, &abst);
if (status != 0 && WorkAroundNPTLTimedWaitHang) {
pthread_cond_destroy (_cond);
pthread_cond_init (_cond, os::Linux::condAttr()) ;
pthread_cond_destroy(_cond);
pthread_cond_init(_cond, os::Linux::condAttr());
}
assert_status(status == 0 || status == EINTR ||
status == ETIME || status == ETIMEDOUT,
status, "cond_timedwait");
if (!FilterSpuriousWakeups) break ; // previous semantics
if (status == ETIME || status == ETIMEDOUT) break ;
if (!FilterSpuriousWakeups) break; // previous semantics
if (status == ETIME || status == ETIMEDOUT) break;
// We consume and ignore EINTR and spurious wakeups.
}
--_nParked ;
--_nParked;
if (_Event >= 0) {
ret = OS_OK;
}
_Event = 0 ;
_Event = 0;
status = pthread_mutex_unlock(_mutex);
assert_status(status == 0, status, "mutex_unlock");
assert (_nParked == 0, "invariant") ;
assert(_nParked == 0, "invariant");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other.
OrderAccess::fence();
@ -5647,7 +5647,7 @@ void os::PlatformEvent::unpark() {
*/
static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) {
assert (time > 0, "convertTime");
assert(time > 0, "convertTime");
time_t max_secs = 0;
if (!os::supports_monotonic_clock() || isAbsolute) {
@ -5726,7 +5726,7 @@ void Parker::park(bool isAbsolute, jlong time) {
// Next, demultiplex/decode time arguments
timespec absTime;
if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
if (time < 0 || (isAbsolute && time == 0)) { // don't wait at all
return;
}
if (time > 0) {
@ -5748,11 +5748,11 @@ void Parker::park(bool isAbsolute, jlong time) {
return;
}
int status ;
int status;
if (_counter > 0) { // no wait needed
_counter = 0;
status = pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other and Java-level accesses.
OrderAccess::fence();
@ -5774,13 +5774,13 @@ void Parker::park(bool isAbsolute, jlong time) {
assert(_cur_index == -1, "invariant");
if (time == 0) {
_cur_index = REL_INDEX; // arbitrary choice when not timed
status = pthread_cond_wait (&_cond[_cur_index], _mutex) ;
status = pthread_cond_wait(&_cond[_cur_index], _mutex);
} else {
_cur_index = isAbsolute ? ABS_INDEX : REL_INDEX;
status = os::Linux::safe_cond_timedwait (&_cond[_cur_index], _mutex, &absTime) ;
status = os::Linux::safe_cond_timedwait(&_cond[_cur_index], _mutex, &absTime);
if (status != 0 && WorkAroundNPTLTimedWaitHang) {
pthread_cond_destroy (&_cond[_cur_index]) ;
pthread_cond_init (&_cond[_cur_index], isAbsolute ? NULL : os::Linux::condAttr());
pthread_cond_destroy(&_cond[_cur_index]);
pthread_cond_init(&_cond[_cur_index], isAbsolute ? NULL : os::Linux::condAttr());
}
}
_cur_index = -1;
@ -5792,9 +5792,9 @@ void Parker::park(bool isAbsolute, jlong time) {
pthread_sigmask(SIG_SETMASK, &oldsigs, NULL);
#endif
_counter = 0 ;
status = pthread_mutex_unlock(_mutex) ;
assert_status(status == 0, status, "invariant") ;
_counter = 0;
status = pthread_mutex_unlock(_mutex);
assert_status(status == 0, status, "invariant");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other and Java-level accesses.
OrderAccess::fence();
@ -5806,9 +5806,9 @@ void Parker::park(bool isAbsolute, jlong time) {
}
void Parker::unpark() {
int s, status ;
int s, status;
status = pthread_mutex_lock(_mutex);
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
s = _counter;
_counter = 1;
if (s < 1) {
@ -5817,22 +5817,22 @@ void Parker::unpark() {
// thread is definitely parked
if (WorkAroundNPTLTimedWaitHang) {
status = pthread_cond_signal (&_cond[_cur_index]);
assert (status == 0, "invariant");
assert(status == 0, "invariant");
status = pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant");
assert(status == 0, "invariant");
} else {
status = pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant");
assert(status == 0, "invariant");
status = pthread_cond_signal (&_cond[_cur_index]);
assert (status == 0, "invariant");
assert(status == 0, "invariant");
}
} else {
pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
}
} else {
pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
}
}

View File

@ -212,13 +212,13 @@ Thread* ThreadLocalStorage::get_thread_via_cache_slowly(uintptr_t raw_id,
"sp must be inside of selected thread stack");
thread->set_self_raw_id(raw_id); // mark for quick retrieval
_get_thread_cache[ index ] = thread;
_get_thread_cache[index] = thread;
}
return thread;
}
static const double all_zero[ sizeof(Thread) / sizeof(double) + 1 ] = {0};
static const double all_zero[sizeof(Thread) / sizeof(double) + 1] = {0};
#define NO_CACHED_THREAD ((Thread*)all_zero)
void ThreadLocalStorage::pd_set_thread(Thread* thread) {
@ -270,8 +270,8 @@ static inline stack_t get_stack_info() {
}
address os::current_stack_base() {
int r = thr_main() ;
guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
int r = thr_main();
guarantee(r == 0 || r == 1, "CR6501650 or CR6493689");
bool is_primordial_thread = r;
// Workaround 4352906, avoid calls to thr_stksegment by
@ -293,9 +293,9 @@ address os::current_stack_base() {
size_t os::current_stack_size() {
size_t size;
int r = thr_main() ;
guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
if(!r) {
int r = thr_main();
guarantee(r == 0 || r == 1, "CR6501650 or CR6493689");
if (!r) {
size = get_stack_info().ss_size;
} else {
struct rlimit limits;
@ -409,7 +409,7 @@ static bool find_processors_in_pset(psetid_t pset,
static bool find_processors_online(processorid_t** id_array,
uint* id_length) {
const processorid_t MAX_PROCESSOR_ID = 100000 ;
const processorid_t MAX_PROCESSOR_ID = 100000;
// Find the number of processors online.
*id_length = sysconf(_SC_NPROCESSORS_ONLN);
// Make up an array to hold their ids.
@ -436,7 +436,7 @@ static bool find_processors_online(processorid_t** id_array,
// we've got. Note that in the worst case find_processors_online() could
// return an empty set. (As a fall-back in the case of the empty set we
// could just return the ID of the current processor).
*id_length = found ;
*id_length = found;
}
return true;
@ -552,13 +552,13 @@ bool os::bind_to_processor(uint processor_id) {
}
bool os::getenv(const char* name, char* buffer, int len) {
char* val = ::getenv( name );
if ( val == NULL
char* val = ::getenv(name);
if (val == NULL
|| strlen(val) + 1 > len ) {
if (len > 0) buffer[0] = 0; // return a null string
return false;
}
strcpy( buffer, val );
strcpy(buffer, val);
return true;
}
@ -672,7 +672,7 @@ void os::init_system_properties_values() {
// Determine search path count and required buffer size.
if (dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info) == -1) {
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
vm_exit_during_initialization("dlinfo SERINFOSIZE request", dlerror());
}
@ -683,7 +683,7 @@ void os::init_system_properties_values() {
// Obtain search path information.
if (dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info) == -1) {
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
FREE_C_HEAP_ARRAY(char, info, mtInternal);
vm_exit_during_initialization("dlinfo SERINFO request", dlerror());
}
@ -794,7 +794,7 @@ bool os::obsolete_option(const JavaVMOption *option)
bool os::Solaris::valid_stack_address(Thread* thread, address sp) {
address stackStart = (address)thread->stack_base();
address stackEnd = (address)(stackStart - (address)thread->stack_size());
if (sp < stackStart && sp >= stackEnd ) return true;
if (sp < stackStart && sp >= stackEnd) return true;
return false;
}
@ -819,8 +819,8 @@ extern "C" void* java_start(void* thread_addr) {
Thread* thread = (Thread*)thread_addr;
OSThread* osthr = thread->osthread();
osthr->set_lwp_id( _lwp_self() ); // Store lwp in case we are bound
thread->_schedctl = (void *) schedctl_init () ;
osthr->set_lwp_id(_lwp_self()); // Store lwp in case we are bound
thread->_schedctl = (void *) schedctl_init();
if (UseNUMA) {
int lgrp_id = os::numa_get_group_id();
@ -839,8 +839,8 @@ extern "C" void* java_start(void* thread_addr) {
// in java_to_os_priority. So we save the native priority
// in the osThread and recall it here.
if ( osthr->thread_id() != -1 ) {
if ( UseThreadPriorities ) {
if (osthr->thread_id() != -1) {
if (UseThreadPriorities) {
int prio = osthr->native_priority();
if (ThreadPriorityVerbose) {
tty->print_cr("Starting Thread " INTPTR_FORMAT ", LWP is "
@ -882,7 +882,7 @@ static OSThread* create_os_thread(Thread* thread, thread_t thread_id) {
// Store info on the Solaris thread into the OSThread
osthread->set_thread_id(thread_id);
osthread->set_lwp_id(_lwp_self());
thread->_schedctl = (void *) schedctl_init () ;
thread->_schedctl = (void *) schedctl_init();
if (UseNUMA) {
int lgrp_id = os::numa_get_group_id();
@ -891,9 +891,9 @@ static OSThread* create_os_thread(Thread* thread, thread_t thread_id) {
}
}
if ( ThreadPriorityVerbose ) {
if (ThreadPriorityVerbose) {
tty->print_cr("In create_os_thread, Thread " INTPTR_FORMAT ", LWP is " INTPTR_FORMAT "\n",
osthread->thread_id(), osthread->lwp_id() );
osthread->thread_id(), osthread->lwp_id());
}
// Initial thread state is INITIALIZED, not SUSPENDED
@ -974,9 +974,9 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) {
return false;
}
if ( ThreadPriorityVerbose ) {
if (ThreadPriorityVerbose) {
char *thrtyp;
switch ( thr_type ) {
switch (thr_type) {
case vm_thread:
thrtyp = (char *)"vm";
break;
@ -1207,11 +1207,11 @@ void _handle_uncaught_cxx_exception() {
// First crack at OS-specific initialization, from inside the new thread.
void os::initialize_thread(Thread* thr) {
int r = thr_main() ;
guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
int r = thr_main();
guarantee(r == 0 || r == 1, "CR6501650 or CR6493689");
if (r) {
JavaThread* jt = (JavaThread *)thr;
assert(jt != NULL,"Sanity check");
assert(jt != NULL, "Sanity check");
size_t stack_size;
address base = jt->stack_base();
if (Arguments::created_by_java_launcher()) {
@ -1322,7 +1322,7 @@ int os::allocate_thread_local_storage() {
// JavaThread in Java code, and have stubs simply
// treat %g2 as a caller-save register, preserving it in a %lN.
thread_key_t tk;
if (thr_keycreate( &tk, NULL ) )
if (thr_keycreate( &tk, NULL))
fatal(err_msg("os::allocate_thread_local_storage: thr_keycreate failed "
"(%s)", strerror(errno)));
return int(tk);
@ -1347,7 +1347,7 @@ void os::thread_local_storage_at_put(int index, void* value) {
"(%s)", strerror(errno)));
}
} else {
ThreadLocalStorage::set_thread_in_slot ((Thread *) value) ;
ThreadLocalStorage::set_thread_in_slot((Thread *) value);
}
}
@ -1579,7 +1579,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
if (pelements == NULL) {
return false;
}
for (int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
// really shouldn't be NULL but what the heck, check can't hurt
if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
continue; // skip the empty path values
@ -1591,7 +1591,7 @@ bool os::dll_build_name(char* buffer, size_t buflen,
}
}
// release the storage
for (int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
}
@ -1795,7 +1795,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
bool failed_to_read_elf_head=
(sizeof(elf_head)!=
(::read(file_descriptor, &elf_head,sizeof(elf_head)))) ;
(::read(file_descriptor, &elf_head,sizeof(elf_head))));
::close(file_descriptor);
if (failed_to_read_elf_head) {
@ -1851,7 +1851,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
arch_t lib_arch={elf_head.e_machine,0,elf_head.e_ident[EI_CLASS], elf_head.e_ident[EI_DATA], NULL};
int running_arch_index=-1;
for (unsigned int i=0 ; i < ARRAY_SIZE(arch_array) ; i++ ) {
for (unsigned int i=0; i < ARRAY_SIZE(arch_array); i++) {
if (running_arch_code == arch_array[i].code) {
running_arch_index = i;
}
@ -1880,7 +1880,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
}
if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) {
if ( lib_arch.name!=NULL ) {
if (lib_arch.name!=NULL) {
::snprintf(diag_msg_buf, diag_msg_max_length-1,
" (Possible cause: can't load %s-bit .so on a %s-bit platform)",
lib_arch.name, arch_array[running_arch_index].name);
@ -1969,7 +1969,7 @@ static bool check_addr0(outputStream* st) {
int fd = ::open("/proc/self/map",O_RDONLY);
if (fd >= 0) {
prmap_t p;
while(::read(fd, &p, sizeof(p)) > 0) {
while (::read(fd, &p, sizeof(p)) > 0) {
if (p.pr_vaddr == 0x0) {
st->print("Warning: Address: 0x%x, Size: %dK, ",p.pr_vaddr, p.pr_size/1024, p.pr_mapname);
st->print("Mapped file: %s, ", p.pr_mapname[0] == '\0' ? "None" : p.pr_mapname);
@ -2079,7 +2079,7 @@ static void print_signal_handler(outputStream* st, int sig,
address rh = VMError::get_resetted_sighandler(sig);
// May be, handler was resetted by VMError?
if(rh != NULL) {
if (rh != NULL) {
handler = rh;
sa.sa_flags = VMError::get_resetted_sigflags(sig);
}
@ -2088,11 +2088,11 @@ static void print_signal_handler(outputStream* st, int sig,
os::Posix::print_sa_flags(st, sa.sa_flags);
// Check: is it our handler?
if(handler == CAST_FROM_FN_PTR(address, signalHandler) ||
if (handler == CAST_FROM_FN_PTR(address, signalHandler) ||
handler == CAST_FROM_FN_PTR(address, sigINTRHandler)) {
// It is our signal handler
// check for flags
if(sa.sa_flags != os::Solaris::get_our_sigflags(sig)) {
if (sa.sa_flags != os::Solaris::get_our_sigflags(sig)) {
st->print(
", flags was changed from " PTR32_FORMAT ", consider using jsig library",
os::Solaris::get_our_sigflags(sig));
@ -2403,7 +2403,7 @@ static int check_pending_signals(bool wait_for_signal) {
do {
thread->set_suspend_equivalent();
// cleared by handle_special_suspend_equivalent_condition() or java_suspend_self()
while((ret = ::sema_wait(&sig_sem)) == EINTR)
while ((ret = ::sema_wait(&sig_sem)) == EINTR)
;
assert(ret == 0, "sema_wait() failed");
@ -2635,7 +2635,7 @@ size_t os::numa_get_leaf_groups(int *ids, size_t size) {
}
if (!r) {
// That's a leaf node.
assert (bottom <= cur, "Sanity check");
assert(bottom <= cur, "Sanity check");
// Check if the node has memory
if (Solaris::lgrp_resources(Solaris::lgrp_cookie(), ids[cur],
NULL, 0, LGRP_RSRC_MEM) > 0) {
@ -3051,7 +3051,7 @@ bool os::Solaris::mpss_sanity_check(bool warn, size_t* page_size) {
const size_t size_limit =
FLAG_IS_DEFAULT(LargePageSizeInBytes) ? 4 * M : LargePageSizeInBytes;
int beg;
for (beg = 0; beg < n && _page_sizes[beg] > size_limit; ++beg) /* empty */ ;
for (beg = 0; beg < n && _page_sizes[beg] > size_limit; ++beg) /* empty */;
const int end = MIN2((int)usable_count, n) - 1;
for (int cur = 0; cur < end; ++cur, ++beg) {
_page_sizes[cur] = _page_sizes[beg];
@ -3264,7 +3264,7 @@ static int java_MaxPriority_to_os_priority = 0; // Saved mapping
//
// Return errno or 0 if OK.
//
static int lwp_priocntl_init () {
static int lwp_priocntl_init() {
int rslt;
pcinfo_t ClassInfo;
pcparms_t ParmInfo;
@ -3274,7 +3274,7 @@ static int lwp_priocntl_init () {
// If ThreadPriorityPolicy is 1, switch tables
if (ThreadPriorityPolicy == 1) {
for (i = 0 ; i < CriticalPriority+1; i++)
for (i = 0; i < CriticalPriority+1; i++)
os::java_to_os_priority[i] = prio_policy1[i];
}
if (UseCriticalJavaThreadPriority) {
@ -3373,12 +3373,12 @@ static int lwp_priocntl_init () {
} else {
// No clue - punt
if (ThreadPriorityVerbose)
tty->print_cr ("Unknown scheduling class: %s ... \n", ClassInfo.pc_clname);
tty->print_cr("Unknown scheduling class: %s ... \n", ClassInfo.pc_clname);
return EINVAL; // no clue, punt
}
if (ThreadPriorityVerbose) {
tty->print_cr ("Thread priority Range: [%d..%d]\n", myMin, myMax);
tty->print_cr("Thread priority Range: [%d..%d]\n", myMin, myMax);
}
priocntl_enable = true; // Enable changing priorities
@ -3424,7 +3424,7 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid,
// TODO: elide set-to-same-value
// If something went wrong on init, don't change priorities.
if ( !priocntl_enable ) {
if (!priocntl_enable) {
if (ThreadPriorityVerbose)
tty->print_cr("Trying to set priority but init failed, ignoring");
return EINVAL;
@ -3432,9 +3432,9 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid,
// If lwp hasn't started yet, just return
// the _start routine will call us again.
if ( lwpid <= 0 ) {
if (lwpid <= 0) {
if (ThreadPriorityVerbose) {
tty->print_cr ("deferring the set_lwp_class_and_priority of thread "
tty->print_cr("deferring the set_lwp_class_and_priority of thread "
INTPTR_FORMAT " to %d, lwpid not set",
ThreadID, newPrio);
}
@ -3653,7 +3653,7 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) {
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
int p;
if ( !UseThreadPriorities ) {
if (!UseThreadPriorities) {
*priority_ptr = NormalPriority;
return OS_OK;
}
@ -4099,7 +4099,7 @@ void os::Solaris::set_signal_handler(int sig, bool set_installed, bool oktochain
void os::run_periodic_checks() {
// A big source of grief is hijacking virt. addr 0x0 on Solaris,
// thereby preventing a NULL checks.
if(!check_addr0_done) check_addr0_done = check_addr0(tty);
if (!check_addr0_done) check_addr0_done = check_addr0(tty);
if (check_signals == false) return;
@ -4148,10 +4148,10 @@ void os::Solaris::check_signal_handler(int sig) {
address thisHandler = (act.sa_flags & SA_SIGINFO)
? CAST_FROM_FN_PTR(address, act.sa_sigaction)
: CAST_FROM_FN_PTR(address, act.sa_handler) ;
: CAST_FROM_FN_PTR(address, act.sa_handler);
switch(sig) {
switch (sig) {
case SIGSEGV:
case SIGBUS:
case SIGFPE:
@ -4332,7 +4332,7 @@ os::Solaris::meminfo_func_t os::Solaris::_meminfo = 0;
static address resolve_symbol_lazy(const char* name) {
address addr = (address) dlsym(RTLD_DEFAULT, name);
if(addr == NULL) {
if (addr == NULL) {
// RTLD_DEFAULT was not defined on some early versions of 2.5.1
addr = (address) dlsym(RTLD_NEXT, name);
}
@ -4341,7 +4341,7 @@ static address resolve_symbol_lazy(const char* name) {
static address resolve_symbol(const char* name) {
address addr = resolve_symbol_lazy(name);
if(addr == NULL) {
if (addr == NULL) {
fatal(dlerror());
}
return addr;
@ -4353,7 +4353,7 @@ void os::Solaris::libthread_init() {
lwp_priocntl_init();
// RTLD_DEFAULT was not defined on some early versions of 5.5.1
if(func == NULL) {
if (func == NULL) {
func = (address) dlsym(RTLD_NEXT, "_thr_suspend_allmutators");
// Guarantee that this VM is running on an new enough OS (5.6 or
// later) that it will have a new enough libthread.so.
@ -4384,7 +4384,7 @@ int_fnP_cond_tP os::Solaris::_cond_destroy;
int os::Solaris::_cond_scope = USYNC_THREAD;
void os::Solaris::synchronization_init() {
if(UseLWPSynchronization) {
if (UseLWPSynchronization) {
os::Solaris::set_mutex_lock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("_lwp_mutex_lock")));
os::Solaris::set_mutex_trylock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("_lwp_mutex_trylock")));
os::Solaris::set_mutex_unlock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("_lwp_mutex_unlock")));
@ -4404,7 +4404,7 @@ void os::Solaris::synchronization_init() {
os::Solaris::set_mutex_scope(USYNC_THREAD);
os::Solaris::set_cond_scope(USYNC_THREAD);
if(UsePthreads) {
if (UsePthreads) {
os::Solaris::set_mutex_lock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("pthread_mutex_lock")));
os::Solaris::set_mutex_trylock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("pthread_mutex_trylock")));
os::Solaris::set_mutex_unlock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("pthread_mutex_unlock")));
@ -4576,17 +4576,17 @@ jint os::init_2(void) {
os::set_polling_page(polling_page);
#ifndef PRODUCT
if( Verbose && PrintMiscellaneous )
if (Verbose && PrintMiscellaneous)
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
#endif
if (!UseMembar) {
address mem_serialize_page = (address)Solaris::mmap_chunk( NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE );
guarantee( mem_serialize_page != NULL, "mmap Failed for memory serialize page");
os::set_memory_serialize_page( mem_serialize_page );
address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if(Verbose && PrintMiscellaneous)
if (Verbose && PrintMiscellaneous)
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
#endif
}
@ -4725,13 +4725,13 @@ void os::init_3(void) {
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
if( mprotect((char *)_polling_page, page_size, PROT_NONE) != 0 )
if (mprotect((char *)_polling_page, page_size, PROT_NONE) != 0)
fatal("Could not disable polling page");
};
// Mark the polling page as readable
void os::make_polling_page_readable(void) {
if( mprotect((char *)_polling_page, page_size, PROT_READ) != 0 )
if (mprotect((char *)_polling_page, page_size, PROT_READ) != 0)
fatal("Could not enable polling page");
};
@ -5221,7 +5221,7 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
getpid(),
thread->osthread()->lwp_id());
fd = ::open(proc_name, O_RDONLY);
if ( fd == -1 ) return -1;
if (fd == -1) return -1;
do {
count = ::pread(fd,
@ -5230,7 +5230,7 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
thr_time_off);
} while (count < 0 && errno == EINTR);
::close(fd);
if ( count < 0 ) return -1;
if (count < 0) return -1;
if (user_sys_cpu_time) {
// user + system CPU time
@ -5244,7 +5244,7 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
(jlong)prusage.pr_utime.tv_nsec;
}
return(lwp_time);
return (lwp_time);
}
void os::current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr) {
@ -5448,43 +5448,43 @@ static timestruc_t* compute_abstime(timestruc_t* abstime, jlong millis) {
int os::PlatformEvent::TryPark() {
for (;;) {
const int v = _Event ;
guarantee ((v == 0) || (v == 1), "invariant") ;
if (Atomic::cmpxchg (0, &_Event, v) == v) return v ;
const int v = _Event;
guarantee((v == 0) || (v == 1), "invariant");
if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
}
}
void os::PlatformEvent::park() { // AKA: down()
// Invariant: Only the thread associated with the Event/PlatformEvent
// may call park().
int v ;
int v;
for (;;) {
v = _Event ;
if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
v = _Event;
if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee (v >= 0, "invariant") ;
guarantee(v >= 0, "invariant");
if (v == 0) {
// Do this the hard way by blocking ...
// See http://monaco.sfbay/detail.jsf?cr=5094058.
// TODO-FIXME: for Solaris SPARC set fprs.FEF=0 prior to parking.
// Only for SPARC >= V8PlusA
#if defined(__sparc) && defined(COMPILER2)
if (ClearFPUAtPark) { _mark_fpu_nosave() ; }
if (ClearFPUAtPark) { _mark_fpu_nosave(); }
#endif
int status = os::Solaris::mutex_lock(_mutex);
assert_status(status == 0, status, "mutex_lock");
guarantee (_nParked == 0, "invariant") ;
++ _nParked ;
assert_status(status == 0, status, "mutex_lock");
guarantee(_nParked == 0, "invariant");
++_nParked;
while (_Event < 0) {
// for some reason, under 2.7 lwp_cond_wait() may return ETIME ...
// Treat this the same as if the wait was interrupted
// With usr/lib/lwp going to kernel, always handle ETIME
status = os::Solaris::cond_wait(_cond, _mutex);
if (status == ETIME) status = EINTR ;
if (status == ETIME) status = EINTR;
assert_status(status == 0 || status == EINTR, status, "cond_wait");
}
-- _nParked ;
_Event = 0 ;
--_nParked;
_Event = 0;
status = os::Solaris::mutex_unlock(_mutex);
assert_status(status == 0, status, "mutex_unlock");
// Paranoia to ensure our locked and lock-free paths interact
@ -5494,41 +5494,41 @@ void os::PlatformEvent::park() { // AKA: down()
}
int os::PlatformEvent::park(jlong millis) {
guarantee (_nParked == 0, "invariant") ;
int v ;
guarantee(_nParked == 0, "invariant");
int v;
for (;;) {
v = _Event ;
if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
v = _Event;
if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee (v >= 0, "invariant") ;
if (v != 0) return OS_OK ;
guarantee(v >= 0, "invariant");
if (v != 0) return OS_OK;
int ret = OS_TIMEOUT;
timestruc_t abst;
compute_abstime (&abst, millis);
compute_abstime(&abst, millis);
// See http://monaco.sfbay/detail.jsf?cr=5094058.
// For Solaris SPARC set fprs.FEF=0 prior to parking.
// Only for SPARC >= V8PlusA
#if defined(__sparc) && defined(COMPILER2)
if (ClearFPUAtPark) { _mark_fpu_nosave() ; }
if (ClearFPUAtPark) { _mark_fpu_nosave(); }
#endif
int status = os::Solaris::mutex_lock(_mutex);
assert_status(status == 0, status, "mutex_lock");
guarantee (_nParked == 0, "invariant") ;
++ _nParked ;
guarantee(_nParked == 0, "invariant");
++_nParked;
while (_Event < 0) {
int status = os::Solaris::cond_timedwait(_cond, _mutex, &abst);
assert_status(status == 0 || status == EINTR ||
status == ETIME || status == ETIMEDOUT,
status, "cond_timedwait");
if (!FilterSpuriousWakeups) break ; // previous semantics
if (status == ETIME || status == ETIMEDOUT) break ;
if (!FilterSpuriousWakeups) break; // previous semantics
if (status == ETIME || status == ETIMEDOUT) break;
// We consume and ignore EINTR and spurious wakeups.
}
-- _nParked ;
if (_Event >= 0) ret = OS_OK ;
_Event = 0 ;
--_nParked;
if (_Event >= 0) ret = OS_OK;
_Event = 0;
status = os::Solaris::mutex_unlock(_mutex);
assert_status(status == 0, status, "mutex_unlock");
// Paranoia to ensure our locked and lock-free paths interact
@ -5605,7 +5605,7 @@ void os::PlatformEvent::unpark() {
* years from "now".
*/
static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) {
assert (time > 0, "convertTime");
assert(time > 0, "convertTime");
struct timeval now;
int status = gettimeofday(&now, NULL);
@ -5664,7 +5664,7 @@ void Parker::park(bool isAbsolute, jlong time) {
// First, demultiplex/decode time arguments
timespec absTime;
if (time < 0 || (isAbsolute && time == 0) ) { // don't wait at all
if (time < 0 || (isAbsolute && time == 0)) { // don't wait at all
return;
}
if (time > 0) {
@ -5688,12 +5688,12 @@ void Parker::park(bool isAbsolute, jlong time) {
return;
}
int status ;
int status;
if (_counter > 0) { // no wait needed
_counter = 0;
status = os::Solaris::mutex_unlock(_mutex);
assert (status == 0, "invariant") ;
assert(status == 0, "invariant");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other and Java-level accesses.
OrderAccess::fence();
@ -5717,11 +5717,11 @@ void Parker::park(bool isAbsolute, jlong time) {
// TODO-FIXME: for Solaris SPARC set fprs.FEF=0 prior to parking.
// Only for SPARC >= V8PlusA
#if defined(__sparc) && defined(COMPILER2)
if (ClearFPUAtPark) { _mark_fpu_nosave() ; }
if (ClearFPUAtPark) { _mark_fpu_nosave(); }
#endif
if (time == 0) {
status = os::Solaris::cond_wait (_cond, _mutex) ;
status = os::Solaris::cond_wait(_cond, _mutex);
} else {
status = os::Solaris::cond_timedwait (_cond, _mutex, &absTime);
}
@ -5734,9 +5734,9 @@ void Parker::park(bool isAbsolute, jlong time) {
#ifdef ASSERT
thr_sigsetmask(SIG_SETMASK, &oldsigs, NULL);
#endif
_counter = 0 ;
_counter = 0;
status = os::Solaris::mutex_unlock(_mutex);
assert_status(status == 0, status, "mutex_unlock") ;
assert_status(status == 0, status, "mutex_unlock");
// Paranoia to ensure our locked and lock-free paths interact
// correctly with each other and Java-level accesses.
OrderAccess::fence();
@ -5748,17 +5748,17 @@ void Parker::park(bool isAbsolute, jlong time) {
}
void Parker::unpark() {
int s, status ;
status = os::Solaris::mutex_lock (_mutex) ;
assert (status == 0, "invariant") ;
int s, status;
status = os::Solaris::mutex_lock(_mutex);
assert(status == 0, "invariant");
s = _counter;
_counter = 1;
status = os::Solaris::mutex_unlock (_mutex) ;
assert (status == 0, "invariant") ;
status = os::Solaris::mutex_unlock(_mutex);
assert(status == 0, "invariant");
if (s < 1) {
status = os::Solaris::cond_signal (_cond) ;
assert (status == 0, "invariant") ;
status = os::Solaris::cond_signal(_cond);
assert(status == 0, "invariant");
}
}
@ -5925,14 +5925,14 @@ int os::timeout(int fd, long timeout) {
gettimeofday(&t, &aNull);
prevtime = ((julong)t.tv_sec * 1000) + t.tv_usec / 1000;
for(;;) {
for (;;) {
res = ::poll(&pfd, 1, timeout);
if(res == OS_ERR && errno == EINTR) {
if(timeout != -1) {
if (res == OS_ERR && errno == EINTR) {
if (timeout != -1) {
gettimeofday(&t, &aNull);
newtime = ((julong)t.tv_sec * 1000) + t.tv_usec /1000;
timeout -= newtime - prevtime;
if(timeout <= 0)
if (timeout <= 0)
return OS_OK;
prevtime = newtime;
}

View File

@ -125,11 +125,11 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
switch (reason) {
case DLL_PROCESS_ATTACH:
vm_lib_handle = hinst;
if(ForceTimeHighResolution)
if (ForceTimeHighResolution)
timeBeginPeriod(1L);
break;
case DLL_PROCESS_DETACH:
if(ForceTimeHighResolution)
if (ForceTimeHighResolution)
timeEndPeriod(1L);
// Workaround for issue when a custom launcher doesn't call
@ -318,7 +318,7 @@ extern "C" void breakpoint() {
*/
address os::get_caller_pc(int n) {
#ifdef _NMT_NOINLINE_
n ++;
n++;
#endif
address pc;
if (os::Kernel32Dll::RtlCaptureStackBackTrace(n + 1, 1, (PVOID*)&pc, NULL) == 1) {
@ -345,10 +345,10 @@ address os::current_stack_base() {
// Add up the sizes of all the regions with the same
// AllocationBase.
while( 1 )
while (1)
{
VirtualQuery(stack_bottom+stack_size, &minfo, sizeof(minfo));
if ( stack_bottom == (address)minfo.AllocationBase )
if (stack_bottom == (address)minfo.AllocationBase)
stack_size += minfo.RegionSize;
else
break;
@ -644,7 +644,7 @@ static jlong performance_frequency;
jlong as_long(LARGE_INTEGER x) {
jlong result = 0; // initialization to avoid warning
set_high(&result, x.HighPart);
set_low(&result, x.LowPart);
set_low(&result, x.LowPart);
return result;
}
@ -999,7 +999,7 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char*
#endif
cwd = get_current_directory(NULL, 0);
jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp",cwd, current_process_id());
jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp", cwd, current_process_id());
dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (dumpFile == INVALID_HANDLE_VALUE) {
@ -1217,7 +1217,7 @@ bool os::dll_build_name(char *buffer, size_t buflen,
if (pelements == NULL) {
return false;
}
for (int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
char* path = pelements[i];
// Really shouldn't be NULL, but check can't hurt
size_t plen = (path == NULL) ? 0 : strlen(path);
@ -1236,7 +1236,7 @@ bool os::dll_build_name(char *buffer, size_t buflen,
}
}
// release the storage
for (int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
}
@ -1271,12 +1271,12 @@ static bool _addr_in_ntdll( address addr )
MODULEINFO minfo;
hmod = GetModuleHandle("NTDLL.DLL");
if ( hmod == NULL ) return false;
if ( !os::PSApiDll::GetModuleInformation( GetCurrentProcess(), hmod,
if (hmod == NULL) return false;
if (!os::PSApiDll::GetModuleInformation( GetCurrentProcess(), hmod,
&minfo, sizeof(MODULEINFO)) )
return false;
if ( (addr >= minfo.lpBaseOfDll) &&
if ((addr >= minfo.lpBaseOfDll) &&
(addr < (address)((uintptr_t)minfo.lpBaseOfDll + (uintptr_t)minfo.SizeOfImage)))
return true;
else
@ -1304,11 +1304,11 @@ typedef int (*EnumModulesCallbackFunc)(int, char *, address, unsigned, void *);
// enumerate_modules for Windows NT, using PSAPI
static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void * param)
{
HANDLE hProcess ;
HANDLE hProcess;
# define MAX_NUM_MODULES 128
HMODULE modules[MAX_NUM_MODULES];
static char filename[ MAX_PATH ];
static char filename[MAX_PATH];
int result = 0;
if (!os::PSApiDll::PSApiAvailable()) {
@ -1316,13 +1316,13 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void
}
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
FALSE, pid ) ;
FALSE, pid);
if (hProcess == NULL) return 0;
DWORD size_needed;
if (!os::PSApiDll::EnumProcessModules(hProcess, modules,
sizeof(modules), &size_needed)) {
CloseHandle( hProcess );
CloseHandle(hProcess);
return 0;
}
@ -1331,7 +1331,7 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void
for (int i = 0; i < MIN2(num_modules, MAX_NUM_MODULES); i++) {
// Get Full pathname:
if(!os::PSApiDll::GetModuleFileNameEx(hProcess, modules[i],
if (!os::PSApiDll::GetModuleFileNameEx(hProcess, modules[i],
filename, sizeof(filename))) {
filename[0] = '\0';
}
@ -1349,7 +1349,7 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void
if (result) break;
}
CloseHandle( hProcess ) ;
CloseHandle(hProcess);
return result;
}
@ -1357,8 +1357,8 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void
// enumerate_modules for Windows 95/98/ME, using TOOLHELP
static int _enumerate_modules_windows( int pid, EnumModulesCallbackFunc func, void *param)
{
HANDLE hSnapShot ;
static MODULEENTRY32 modentry ;
HANDLE hSnapShot;
static MODULEENTRY32 modentry;
int result = 0;
if (!os::Kernel32Dll::HelpToolsAvailable()) {
@ -1366,22 +1366,22 @@ static int _enumerate_modules_windows( int pid, EnumModulesCallbackFunc func, vo
}
// Get a handle to a Toolhelp snapshot of the system
hSnapShot = os::Kernel32Dll::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid ) ;
if( hSnapShot == INVALID_HANDLE_VALUE ) {
return FALSE ;
hSnapShot = os::Kernel32Dll::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
if (hSnapShot == INVALID_HANDLE_VALUE) {
return FALSE;
}
// iterate through all modules
modentry.dwSize = sizeof(MODULEENTRY32) ;
modentry.dwSize = sizeof(MODULEENTRY32);
bool not_done = os::Kernel32Dll::Module32First( hSnapShot, &modentry ) != 0;
while( not_done ) {
while (not_done) {
// invoke the callback
result=func(pid, modentry.szExePath, (address)modentry.modBaseAddr,
modentry.modBaseSize, param);
if (result) break;
modentry.dwSize = sizeof(MODULEENTRY32) ;
modentry.dwSize = sizeof(MODULEENTRY32);
not_done = os::Kernel32Dll::Module32Next( hSnapShot, &modentry ) != 0;
}
@ -1941,7 +1941,7 @@ void os::signal_raise(int signal_number) {
// that raises SIGTERM for the latter cases.
//
static BOOL WINAPI consoleHandler(DWORD event) {
switch(event) {
switch (event) {
case CTRL_C_EVENT:
if (is_error_reported()) {
// Ctrl-C is pressed during error reporting, likely because the error
@ -1965,7 +1965,7 @@ static BOOL WINAPI consoleHandler(DWORD event) {
HANDLE handle = GetProcessWindowStation();
if (handle != NULL &&
GetUserObjectInformation(handle, UOI_FLAGS, &flags,
sizeof( USEROBJECTFLAGS), NULL)) {
sizeof(USEROBJECTFLAGS), NULL)) {
// If it is a non-interactive session, let next handler to deal
// with it.
if ((flags.dwFlags & WSF_VISIBLE) == 0) {
@ -1991,7 +1991,7 @@ static BOOL WINAPI consoleHandler(DWORD event) {
// Return maximum OS signal used + 1 for internal use only
// Used as exit signal for signal_thread
int os::sigexitnum_pd(){
int os::sigexitnum_pd() {
return NSIG;
}
@ -2422,11 +2422,11 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
// process of write protecting the memory serialization page.
// It write enables the page immediately after protecting it
// so just return.
if ( exception_code == EXCEPTION_ACCESS_VIOLATION ) {
if (exception_code == EXCEPTION_ACCESS_VIOLATION) {
JavaThread* thread = (JavaThread*) t;
PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
address addr = (address) exceptionRecord->ExceptionInformation[1];
if ( os::is_memory_serialize_page(thread, addr) ) {
if (os::is_memory_serialize_page(thread, addr)) {
// Block current thread until the memory serialize page permission restored.
os::block_on_serialize_page_trap();
return EXCEPTION_CONTINUE_EXECUTION;
@ -2543,7 +2543,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
//
PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord;
address addr = (address) exceptionRecord->ExceptionInformation[1];
if (addr > thread->stack_yellow_zone_base() && addr < thread->stack_base() ) {
if (addr > thread->stack_yellow_zone_base() && addr < thread->stack_base()) {
addr = (address)((uintptr_t)addr &
(~((uintptr_t)os::vm_page_size() - (uintptr_t)1)));
os::commit_memory((char *)addr, thread->stack_base() - addr,
@ -2623,7 +2623,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
// Compiled method patched to be non entrant? Following conditions must apply:
// 1. must be first instruction in bundle
// 2. must be a break instruction with appropriate code
if((((uint64_t) pc & 0x0F) == 0) &&
if ((((uint64_t) pc & 0x0F) == 0) &&
(((IPF_Bundle*) pc)->get_slot0() == handle_wrong_method_break.bits())) {
return Handle_Exception(exceptionInfo,
(address)SharedRuntime::get_handle_wrong_method_stub());
@ -2794,7 +2794,7 @@ public:
return (_numa_used_node_count > 1);
}
int get_count() {return _numa_used_node_count;}
int get_count() { return _numa_used_node_count; }
int get_node_list_entry(int n) {
// for indexes out of range, returns -1
return (n < _numa_used_node_count ? _numa_used_node_list[n] : -1);
@ -3112,14 +3112,14 @@ char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
res = (char*)VirtualAlloc(addr, bytes, MEM_RESERVE, PAGE_READWRITE);
} else {
elapsedTimer reserveTimer;
if( Verbose && PrintMiscellaneous ) reserveTimer.start();
if (Verbose && PrintMiscellaneous) reserveTimer.start();
// in numa interleaving, we have to allocate pages individually
// (well really chunks of NUMAInterleaveGranularity size)
res = allocate_pages_individually(bytes, addr, MEM_RESERVE, PAGE_READWRITE);
if (res == NULL) {
warning("NUMA page allocation failed");
}
if( Verbose && PrintMiscellaneous ) {
if (Verbose && PrintMiscellaneous) {
reserveTimer.stop();
tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes,
reserveTimer.milliseconds(), reserveTimer.ticks());
@ -3450,14 +3450,14 @@ public:
int os::sleep(Thread* thread, jlong ms, bool interruptable) {
jlong limit = (jlong) MAXDWORD;
while(ms > limit) {
while (ms > limit) {
int res;
if ((res = sleep(thread, limit, interruptable)) != OS_TIMEOUT)
return res;
ms -= limit;
}
assert(thread == Thread::current(), "thread consistency check");
assert(thread == Thread::current(), "thread consistency check");
OSThread* osthread = thread->osthread();
OSThreadWaitState osts(osthread, false /* not Object.wait() */);
int result;
@ -3473,8 +3473,8 @@ int os::sleep(Thread* thread, jlong ms, bool interruptable) {
HANDLE events[1];
events[0] = osthread->interrupt_event();
HighResolutionInterval *phri=NULL;
if(!ForceTimeHighResolution)
phri = new HighResolutionInterval( ms );
if (!ForceTimeHighResolution)
phri = new HighResolutionInterval(ms);
if (WaitForMultipleObjects(1, events, FALSE, (DWORD)ms) == WAIT_TIMEOUT) {
result = OS_TIMEOUT;
} else {
@ -3511,17 +3511,17 @@ void os::infinite_sleep() {
}
}
typedef BOOL (WINAPI * STTSignature)(void) ;
typedef BOOL (WINAPI * STTSignature)(void);
os::YieldResult os::NakedYield() {
// Use either SwitchToThread() or Sleep(0)
// Consider passing back the return value from SwitchToThread().
if (os::Kernel32Dll::SwitchToThreadAvailable()) {
return SwitchToThread() ? os::YIELD_SWITCHED : os::YIELD_NONEREADY ;
return SwitchToThread() ? os::YIELD_SWITCHED : os::YIELD_NONEREADY;
} else {
Sleep(0);
}
return os::YIELD_UNKNOWN ;
return os::YIELD_UNKNOWN;
}
void os::yield() { os::NakedYield(); }
@ -3574,7 +3574,7 @@ static int prio_init() {
}
}
if (UseCriticalJavaThreadPriority) {
os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority] ;
os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority];
}
return 0;
}
@ -3586,7 +3586,7 @@ OSReturn os::set_native_priority(Thread* thread, int priority) {
}
OSReturn os::get_native_priority(const Thread* const thread, int* priority_ptr) {
if ( !UseThreadPriorities ) {
if (!UseThreadPriorities) {
*priority_ptr = java_to_os_priority[NormPriority];
return OS_OK;
}
@ -3620,8 +3620,8 @@ void os::interrupt(Thread* thread) {
if (thread->is_Java_thread())
((JavaThread*)thread)->parker()->unpark();
ParkEvent * ev = thread->_ParkEvent ;
if (ev != NULL) ev->unpark() ;
ParkEvent * ev = thread->_ParkEvent;
if (ev != NULL) ev->unpark();
}
@ -3715,7 +3715,7 @@ void os::win32::initialize_system_info() {
OSVERSIONINFOEX oi;
oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((OSVERSIONINFO*)&oi);
switch(oi.dwPlatformId) {
switch (oi.dwPlatformId) {
case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break;
case VER_PLATFORM_WIN32_NT:
_is_nt = true;
@ -3898,29 +3898,29 @@ static jint initSock();
jint os::init_2(void) {
// Allocate a single page and mark it as readable for safepoint polling
address polling_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READONLY);
guarantee( polling_page != NULL, "Reserve Failed for polling page");
guarantee(polling_page != NULL, "Reserve Failed for polling page");
address return_page = (address)VirtualAlloc(polling_page, os::vm_page_size(), MEM_COMMIT, PAGE_READONLY);
guarantee( return_page != NULL, "Commit Failed for polling page");
guarantee(return_page != NULL, "Commit Failed for polling page");
os::set_polling_page( polling_page );
os::set_polling_page(polling_page);
#ifndef PRODUCT
if( Verbose && PrintMiscellaneous )
if (Verbose && PrintMiscellaneous)
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page);
#endif
if (!UseMembar) {
address mem_serialize_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READWRITE);
guarantee( mem_serialize_page != NULL, "Reserve Failed for memory serialize page");
guarantee(mem_serialize_page != NULL, "Reserve Failed for memory serialize page");
return_page = (address)VirtualAlloc(mem_serialize_page, os::vm_page_size(), MEM_COMMIT, PAGE_READWRITE);
guarantee( return_page != NULL, "Commit Failed for memory serialize page");
guarantee(return_page != NULL, "Commit Failed for memory serialize page");
os::set_memory_serialize_page( mem_serialize_page );
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if(Verbose && PrintMiscellaneous)
if (Verbose && PrintMiscellaneous)
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page);
#endif
}
@ -4036,14 +4036,14 @@ void os::init_3(void) {
// Mark the polling page as unreadable
void os::make_polling_page_unreadable(void) {
DWORD old_status;
if( !VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_NOACCESS, &old_status) )
if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_NOACCESS, &old_status))
fatal("Could not disable polling page");
};
// Mark the polling page as readable
void os::make_polling_page_readable(void) {
DWORD old_status;
if( !VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_READONLY, &old_status) )
if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_READONLY, &old_status))
fatal("Could not enable polling page");
};
@ -4121,7 +4121,7 @@ jlong os::thread_cpu_time(Thread* thread, bool user_sys_cpu_time) {
FILETIME KernelTime;
FILETIME UserTime;
if ( GetThreadTimes(thread->osthread()->thread_handle(),
if (GetThreadTimes(thread->osthread()->thread_handle(),
&CreationTime, &ExitTime, &KernelTime, &UserTime) == 0)
return -1;
else
@ -4157,7 +4157,7 @@ bool os::is_thread_cpu_time_supported() {
FILETIME KernelTime;
FILETIME UserTime;
if ( GetThreadTimes(GetCurrentThread(),
if (GetThreadTimes(GetCurrentThread(),
&CreationTime, &ExitTime, &KernelTime, &UserTime) == 0)
return false;
else
@ -4391,7 +4391,7 @@ int os::ftruncate(int fd, jlong length) {
int os::fsync(int fd) {
HANDLE handle = (HANDLE)::_get_osfhandle(fd);
if ( (!::FlushFileBuffers(handle)) &&
if ((!::FlushFileBuffers(handle)) &&
(GetLastError() != ERROR_ACCESS_DENIED) ) {
/* from winerror.h */
return -1;
@ -4512,7 +4512,7 @@ static int stdinAvailable(int fd, long *pbytes) {
}
/* Examine input records for the number of bytes available */
for(i=0; i<numEvents; i++) {
for (i=0; i<numEvents; i++) {
if (lpBuffer[i].EventType == KEY_EVENT) {
KEY_EVENT_RECORD *keyRecord = (KEY_EVENT_RECORD *)
@ -4527,7 +4527,7 @@ static int stdinAvailable(int fd, long *pbytes) {
}
}
if(lpBuffer != NULL) {
if (lpBuffer != NULL) {
os::free(lpBuffer, mtInternal);
}
@ -4790,19 +4790,19 @@ bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) {
// with explicit "PARKED" and "SIGNALED" bits.
int os::PlatformEvent::park (jlong Millis) {
guarantee (_ParkHandle != NULL , "Invariant") ;
guarantee (Millis > 0 , "Invariant") ;
int v ;
guarantee(_ParkHandle != NULL , "Invariant");
guarantee(Millis > 0 , "Invariant");
int v;
// CONSIDER: defer assigning a CreateEvent() handle to the Event until
// the initial park() operation.
for (;;) {
v = _Event ;
if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
v = _Event;
if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee ((v == 0) || (v == 1), "invariant") ;
if (v != 0) return OS_OK ;
guarantee((v == 0) || (v == 1), "invariant");
if (v != 0) return OS_OK;
// Do this the hard way by blocking ...
// TODO: consider a brief spin here, gated on the success of recent
@ -4820,59 +4820,59 @@ int os::PlatformEvent::park (jlong Millis) {
// In the future, however, we might want to track the accumulated wait time and
// adjust Millis accordingly if we encounter a spurious wakeup.
const int MAXTIMEOUT = 0x10000000 ;
DWORD rv = WAIT_TIMEOUT ;
const int MAXTIMEOUT = 0x10000000;
DWORD rv = WAIT_TIMEOUT;
while (_Event < 0 && Millis > 0) {
DWORD prd = Millis ; // set prd = MAX (Millis, MAXTIMEOUT)
DWORD prd = Millis; // set prd = MAX (Millis, MAXTIMEOUT)
if (Millis > MAXTIMEOUT) {
prd = MAXTIMEOUT ;
prd = MAXTIMEOUT;
}
rv = ::WaitForSingleObject (_ParkHandle, prd) ;
assert (rv == WAIT_OBJECT_0 || rv == WAIT_TIMEOUT, "WaitForSingleObject failed") ;
rv = ::WaitForSingleObject(_ParkHandle, prd);
assert(rv == WAIT_OBJECT_0 || rv == WAIT_TIMEOUT, "WaitForSingleObject failed");
if (rv == WAIT_TIMEOUT) {
Millis -= prd ;
Millis -= prd;
}
}
v = _Event ;
_Event = 0 ;
v = _Event;
_Event = 0;
// see comment at end of os::PlatformEvent::park() below:
OrderAccess::fence() ;
OrderAccess::fence();
// If we encounter a nearly simultanous timeout expiry and unpark()
// we return OS_OK indicating we awoke via unpark().
// Implementor's license -- returning OS_TIMEOUT would be equally valid, however.
return (v >= 0) ? OS_OK : OS_TIMEOUT ;
return (v >= 0) ? OS_OK : OS_TIMEOUT;
}
void os::PlatformEvent::park () {
guarantee (_ParkHandle != NULL, "Invariant") ;
void os::PlatformEvent::park() {
guarantee(_ParkHandle != NULL, "Invariant");
// Invariant: Only the thread associated with the Event/PlatformEvent
// may call park().
int v ;
int v;
for (;;) {
v = _Event ;
if (Atomic::cmpxchg (v-1, &_Event, v) == v) break ;
v = _Event;
if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee ((v == 0) || (v == 1), "invariant") ;
if (v != 0) return ;
guarantee((v == 0) || (v == 1), "invariant");
if (v != 0) return;
// Do this the hard way by blocking ...
// TODO: consider a brief spin here, gated on the success of recent
// spin attempts by this thread.
while (_Event < 0) {
DWORD rv = ::WaitForSingleObject (_ParkHandle, INFINITE) ;
assert (rv == WAIT_OBJECT_0, "WaitForSingleObject failed") ;
DWORD rv = ::WaitForSingleObject(_ParkHandle, INFINITE);
assert(rv == WAIT_OBJECT_0, "WaitForSingleObject failed");
}
// Usually we'll find _Event == 0 at this point, but as
// an optional optimization we clear it, just in case can
// multiple unpark() operations drove _Event up to 1.
_Event = 0 ;
OrderAccess::fence() ;
guarantee (_Event >= 0, "invariant") ;
_Event = 0;
OrderAccess::fence();
guarantee(_Event >= 0, "invariant");
}
void os::PlatformEvent::unpark() {
guarantee (_ParkHandle != NULL, "Invariant") ;
guarantee(_ParkHandle != NULL, "Invariant");
// Transitions for _Event:
// 0 :=> 1
@ -4907,7 +4907,7 @@ void os::PlatformEvent::unpark() {
void Parker::park(bool isAbsolute, jlong time) {
guarantee (_ParkEvent != NULL, "invariant") ;
guarantee(_ParkEvent != NULL, "invariant");
// First, demultiplex/decode time arguments
if (time < 0) { // don't wait
return;
@ -4941,7 +4941,7 @@ void Parker::park(bool isAbsolute, jlong time) {
OSThreadWaitState osts(thread->osthread(), false /* not Object.wait() */);
jt->set_suspend_equivalent();
WaitForSingleObject(_ParkEvent, time);
WaitForSingleObject(_ParkEvent, time);
ResetEvent(_ParkEvent);
// If externally suspended while waiting, re-suspend
@ -4952,7 +4952,7 @@ void Parker::park(bool isAbsolute, jlong time) {
}
void Parker::unpark() {
guarantee (_ParkEvent != NULL, "invariant") ;
guarantee(_ParkEvent != NULL, "invariant");
SetEvent(_ParkEvent);
}
@ -5040,7 +5040,7 @@ bool os::find(address addr, outputStream* st) {
LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) {
DWORD exception_code = e->ExceptionRecord->ExceptionCode;
if ( exception_code == EXCEPTION_ACCESS_VIOLATION ) {
if (exception_code == EXCEPTION_ACCESS_VIOLATION) {
JavaThread* thread = (JavaThread*)ThreadLocalStorage::get_thread_slow();
PEXCEPTION_RECORD exceptionRecord = e->ExceptionRecord;
address addr = (address) exceptionRecord->ExceptionInformation[1];

File diff suppressed because it is too large Load Diff

View File

@ -37,17 +37,17 @@
class ObjectWaiter : public StackObj {
public:
enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ } ;
enum Sorted { PREPEND, APPEND, SORTED } ;
enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ };
enum Sorted { PREPEND, APPEND, SORTED };
ObjectWaiter * volatile _next;
ObjectWaiter * volatile _prev;
Thread* _thread;
jlong _notifier_tid;
ParkEvent * _event;
volatile int _notified ;
volatile TStates TState ;
Sorted _Sorted ; // List placement disposition
bool _active ; // Contention monitoring is enabled
volatile int _notified;
volatile TStates TState;
Sorted _Sorted; // List placement disposition
bool _active; // Contention monitoring is enabled
public:
ObjectWaiter(Thread* thread);
@ -92,19 +92,19 @@ class ObjectMonitor {
static int owner_offset_in_bytes() { return offset_of(ObjectMonitor, _owner); }
static int count_offset_in_bytes() { return offset_of(ObjectMonitor, _count); }
static int recursions_offset_in_bytes() { return offset_of(ObjectMonitor, _recursions); }
static int cxq_offset_in_bytes() { return offset_of(ObjectMonitor, _cxq) ; }
static int succ_offset_in_bytes() { return offset_of(ObjectMonitor, _succ) ; }
static int cxq_offset_in_bytes() { return offset_of(ObjectMonitor, _cxq); }
static int succ_offset_in_bytes() { return offset_of(ObjectMonitor, _succ); }
static int EntryList_offset_in_bytes() { return offset_of(ObjectMonitor, _EntryList); }
static int FreeNext_offset_in_bytes() { return offset_of(ObjectMonitor, FreeNext); }
static int WaitSet_offset_in_bytes() { return offset_of(ObjectMonitor, _WaitSet) ; }
static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible);}
static int WaitSet_offset_in_bytes() { return offset_of(ObjectMonitor, _WaitSet); }
static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible); }
static int Spinner_offset_in_bytes() { return offset_of(ObjectMonitor, _Spinner); }
public:
// Eventually we'll make provisions for multiple callbacks, but
// now one will suffice.
static int (*SpinCallbackFunction)(intptr_t, int) ;
static intptr_t SpinCallbackArgument ;
static int (*SpinCallbackFunction)(intptr_t, int);
static intptr_t SpinCallbackArgument;
public:
@ -115,7 +115,7 @@ class ObjectMonitor {
// TODO-FIXME: merge _count and _waiters.
// TODO-FIXME: assert _owner == null implies _recursions = 0
// TODO-FIXME: assert _WaitSet != null implies _count > 0
return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList ) ;
return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList);
}
intptr_t is_entered(Thread* current) const;
@ -127,7 +127,7 @@ class ObjectMonitor {
intptr_t count() const;
void set_count(intptr_t count);
intptr_t contentions() const ;
intptr_t contentions() const;
intptr_t recursions() const { return _recursions; }
// JVM/DI GetMonitorInfo() needs this
@ -145,15 +145,15 @@ class ObjectMonitor {
_object = NULL;
_owner = NULL;
_WaitSet = NULL;
_WaitSetLock = 0 ;
_Responsible = NULL ;
_succ = NULL ;
_cxq = NULL ;
FreeNext = NULL ;
_EntryList = NULL ;
_SpinFreq = 0 ;
_SpinClock = 0 ;
OwnerIsThread = 0 ;
_WaitSetLock = 0;
_Responsible = NULL;
_succ = NULL;
_cxq = NULL;
FreeNext = NULL;
_EntryList = NULL;
_SpinFreq = 0;
_SpinClock = 0;
OwnerIsThread = 0;
_previous_owner_tid = 0;
}
@ -164,20 +164,20 @@ class ObjectMonitor {
}
private:
void Recycle () {
void Recycle() {
// TODO: add stronger asserts ...
// _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
// _count == 0 EntryList == NULL
// _recursions == 0 _WaitSet == NULL
// TODO: assert (is_busy()|_recursions) == 0
_succ = NULL ;
_EntryList = NULL ;
_cxq = NULL ;
_WaitSet = NULL ;
_recursions = 0 ;
_SpinFreq = 0 ;
_SpinClock = 0 ;
OwnerIsThread = 0 ;
_succ = NULL;
_EntryList = NULL;
_cxq = NULL;
_WaitSet = NULL;
_recursions = 0;
_SpinFreq = 0;
_SpinClock = 0;
OwnerIsThread = 0;
}
public:
@ -194,7 +194,7 @@ public:
void print();
#endif
bool try_enter (TRAPS) ;
bool try_enter(TRAPS);
void enter(TRAPS);
void exit(bool not_suspended, TRAPS);
void wait(jlong millis, bool interruptable, TRAPS);
@ -206,22 +206,22 @@ public:
void reenter(intptr_t recursions, TRAPS);
private:
void AddWaiter (ObjectWaiter * waiter) ;
void AddWaiter(ObjectWaiter * waiter);
static void DeferredInitialize();
ObjectWaiter * DequeueWaiter () ;
void DequeueSpecificWaiter (ObjectWaiter * waiter) ;
void EnterI (TRAPS) ;
void ReenterI (Thread * Self, ObjectWaiter * SelfNode) ;
void UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode) ;
int TryLock (Thread * Self) ;
int NotRunnable (Thread * Self, Thread * Owner) ;
int TrySpin_Fixed (Thread * Self) ;
int TrySpin_VaryFrequency (Thread * Self) ;
int TrySpin_VaryDuration (Thread * Self) ;
void ctAsserts () ;
void ExitEpilog (Thread * Self, ObjectWaiter * Wakee) ;
bool ExitSuspendEquivalent (JavaThread * Self) ;
ObjectWaiter * DequeueWaiter();
void DequeueSpecificWaiter(ObjectWaiter * waiter);
void EnterI(TRAPS);
void ReenterI(Thread * Self, ObjectWaiter * SelfNode);
void UnlinkAfterAcquire(Thread * Self, ObjectWaiter * SelfNode);
int TryLock(Thread * Self);
int NotRunnable(Thread * Self, Thread * Owner);
int TrySpin_Fixed(Thread * Self);
int TrySpin_VaryFrequency(Thread * Self);
int TrySpin_VaryDuration(Thread * Self);
void ctAsserts();
void ExitEpilog(Thread * Self, ObjectWaiter * Wakee);
bool ExitSuspendEquivalent(JavaThread * Self);
void post_monitor_wait_event(EventJavaMonitorWait * event,
jlong notifier_tid,
jlong timeout,
@ -240,7 +240,7 @@ public:
volatile markOop _header; // displaced object header word - mark
void* volatile _object; // backward object pointer - strong root
double SharingPad [1] ; // temp to reduce false sharing
double SharingPad[1]; // temp to reduce false sharing
// All the following fields must be machine word aligned
// The VM assumes write ordering wrt these fields, which can be
@ -251,22 +251,22 @@ public:
volatile jlong _previous_owner_tid; // thread id of the previous owner of the monitor
volatile intptr_t _recursions; // recursion count, 0 for first entry
private:
int OwnerIsThread ; // _owner is (Thread *) vs SP/BasicLock
ObjectWaiter * volatile _cxq ; // LL of recently-arrived threads blocked on entry.
int OwnerIsThread; // _owner is (Thread *) vs SP/BasicLock
ObjectWaiter * volatile _cxq; // LL of recently-arrived threads blocked on entry.
// The list is actually composed of WaitNodes, acting
// as proxies for Threads.
protected:
ObjectWaiter * volatile _EntryList ; // Threads blocked on entry or reentry.
ObjectWaiter * volatile _EntryList; // Threads blocked on entry or reentry.
private:
Thread * volatile _succ ; // Heir presumptive thread - used for futile wakeup throttling
Thread * volatile _Responsible ;
int _PromptDrain ; // rqst to drain cxq into EntryList ASAP
Thread * volatile _succ; // Heir presumptive thread - used for futile wakeup throttling
Thread * volatile _Responsible;
int _PromptDrain; // rqst to drain cxq into EntryList ASAP
volatile int _Spinner ; // for exit->spinner handoff optimization
volatile int _SpinFreq ; // Spin 1-out-of-N attempts: success rate
volatile int _SpinClock ;
volatile int _SpinDuration ;
volatile intptr_t _SpinState ; // MCS/CLH list of spinners
volatile int _Spinner; // for exit->spinner handoff optimization
volatile int _SpinFreq; // Spin 1-out-of-N attempts: success rate
volatile int _SpinClock;
volatile int _SpinDuration;
volatile intptr_t _SpinState; // MCS/CLH list of spinners
// TODO-FIXME: _count, _waiters and _recursions should be of
// type int, or int32_t but not intptr_t. There's no reason
@ -284,30 +284,30 @@ public:
volatile int _WaitSetLock; // protects Wait Queue - simple spinlock
public:
int _QMix ; // Mixed prepend queue discipline
ObjectMonitor * FreeNext ; // Free list linkage
intptr_t StatA, StatsB ;
int _QMix; // Mixed prepend queue discipline
ObjectMonitor * FreeNext; // Free list linkage
intptr_t StatA, StatsB;
public:
static void Initialize () ;
static PerfCounter * _sync_ContendedLockAttempts ;
static PerfCounter * _sync_FutileWakeups ;
static PerfCounter * _sync_Parks ;
static PerfCounter * _sync_EmptyNotifications ;
static PerfCounter * _sync_Notifications ;
static PerfCounter * _sync_SlowEnter ;
static PerfCounter * _sync_SlowExit ;
static PerfCounter * _sync_SlowNotify ;
static PerfCounter * _sync_SlowNotifyAll ;
static PerfCounter * _sync_FailedSpins ;
static PerfCounter * _sync_SuccessfulSpins ;
static PerfCounter * _sync_PrivateA ;
static PerfCounter * _sync_PrivateB ;
static PerfCounter * _sync_MonInCirculation ;
static PerfCounter * _sync_MonScavenged ;
static PerfCounter * _sync_Inflations ;
static PerfCounter * _sync_Deflations ;
static PerfLongVariable * _sync_MonExtant ;
static void Initialize();
static PerfCounter * _sync_ContendedLockAttempts;
static PerfCounter * _sync_FutileWakeups;
static PerfCounter * _sync_Parks;
static PerfCounter * _sync_EmptyNotifications;
static PerfCounter * _sync_Notifications;
static PerfCounter * _sync_SlowEnter;
static PerfCounter * _sync_SlowExit;
static PerfCounter * _sync_SlowNotify;
static PerfCounter * _sync_SlowNotifyAll;
static PerfCounter * _sync_FailedSpins;
static PerfCounter * _sync_SuccessfulSpins;
static PerfCounter * _sync_PrivateA;
static PerfCounter * _sync_PrivateB;
static PerfCounter * _sync_MonInCirculation;
static PerfCounter * _sync_MonScavenged;
static PerfCounter * _sync_Inflations;
static PerfCounter * _sync_Deflations;
static PerfLongVariable * _sync_MonExtant;
public:
static int Knob_Verbose;
@ -329,7 +329,7 @@ public:
#undef TEVENT
#define TEVENT(nom) {if (SyncVerbose) FEVENT(nom); }
#define FEVENT(nom) { static volatile int ctr = 0 ; int v = ++ctr ; if ((v & (v-1)) == 0) { ::printf (#nom " : %d \n", v); ::fflush(stdout); }}
#define FEVENT(nom) { static volatile int ctr = 0; int v = ++ctr; if ((v & (v-1)) == 0) { ::printf (#nom " : %d \n", v); ::fflush(stdout); }}
#undef TEVENT
#define TEVENT(nom) {;}

View File

@ -198,13 +198,13 @@ void SharedRuntime::trace_ic_miss(address at) {
void SharedRuntime::print_ic_miss_histogram() {
if (ICMissHistogram) {
tty->print_cr ("IC Miss Histogram:");
tty->print_cr("IC Miss Histogram:");
int tot_misses = 0;
for (int i = 0; i < _ICmiss_index; i++) {
tty->print_cr(" at: " INTPTR_FORMAT " nof: %d", _ICmiss_at[i], _ICmiss_count[i]);
tot_misses += _ICmiss_count[i];
}
tty->print_cr ("Total IC misses: %7d", tot_misses);
tty->print_cr("Total IC misses: %7d", tot_misses);
}
}
#endif // PRODUCT
@ -266,7 +266,7 @@ JRT_LEAF(jfloat, SharedRuntime::frem(jfloat x, jfloat y))
xbits.f = x;
ybits.f = y;
// x Mod Infinity == x unless x is infinity
if ( ((xbits.i & float_sign_mask) != float_infinity) &&
if (((xbits.i & float_sign_mask) != float_infinity) &&
((ybits.i & float_sign_mask) == float_infinity) ) {
return x;
}
@ -281,7 +281,7 @@ JRT_LEAF(jdouble, SharedRuntime::drem(jdouble x, jdouble y))
xbits.d = x;
ybits.d = y;
// x Mod Infinity == x unless x is infinity
if ( ((xbits.l & double_sign_mask) != double_infinity) &&
if (((xbits.l & double_sign_mask) != double_infinity) &&
((ybits.l & double_sign_mask) == double_infinity) ) {
return x;
}
@ -537,13 +537,13 @@ address SharedRuntime::get_poll_stub(address pc) {
CodeBlob *cb = CodeCache::find_blob(pc);
// Should be an nmethod
assert( cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod" );
assert(cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod");
// Look up the relocation information
assert( ((nmethod*)cb)->is_at_poll_or_poll_return(pc),
"safepoint polling: type must be poll" );
assert(((nmethod*)cb)->is_at_poll_or_poll_return(pc),
"safepoint polling: type must be poll");
assert( ((NativeInstruction*)pc)->is_safepoint_poll(),
assert(((NativeInstruction*)pc)->is_safepoint_poll(),
"Only polling locations are used for safepoint");
bool at_poll_return = ((nmethod*)cb)->is_at_poll_return(pc);
@ -562,7 +562,7 @@ address SharedRuntime::get_poll_stub(address pc) {
stub = SharedRuntime::polling_page_safepoint_handler_blob()->entry_point();
}
#ifndef PRODUCT
if( TraceSafepoint ) {
if (TraceSafepoint) {
char buf[256];
jio_snprintf(buf, sizeof(buf),
"... found polling page %s exception at pc = "
@ -1474,7 +1474,7 @@ methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) {
should_be_mono = true;
} else if (inline_cache->is_icholder_call()) {
CompiledICHolder* ic_oop = inline_cache->cached_icholder();
if ( ic_oop != NULL) {
if (ic_oop != NULL) {
if (receiver()->klass() == ic_oop->holder_klass()) {
// This isn't a real miss. We must have seen that compiled code
@ -1728,7 +1728,7 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal
iter.next();
assert(iter.has_current(), "must have a reloc at java call site");
relocInfo::relocType typ = iter.reloc()->type();
if ( typ != relocInfo::static_call_type &&
if (typ != relocInfo::static_call_type &&
typ != relocInfo::opt_virtual_call_type &&
typ != relocInfo::static_stub_type) {
return;
@ -1784,7 +1784,7 @@ JRT_ENTRY(void, SharedRuntime::slow_arraycopy_C(oopDesc* src, jint src_pos,
// The copy_array mechanism is awkward and could be removed, but
// the compilers don't call this function except as a last resort,
// so it probably doesn't matter.
src->klass()->copy_array((arrayOopDesc*)src, src_pos,
src->klass()->copy_array((arrayOopDesc*)src, src_pos,
(arrayOopDesc*)dest, dest_pos,
length, thread);
}
@ -1891,8 +1891,8 @@ void SharedRuntime::print_statistics() {
ttyLocker ttyl;
if (xtty != NULL) xtty->head("statistics type='SharedRuntime'");
if (_monitor_enter_ctr ) tty->print_cr("%5d monitor enter slow", _monitor_enter_ctr);
if (_monitor_exit_ctr ) tty->print_cr("%5d monitor exit slow", _monitor_exit_ctr);
if (_monitor_enter_ctr) tty->print_cr("%5d monitor enter slow", _monitor_enter_ctr);
if (_monitor_exit_ctr) tty->print_cr("%5d monitor exit slow", _monitor_exit_ctr);
if (_throw_null_ctr) tty->print_cr("%5d implicit null throw", _throw_null_ctr);
SharedRuntime::print_ic_miss_histogram();
@ -1905,36 +1905,36 @@ void SharedRuntime::print_statistics() {
}
// Dump the JRT_ENTRY counters
if( _new_instance_ctr ) tty->print_cr("%5d new instance requires GC", _new_instance_ctr);
if( _new_array_ctr ) tty->print_cr("%5d new array requires GC", _new_array_ctr);
if( _multi1_ctr ) tty->print_cr("%5d multianewarray 1 dim", _multi1_ctr);
if( _multi2_ctr ) tty->print_cr("%5d multianewarray 2 dim", _multi2_ctr);
if( _multi3_ctr ) tty->print_cr("%5d multianewarray 3 dim", _multi3_ctr);
if( _multi4_ctr ) tty->print_cr("%5d multianewarray 4 dim", _multi4_ctr);
if( _multi5_ctr ) tty->print_cr("%5d multianewarray 5 dim", _multi5_ctr);
if (_new_instance_ctr) tty->print_cr("%5d new instance requires GC", _new_instance_ctr);
if (_new_array_ctr) tty->print_cr("%5d new array requires GC", _new_array_ctr);
if (_multi1_ctr) tty->print_cr("%5d multianewarray 1 dim", _multi1_ctr);
if (_multi2_ctr) tty->print_cr("%5d multianewarray 2 dim", _multi2_ctr);
if (_multi3_ctr) tty->print_cr("%5d multianewarray 3 dim", _multi3_ctr);
if (_multi4_ctr) tty->print_cr("%5d multianewarray 4 dim", _multi4_ctr);
if (_multi5_ctr) tty->print_cr("%5d multianewarray 5 dim", _multi5_ctr);
tty->print_cr("%5d inline cache miss in compiled", _ic_miss_ctr );
tty->print_cr("%5d wrong method", _wrong_method_ctr );
tty->print_cr("%5d unresolved static call site", _resolve_static_ctr );
tty->print_cr("%5d unresolved virtual call site", _resolve_virtual_ctr );
tty->print_cr("%5d unresolved opt virtual call site", _resolve_opt_virtual_ctr );
tty->print_cr("%5d inline cache miss in compiled", _ic_miss_ctr);
tty->print_cr("%5d wrong method", _wrong_method_ctr);
tty->print_cr("%5d unresolved static call site", _resolve_static_ctr);
tty->print_cr("%5d unresolved virtual call site", _resolve_virtual_ctr);
tty->print_cr("%5d unresolved opt virtual call site", _resolve_opt_virtual_ctr);
if( _mon_enter_stub_ctr ) tty->print_cr("%5d monitor enter stub", _mon_enter_stub_ctr );
if( _mon_exit_stub_ctr ) tty->print_cr("%5d monitor exit stub", _mon_exit_stub_ctr );
if( _mon_enter_ctr ) tty->print_cr("%5d monitor enter slow", _mon_enter_ctr );
if( _mon_exit_ctr ) tty->print_cr("%5d monitor exit slow", _mon_exit_ctr );
if( _partial_subtype_ctr) tty->print_cr("%5d slow partial subtype", _partial_subtype_ctr );
if( _jbyte_array_copy_ctr ) tty->print_cr("%5d byte array copies", _jbyte_array_copy_ctr );
if( _jshort_array_copy_ctr ) tty->print_cr("%5d short array copies", _jshort_array_copy_ctr );
if( _jint_array_copy_ctr ) tty->print_cr("%5d int array copies", _jint_array_copy_ctr );
if( _jlong_array_copy_ctr ) tty->print_cr("%5d long array copies", _jlong_array_copy_ctr );
if( _oop_array_copy_ctr ) tty->print_cr("%5d oop array copies", _oop_array_copy_ctr );
if( _checkcast_array_copy_ctr ) tty->print_cr("%5d checkcast array copies", _checkcast_array_copy_ctr );
if( _unsafe_array_copy_ctr ) tty->print_cr("%5d unsafe array copies", _unsafe_array_copy_ctr );
if( _generic_array_copy_ctr ) tty->print_cr("%5d generic array copies", _generic_array_copy_ctr );
if( _slow_array_copy_ctr ) tty->print_cr("%5d slow array copies", _slow_array_copy_ctr );
if( _find_handler_ctr ) tty->print_cr("%5d find exception handler", _find_handler_ctr );
if( _rethrow_ctr ) tty->print_cr("%5d rethrow handler", _rethrow_ctr );
if (_mon_enter_stub_ctr) tty->print_cr("%5d monitor enter stub", _mon_enter_stub_ctr);
if (_mon_exit_stub_ctr) tty->print_cr("%5d monitor exit stub", _mon_exit_stub_ctr);
if (_mon_enter_ctr) tty->print_cr("%5d monitor enter slow", _mon_enter_ctr);
if (_mon_exit_ctr) tty->print_cr("%5d monitor exit slow", _mon_exit_ctr);
if (_partial_subtype_ctr) tty->print_cr("%5d slow partial subtype", _partial_subtype_ctr);
if (_jbyte_array_copy_ctr) tty->print_cr("%5d byte array copies", _jbyte_array_copy_ctr);
if (_jshort_array_copy_ctr) tty->print_cr("%5d short array copies", _jshort_array_copy_ctr);
if (_jint_array_copy_ctr) tty->print_cr("%5d int array copies", _jint_array_copy_ctr);
if (_jlong_array_copy_ctr) tty->print_cr("%5d long array copies", _jlong_array_copy_ctr);
if (_oop_array_copy_ctr) tty->print_cr("%5d oop array copies", _oop_array_copy_ctr);
if (_checkcast_array_copy_ctr) tty->print_cr("%5d checkcast array copies", _checkcast_array_copy_ctr);
if (_unsafe_array_copy_ctr) tty->print_cr("%5d unsafe array copies", _unsafe_array_copy_ctr);
if (_generic_array_copy_ctr) tty->print_cr("%5d generic array copies", _generic_array_copy_ctr);
if (_slow_array_copy_ctr) tty->print_cr("%5d slow array copies", _slow_array_copy_ctr);
if (_find_handler_ctr) tty->print_cr("%5d find exception handler", _find_handler_ctr);
if (_rethrow_ctr) tty->print_cr("%5d rethrow handler", _rethrow_ctr);
AdapterHandlerLibrary::print_statistics();
@ -1997,7 +1997,7 @@ class MethodArityHistogram {
MethodArityHistogram() {
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
_max_arity = _max_size = 0;
for (int i = 0; i < MAX_ARITY; i++) _arity_histogram[i] = _size_histogram [i] = 0;
for (int i = 0; i < MAX_ARITY; i++) _arity_histogram[i] = _size_histogram[i] = 0;
CodeCache::nmethods_do(add_method_to_histogram);
print_histogram();
}
@ -2062,7 +2062,7 @@ class AdapterFingerPrint : public CHeapObj<mtCode> {
// These are correct for the current system but someday it might be
// necessary to make this mapping platform dependent.
static int adapter_encoding(BasicType in) {
switch(in) {
switch (in) {
case T_BOOLEAN:
case T_BYTE:
case T_SHORT:
@ -2479,7 +2479,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
tty->print_cr("i2c argument handler #%d for: %s %s (%d bytes generated)",
_adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
method->signature()->as_C_string(), insts_size);
tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry());
tty->print_cr("c2i argument handler starts at %p", entry->get_c2i_entry());
if (Verbose || PrintStubCode) {
address first_pc = entry->base_address();
if (first_pc != NULL) {
@ -2504,7 +2504,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
new_adapter->name(),
fingerprint->as_string(),
new_adapter->content_begin());
Forte::register_stub(blob_id, new_adapter->content_begin(),new_adapter->content_end());
Forte::register_stub(blob_id, new_adapter->content_begin(), new_adapter->content_end());
if (JvmtiExport::should_post_dynamic_code_generated()) {
JvmtiExport::post_dynamic_code_generated(blob_id, new_adapter->content_begin(), new_adapter->content_end());
@ -2605,12 +2605,12 @@ void AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
int i=0;
if( !method->is_static() ) // Pass in receiver first
if (!method->is_static()) // Pass in receiver first
sig_bt[i++] = T_OBJECT;
SignatureStream ss(method->signature());
for( ; !ss.at_return_type(); ss.next()) {
for (; !ss.at_return_type(); ss.next()) {
sig_bt[i++] = ss.type(); // Collect remaining bits of signature
if( ss.type() == T_LONG || ss.type() == T_DOUBLE )
if (ss.type() == T_LONG || ss.type() == T_DOUBLE)
sig_bt[i++] = T_VOID; // Longs & doubles take 2 Java slots
}
assert(i == total_args_passed, "");
@ -2762,10 +2762,10 @@ void SharedRuntime::convert_ints_to_longints(int i2l_argcnt, int& in_args_count,
case T_SHORT:
case T_INT:
// Convert (bt) to (T_LONG,bt).
new_in_sig_bt[argcnt ] = T_LONG;
new_in_sig_bt[argcnt] = T_LONG;
new_in_sig_bt[argcnt+1] = bt;
assert(reg.first()->is_valid() && !reg.second()->is_valid(), "");
new_in_regs[argcnt ].set2(reg.first());
new_in_regs[argcnt].set2(reg.first());
new_in_regs[argcnt+1].set_bad();
argcnt++;
break;
@ -2808,17 +2808,17 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
int len = (int)strlen(s);
s++; len--; // Skip opening paren
char *t = s+len;
while( *(--t) != ')' ) ; // Find close paren
while (*(--t) != ')'); // Find close paren
BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, 256 );
VMRegPair *regs = NEW_RESOURCE_ARRAY( VMRegPair, 256 );
BasicType *sig_bt = NEW_RESOURCE_ARRAY(BasicType, 256);
VMRegPair *regs = NEW_RESOURCE_ARRAY(VMRegPair, 256);
int cnt = 0;
if (has_receiver) {
sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
}
while( s < t ) {
switch( *s++ ) { // Switch on signature character
while (s < t) {
switch (*s++) { // Switch on signature character
case 'B': sig_bt[cnt++] = T_BYTE; break;
case 'C': sig_bt[cnt++] = T_CHAR; break;
case 'D': sig_bt[cnt++] = T_DOUBLE; sig_bt[cnt++] = T_VOID; break;
@ -2829,16 +2829,16 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
case 'Z': sig_bt[cnt++] = T_BOOLEAN; break;
case 'V': sig_bt[cnt++] = T_VOID; break;
case 'L': // Oop
while( *s++ != ';' ) ; // Skip signature
while (*s++ != ';'); // Skip signature
sig_bt[cnt++] = T_OBJECT;
break;
case '[': { // Array
do { // Skip optional size
while( *s >= '0' && *s <= '9' ) s++;
} while( *s++ == '[' ); // Nested arrays?
while (*s >= '0' && *s <= '9') s++;
} while (*s++ == '['); // Nested arrays?
// Skip element type
if( s[-1] == 'L' )
while( *s++ != ';' ) ; // Skip signature
if (s[-1] == 'L')
while (*s++ != ';'); // Skip signature
sig_bt[cnt++] = T_ARRAY;
break;
}
@ -2850,7 +2850,7 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
sig_bt[cnt++] = T_OBJECT;
}
assert( cnt < 256, "grow table size" );
assert(cnt < 256, "grow table size");
int comp_args_on_stack;
comp_args_on_stack = java_calling_convention(sig_bt, regs, cnt, true);
@ -2861,12 +2861,12 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
if (comp_args_on_stack) {
for (int i = 0; i < cnt; i++) {
VMReg reg1 = regs[i].first();
if( reg1->is_stack()) {
if (reg1->is_stack()) {
// Yuck
reg1 = reg1->bias(out_preserve_stack_slots());
}
VMReg reg2 = regs[i].second();
if( reg2->is_stack()) {
if (reg2->is_stack()) {
// Yuck
reg2 = reg2->bias(out_preserve_stack_slots());
}
@ -2904,15 +2904,15 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
// frame accessor methods and be platform independent.
frame fr = thread->last_frame();
assert( fr.is_interpreted_frame(), "" );
assert( fr.interpreter_frame_expression_stack_size()==0, "only handle empty stacks" );
assert(fr.is_interpreted_frame(), "");
assert(fr.interpreter_frame_expression_stack_size()==0, "only handle empty stacks");
// Figure out how many monitors are active.
int active_monitor_count = 0;
for( BasicObjectLock *kptr = fr.interpreter_frame_monitor_end();
for (BasicObjectLock *kptr = fr.interpreter_frame_monitor_end();
kptr < fr.interpreter_frame_monitor_begin();
kptr = fr.next_monitor_in_interpreter_frame(kptr) ) {
if( kptr->obj() != NULL ) active_monitor_count++;
if (kptr->obj() != NULL) active_monitor_count++;
}
// QQQ we could place number of active monitors in the array so that compiled code
@ -2926,17 +2926,17 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
// Copy the locals. Order is preserved so that loading of longs works.
// Since there's no GC I can copy the oops blindly.
assert( sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
assert(sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1),
(HeapWord*)&buf[0],
max_locals);
// Inflate locks. Copy the displaced headers. Be careful, there can be holes.
int i = max_locals;
for( BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
kptr2 < fr.interpreter_frame_monitor_begin();
kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
if( kptr2->obj() != NULL) { // Avoid 'holes' in the monitor array
if (kptr2->obj() != NULL) { // Avoid 'holes' in the monitor array
BasicLock *lock = kptr2->lock();
// Inflate so the displaced header becomes position-independent
if (lock->displaced_header()->is_unlocked())
@ -2946,20 +2946,20 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
}
}
assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" );
assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
return buf;
JRT_END
JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
FREE_C_HEAP_ARRAY(intptr_t,buf, mtCode);
FREE_C_HEAP_ARRAY(intptr_t, buf, mtCode);
JRT_END
bool AdapterHandlerLibrary::contains(CodeBlob* b) {
AdapterHandlerTableIterator iter(_adapters);
while (iter.has_next()) {
AdapterHandlerEntry* a = iter.next();
if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) return true;
if (b == CodeCache::find_blob(a->get_i2c_entry())) return true;
}
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -225,11 +225,11 @@ Thread::Thread() {
_current_pending_monitor_is_from_java = true;
_current_waiting_monitor = NULL;
_num_nested_signal = 0;
omFreeList = NULL ;
omFreeCount = 0 ;
omFreeProvision = 32 ;
omInUseList = NULL ;
omInUseCount = 0 ;
omFreeList = NULL;
omFreeCount = 0;
omFreeProvision = 32;
omInUseList = NULL;
omInUseCount = 0;
#ifdef ASSERT
_visited_for_critical_count = false;
@ -239,15 +239,15 @@ Thread::Thread() {
_suspend_flags = 0;
// thread-specific hashCode stream generator state - Marsaglia shift-xor form
_hashStateX = os::random() ;
_hashStateY = 842502087 ;
_hashStateZ = 0x8767 ; // (int)(3579807591LL & 0xffff) ;
_hashStateW = 273326509 ;
_hashStateX = os::random();
_hashStateY = 842502087;
_hashStateZ = 0x8767; // (int)(3579807591LL & 0xffff) ;
_hashStateW = 273326509;
_OnTrap = 0 ;
_schedctl = NULL ;
_Stalled = 0 ;
_TypeTag = 0x2BAD ;
_OnTrap = 0;
_schedctl = NULL;
_Stalled = 0;
_TypeTag = 0x2BAD;
// Many of the following fields are effectively final - immutable
// Note that nascent threads can't use the Native Monitor-Mutex
@ -256,10 +256,10 @@ Thread::Thread() {
// we might instead use a stack of ParkEvents that we could provision on-demand.
// The stack would act as a cache to avoid calls to ParkEvent::Allocate()
// and ::Release()
_ParkEvent = ParkEvent::Allocate (this) ;
_SleepEvent = ParkEvent::Allocate (this) ;
_MutexEvent = ParkEvent::Allocate (this) ;
_MuxEvent = ParkEvent::Allocate (this) ;
_ParkEvent = ParkEvent::Allocate(this);
_SleepEvent = ParkEvent::Allocate(this);
_MutexEvent = ParkEvent::Allocate(this);
_MuxEvent = ParkEvent::Allocate(this);
#ifdef CHECK_UNHANDLED_OOPS
if (CheckUnhandledOops) {
@ -314,7 +314,7 @@ void Thread::record_stack_base_and_size() {
Thread::~Thread() {
// Reclaim the objectmonitors from the omFreeList of the moribund thread.
ObjectSynchronizer::omFlush (this) ;
ObjectSynchronizer::omFlush(this);
EVENT_THREAD_DESTRUCT(this);
@ -342,10 +342,10 @@ Thread::~Thread() {
// It's possible we can encounter a null _ParkEvent, etc., in stillborn threads.
// We NULL out the fields for good hygiene.
ParkEvent::Release (_ParkEvent) ; _ParkEvent = NULL ;
ParkEvent::Release (_SleepEvent) ; _SleepEvent = NULL ;
ParkEvent::Release (_MutexEvent) ; _MutexEvent = NULL ;
ParkEvent::Release (_MuxEvent) ; _MuxEvent = NULL ;
ParkEvent::Release(_ParkEvent); _ParkEvent = NULL;
ParkEvent::Release(_SleepEvent); _SleepEvent = NULL;
ParkEvent::Release(_MutexEvent); _MutexEvent = NULL;
ParkEvent::Release(_MuxEvent); _MuxEvent = NULL;
delete handle_area();
delete metadata_handles();
@ -844,7 +844,7 @@ void Thread::print_on(outputStream* st) const {
// Thread::print_on_error() is called by fatal error handler. Don't use
// any lock or allocate memory.
void Thread::print_on_error(outputStream* st, char* buf, int buflen) const {
if (is_VM_thread()) st->print("VMThread");
if (is_VM_thread()) st->print("VMThread");
else if (is_Compiler_thread()) st->print("CompilerThread");
else if (is_Java_thread()) st->print("JavaThread");
else if (is_GC_task_thread()) st->print("GCTaskThread");
@ -867,7 +867,7 @@ void Thread::print_owned_locks_on(outputStream* st) const {
st->print(" (no locks) ");
} else {
st->print_cr(" Locks owned:");
while(cur) {
while (cur) {
cur->print_on(st);
cur = cur->next();
}
@ -877,7 +877,7 @@ void Thread::print_owned_locks_on(outputStream* st) const {
static int ref_use_count = 0;
bool Thread::owns_locks_but_compiled_lock() const {
for(Monitor *cur = _owned_locks; cur; cur = cur->next()) {
for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
if (cur != Compile_lock) return true;
}
return false;
@ -904,12 +904,12 @@ void Thread::check_for_valid_safepoint_state(bool potential_vm_operation) {
&& !Universe::is_bootstrapping()) {
// Make sure we do not hold any locks that the VM thread also uses.
// This could potentially lead to deadlocks
for(Monitor *cur = _owned_locks; cur; cur = cur->next()) {
for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
// Threads_lock is special, since the safepoint synchronization will not start before this is
// acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock,
// since it is used to transfer control between JavaThreads and the VMThread
// Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first!
if ( (cur->allow_vm_block() &&
if ((cur->allow_vm_block() &&
cur != Threads_lock &&
cur != Compile_lock && // Temporary: should not be necessary when we get separate compilation
cur != VMOperationRequest_lock &&
@ -1291,9 +1291,9 @@ void WatcherThread::run() {
this->record_stack_base_and_size();
this->initialize_thread_local_storage();
this->set_active_handles(JNIHandleBlock::allocate_block());
while(!_should_terminate) {
assert(watcher_thread() == Thread::current(), "thread consistency check");
assert(watcher_thread() == this, "thread consistency check");
while (!_should_terminate) {
assert(watcher_thread() == Thread::current(), "thread consistency check");
assert(watcher_thread() == this, "thread consistency check");
// Calculate how long it'll be until the next PeriodicTask work
// should be done, and sleep that amount of time.
@ -1370,7 +1370,7 @@ void WatcherThread::stop() {
// it is ok to take late safepoints here, if needed
MutexLocker mu(Terminator_lock);
while(watcher_thread() != NULL) {
while (watcher_thread() != NULL) {
// This wait should make safepoint checks, wait without a timeout,
// and wait as a suspend-equivalent condition.
//
@ -1451,11 +1451,11 @@ void JavaThread::initialize() {
_pending_jni_exception_check_fn = NULL;
_do_not_unlock_if_synchronized = false;
_cached_monitor_info = NULL;
_parker = Parker::Allocate(this) ;
_parker = Parker::Allocate(this);
#ifndef PRODUCT
_jmp_ring_index = 0;
for (int ji = 0 ; ji < jump_ring_buffer_size ; ji++ ) {
for (int ji = 0; ji < jump_ring_buffer_size; ji++) {
record_jump(NULL, NULL, NULL, 0);
}
#endif /* PRODUCT */
@ -1592,7 +1592,7 @@ JavaThread::~JavaThread() {
// JSR166 -- return the parker to the free list
Parker::Release(_parker);
_parker = NULL ;
_parker = NULL;
// Free any remaining previous UnrollBlock
vframeArray* old_array = vframe_array_last();
@ -1718,7 +1718,7 @@ static void ensure_join(JavaThread* thread) {
// For any new cleanup additions, please check to see if they need to be applied to
// cleanup_failed_attach_current_thread as well.
void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
assert(this == JavaThread::current(), "thread consistency check");
assert(this == JavaThread::current(), "thread consistency check");
HandleMark hm(this);
Handle uncaught_exception(this, this->pending_exception());
@ -2058,7 +2058,7 @@ void JavaThread::check_and_handle_async_exceptions(bool check_unsafe_error) {
if (TraceExceptions) {
ResourceMark rm;
tty->print("Async. exception installed at runtime exit (" INTPTR_FORMAT ")", this);
if (has_last_Java_frame() ) {
if (has_last_Java_frame()) {
frame f = last_frame();
tty->print(" (pc: " INTPTR_FORMAT " sp: " INTPTR_FORMAT " )", f.pc(), f.sp());
}
@ -2302,11 +2302,11 @@ int JavaThread::java_suspend_self() {
void JavaThread::verify_not_published() {
if (!Threads_lock->owned_by_self()) {
MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
assert( !Threads::includes(this),
assert(!Threads::includes(this),
"java thread shouldn't have been published yet!");
}
else {
assert( !Threads::includes(this),
assert(!Threads::includes(this),
"java thread shouldn't have been published yet!");
}
}
@ -2375,7 +2375,7 @@ void JavaThread::check_safepoint_and_suspend_for_native_trans(JavaThread *thread
thread->clear_deopt_suspend();
RegisterMap map(thread, false);
frame f = thread->last_frame();
while ( f.id() != thread->must_deopt_id() && ! f.is_first_frame()) {
while (f.id() != thread->must_deopt_id() && ! f.is_first_frame()) {
f = f.sender(&map);
}
if (f.id() == thread->must_deopt_id()) {
@ -2499,8 +2499,8 @@ void JavaThread::enable_stack_yellow_zone() {
// We need to adjust it to work correctly with guard_memory()
address base = stack_yellow_zone_base() - stack_yellow_zone_size();
guarantee(base < stack_base(),"Error calculating stack yellow zone");
guarantee(base < os::current_stack_pointer(),"Error calculating stack yellow zone");
guarantee(base < stack_base(), "Error calculating stack yellow zone");
guarantee(base < os::current_stack_pointer(), "Error calculating stack yellow zone");
if (os::guard_memory((char *) base, stack_yellow_zone_size())) {
_stack_guard_state = stack_guard_enabled;
@ -2535,10 +2535,10 @@ void JavaThread::enable_stack_red_zone() {
assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
address base = stack_red_zone_base() - stack_red_zone_size();
guarantee(base < stack_base(),"Error calculating stack red zone");
guarantee(base < os::current_stack_pointer(),"Error calculating stack red zone");
guarantee(base < stack_base(), "Error calculating stack red zone");
guarantee(base < os::current_stack_pointer(), "Error calculating stack red zone");
if(!os::guard_memory((char *) base, stack_red_zone_size())) {
if (!os::guard_memory((char *) base, stack_red_zone_size())) {
warning("Attempt to guard stack red zone failed.");
}
}
@ -2557,7 +2557,7 @@ void JavaThread::frames_do(void f(frame*, const RegisterMap* map)) {
// ignore is there is no stack
if (!has_last_Java_frame()) return;
// traverse the stack frames. Starts from top frame.
for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
frame* fr = fst.current();
f(fr, fst.register_map());
}
@ -2573,8 +2573,8 @@ void JavaThread::deoptimize() {
bool deopt = false; // Dump stack only if a deopt actually happens.
bool only_at = strlen(DeoptimizeOnlyAt) > 0;
// Iterate over all frames in the thread and deoptimize
for(; !fst.is_done(); fst.next()) {
if(fst.current()->can_be_deoptimized()) {
for (; !fst.is_done(); fst.next()) {
if (fst.current()->can_be_deoptimized()) {
if (only_at) {
// Deoptimize only at particular bcis. DeoptimizeOnlyAt
@ -2619,7 +2619,7 @@ void JavaThread::deoptimize() {
// Make zombies
void JavaThread::make_zombies() {
for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
if (fst.current()->can_be_deoptimized()) {
// it is a Java nmethod
nmethod* nm = CodeCache::find_nmethod(fst.current()->pc());
@ -2634,7 +2634,7 @@ void JavaThread::deoptimized_wrt_marked_nmethods() {
if (!has_last_Java_frame()) return;
// BiasedLocking needs an updated RegisterMap for the revoke monitors pass
StackFrameStream fst(this, UseBiasedLocking);
for(; !fst.is_done(); fst.next()) {
for (; !fst.is_done(); fst.next()) {
if (fst.current()->should_be_deoptimized()) {
if (LogCompilation && xtty != NULL) {
nmethod* nm = fst.current()->cb()->as_nmethod_or_null();
@ -2694,7 +2694,7 @@ void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf)
// Traverse the GCHandles
Thread::oops_do(f, cld_f, cf);
assert( (!has_last_Java_frame() && java_call_counter() == 0) ||
assert((!has_last_Java_frame() && java_call_counter() == 0) ||
(has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!");
if (has_last_Java_frame()) {
@ -2719,7 +2719,7 @@ void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf)
}
// Traverse the execution stack
for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
fst.current()->oops_do(f, cld_f, cf, fst.register_map());
}
}
@ -2754,12 +2754,12 @@ void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf)
void JavaThread::nmethods_do(CodeBlobClosure* cf) {
Thread::nmethods_do(cf); // (super method is a no-op)
assert( (!has_last_Java_frame() && java_call_counter() == 0) ||
assert((!has_last_Java_frame() && java_call_counter() == 0) ||
(has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!");
if (has_last_Java_frame()) {
// Traverse the execution stack
for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
fst.current()->nmethods_do(cf);
}
}
@ -2769,7 +2769,7 @@ void JavaThread::metadata_do(void f(Metadata*)) {
Thread::metadata_do(f);
if (has_last_Java_frame()) {
// Traverse the execution stack to call f() on the methods in the stack
for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
fst.current()->metadata_do(f);
}
} else if (is_Compiler_thread()) {
@ -2832,7 +2832,7 @@ void JavaThread::print_on(outputStream *st) const {
// Called by fatal error handler. The difference between this and
// JavaThread::print() is that we can't grab lock or allocate memory.
void JavaThread::print_on_error(outputStream* st, char *buf, int buflen) const {
st->print("JavaThread \"%s\"", get_thread_name_string(buf, buflen));
st->print("JavaThread \"%s\"", get_thread_name_string(buf, buflen));
oop thread_obj = threadObj();
if (thread_obj != NULL) {
if (java_lang_Thread::is_daemon(thread_obj)) st->print(" daemon");
@ -3015,7 +3015,7 @@ void JavaThread::print_stack_on(outputStream* st) {
RegisterMap reg_map(this);
vframe* start_vf = last_java_vframe(&reg_map);
int count = 0;
for (vframe* f = start_vf; f; f = f->sender() ) {
for (vframe* f = start_vf; f; f = f->sender()) {
if (f->is_java_frame()) {
javaVFrame* jvf = javaVFrame::cast(f);
java_lang_Throwable::print_stack_element(st, jvf->method(), jvf->bci());
@ -3071,9 +3071,9 @@ void JavaThread::popframe_free_preserved_args() {
void JavaThread::trace_frames() {
tty->print_cr("[Describe stack]");
int frame_no = 1;
for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
tty->print(" %d. ", frame_no++);
fst.current()->print_value_on(tty,this);
fst.current()->print_value_on(tty, this);
tty->cr();
}
}
@ -3124,7 +3124,7 @@ void JavaThread::print_frame_layout(int depth, bool validate_only) {
PRESERVE_EXCEPTION_MARK;
FrameValues values;
int frame_no = 0;
for(StackFrameStream fst(this, false); !fst.is_done(); fst.next()) {
for (StackFrameStream fst(this, false); !fst.is_done(); fst.next()) {
fst.current()->describe(values, ++frame_no);
if (depth == frame_no) break;
}
@ -3140,7 +3140,7 @@ void JavaThread::print_frame_layout(int depth, bool validate_only) {
void JavaThread::trace_stack_from(vframe* start_vf) {
ResourceMark rm;
int vframe_no = 1;
for (vframe* f = start_vf; f; f = f->sender() ) {
for (vframe* f = start_vf; f; f = f->sender()) {
if (f->is_java_frame()) {
javaVFrame::cast(f)->print_activation(vframe_no++);
} else {
@ -3169,7 +3169,7 @@ void JavaThread::trace_stack() {
javaVFrame* JavaThread::last_java_vframe(RegisterMap *reg_map) {
assert(reg_map != NULL, "a map must be given");
frame f = last_frame();
for (vframe* vf = vframe::new_vframe(&f, reg_map, this); vf; vf = vf->sender() ) {
for (vframe* vf = vframe::new_vframe(&f, reg_map, this); vf; vf = vf->sender()) {
if (vf->is_java_frame()) return javaVFrame::cast(vf);
}
return NULL;
@ -3291,7 +3291,7 @@ void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
// The VM preresolves methods to these classes. Make sure that they get initialized
initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK);
initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK);
initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK);
call_initializeSystemClass(CHECK);
// get the Java runtime name after java.lang.System is initialized
@ -3425,7 +3425,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
main_thread->create_stack_guard_pages();
// Initialize Java-Level synchronization subsystem
ObjectMonitor::Initialize() ;
ObjectMonitor::Initialize();
// Second phase of bootstrapping, VM is about entering multi-thread mode
MemTracker::bootstrap_multi_thread();
@ -3473,7 +3473,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
}
}
assert (Universe::is_fully_initialized(), "not initialized");
assert(Universe::is_fully_initialized(), "not initialized");
if (VerifyDuringStartup) {
// Make sure we're starting with a clean slate.
VM_Verify verify_op;
@ -3899,7 +3899,7 @@ bool Threads::destroy_vm() {
#endif
// Wait until we are the last non-daemon thread to execute
{ MutexLocker nu(Threads_lock);
while (Threads::number_of_non_daemon_threads() > 1 )
while (Threads::number_of_non_daemon_threads() > 1)
// This wait should make safepoint checks, wait without a timeout,
// and wait as a suspend-equivalent condition.
//
@ -4078,7 +4078,7 @@ void Threads::remove(JavaThread* p) {
bool Threads::includes(JavaThread* p) {
assert(Threads_lock->is_locked(), "sanity check");
ALL_JAVA_THREADS(q) {
if (q == p ) {
if (q == p) {
return true;
}
}
@ -4363,43 +4363,43 @@ void Threads::print_on_error(outputStream* st, Thread* current, char* buf, int b
// cache-coherency traffic.
typedef volatile int SpinLockT ;
typedef volatile int SpinLockT;
void Thread::SpinAcquire (volatile int * adr, const char * LockName) {
if (Atomic::cmpxchg (1, adr, 0) == 0) {
return ; // normal fast-path return
return; // normal fast-path return
}
// Slow-path : We've encountered contention -- Spin/Yield/Block strategy.
TEVENT (SpinAcquire - ctx) ;
int ctr = 0 ;
int Yields = 0 ;
TEVENT(SpinAcquire - ctx);
int ctr = 0;
int Yields = 0;
for (;;) {
while (*adr != 0) {
++ctr ;
++ctr;
if ((ctr & 0xFFF) == 0 || !os::is_MP()) {
if (Yields > 5) {
os::naked_short_sleep(1);
} else {
os::NakedYield() ;
++Yields ;
os::NakedYield();
++Yields;
}
} else {
SpinPause() ;
SpinPause();
}
}
if (Atomic::cmpxchg (1, adr, 0) == 0) return ;
if (Atomic::cmpxchg(1, adr, 0) == 0) return;
}
}
void Thread::SpinRelease (volatile int * adr) {
assert (*adr != 0, "invariant") ;
OrderAccess::fence() ; // guarantee at least release consistency.
assert(*adr != 0, "invariant");
OrderAccess::fence(); // guarantee at least release consistency.
// Roach-motel semantics.
// It's safe if subsequent LDs and STs float "up" into the critical section,
// but prior LDs and STs within the critical section can't be allowed
// to reorder or float past the ST that releases the lock.
*adr = 0 ;
*adr = 0;
}
// muxAcquire and muxRelease:
@ -4452,111 +4452,111 @@ void Thread::SpinRelease (volatile int * adr) {
//
typedef volatile intptr_t MutexT ; // Mux Lock-word
enum MuxBits { LOCKBIT = 1 } ;
typedef volatile intptr_t MutexT; // Mux Lock-word
enum MuxBits { LOCKBIT = 1 };
void Thread::muxAcquire (volatile intptr_t * Lock, const char * LockName) {
intptr_t w = Atomic::cmpxchg_ptr (LOCKBIT, Lock, 0) ;
if (w == 0) return ;
intptr_t w = Atomic::cmpxchg_ptr(LOCKBIT, Lock, 0);
if (w == 0) return;
if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
return ;
return;
}
TEVENT (muxAcquire - Contention) ;
ParkEvent * const Self = Thread::current()->_MuxEvent ;
assert ((intptr_t(Self) & LOCKBIT) == 0, "invariant") ;
TEVENT(muxAcquire - Contention);
ParkEvent * const Self = Thread::current()->_MuxEvent;
assert((intptr_t(Self) & LOCKBIT) == 0, "invariant");
for (;;) {
int its = (os::is_MP() ? 100 : 0) + 1 ;
int its = (os::is_MP() ? 100 : 0) + 1;
// Optional spin phase: spin-then-park strategy
while (--its >= 0) {
w = *Lock ;
w = *Lock;
if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
return ;
return;
}
}
Self->reset() ;
Self->OnList = intptr_t(Lock) ;
Self->reset();
Self->OnList = intptr_t(Lock);
// The following fence() isn't _strictly necessary as the subsequent
// CAS() both serializes execution and ratifies the fetched *Lock value.
OrderAccess::fence();
for (;;) {
w = *Lock ;
w = *Lock;
if ((w & LOCKBIT) == 0) {
if (Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
Self->OnList = 0 ; // hygiene - allows stronger asserts
return ;
Self->OnList = 0; // hygiene - allows stronger asserts
return;
}
continue ; // Interference -- *Lock changed -- Just retry
continue; // Interference -- *Lock changed -- Just retry
}
assert (w & LOCKBIT, "invariant") ;
Self->ListNext = (ParkEvent *) (w & ~LOCKBIT );
if (Atomic::cmpxchg_ptr (intptr_t(Self)|LOCKBIT, Lock, w) == w) break ;
assert(w & LOCKBIT, "invariant");
Self->ListNext = (ParkEvent *) (w & ~LOCKBIT);
if (Atomic::cmpxchg_ptr(intptr_t(Self)|LOCKBIT, Lock, w) == w) break;
}
while (Self->OnList != 0) {
Self->park() ;
Self->park();
}
}
}
void Thread::muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) {
intptr_t w = Atomic::cmpxchg_ptr (LOCKBIT, Lock, 0) ;
if (w == 0) return ;
intptr_t w = Atomic::cmpxchg_ptr(LOCKBIT, Lock, 0);
if (w == 0) return;
if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
return ;
return;
}
TEVENT (muxAcquire - Contention) ;
ParkEvent * ReleaseAfter = NULL ;
TEVENT(muxAcquire - Contention);
ParkEvent * ReleaseAfter = NULL;
if (ev == NULL) {
ev = ReleaseAfter = ParkEvent::Allocate (NULL) ;
ev = ReleaseAfter = ParkEvent::Allocate(NULL);
}
assert ((intptr_t(ev) & LOCKBIT) == 0, "invariant") ;
assert((intptr_t(ev) & LOCKBIT) == 0, "invariant");
for (;;) {
guarantee (ev->OnList == 0, "invariant") ;
int its = (os::is_MP() ? 100 : 0) + 1 ;
guarantee(ev->OnList == 0, "invariant");
int its = (os::is_MP() ? 100 : 0) + 1;
// Optional spin phase: spin-then-park strategy
while (--its >= 0) {
w = *Lock ;
w = *Lock;
if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
if (ReleaseAfter != NULL) {
ParkEvent::Release (ReleaseAfter) ;
ParkEvent::Release(ReleaseAfter);
}
return ;
return;
}
}
ev->reset() ;
ev->OnList = intptr_t(Lock) ;
ev->reset();
ev->OnList = intptr_t(Lock);
// The following fence() isn't _strictly necessary as the subsequent
// CAS() both serializes execution and ratifies the fetched *Lock value.
OrderAccess::fence();
for (;;) {
w = *Lock ;
w = *Lock;
if ((w & LOCKBIT) == 0) {
if (Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) {
ev->OnList = 0 ;
ev->OnList = 0;
// We call ::Release while holding the outer lock, thus
// artificially lengthening the critical section.
// Consider deferring the ::Release() until the subsequent unlock(),
// after we've dropped the outer lock.
if (ReleaseAfter != NULL) {
ParkEvent::Release (ReleaseAfter) ;
ParkEvent::Release(ReleaseAfter);
}
return ;
return;
}
continue ; // Interference -- *Lock changed -- Just retry
continue; // Interference -- *Lock changed -- Just retry
}
assert (w & LOCKBIT, "invariant") ;
ev->ListNext = (ParkEvent *) (w & ~LOCKBIT );
if (Atomic::cmpxchg_ptr (intptr_t(ev)|LOCKBIT, Lock, w) == w) break ;
assert(w & LOCKBIT, "invariant");
ev->ListNext = (ParkEvent *) (w & ~LOCKBIT);
if (Atomic::cmpxchg_ptr(intptr_t(ev)|LOCKBIT, Lock, w) == w) break;
}
while (ev->OnList != 0) {
ev->park() ;
ev->park();
}
}
}
@ -4583,22 +4583,22 @@ void Thread::muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) {
void Thread::muxRelease (volatile intptr_t * Lock) {
for (;;) {
const intptr_t w = Atomic::cmpxchg_ptr (0, Lock, LOCKBIT) ;
assert (w & LOCKBIT, "invariant") ;
if (w == LOCKBIT) return ;
ParkEvent * List = (ParkEvent *) (w & ~LOCKBIT) ;
assert (List != NULL, "invariant") ;
assert (List->OnList == intptr_t(Lock), "invariant") ;
ParkEvent * nxt = List->ListNext ;
const intptr_t w = Atomic::cmpxchg_ptr(0, Lock, LOCKBIT);
assert(w & LOCKBIT, "invariant");
if (w == LOCKBIT) return;
ParkEvent * List = (ParkEvent *)(w & ~LOCKBIT);
assert(List != NULL, "invariant");
assert(List->OnList == intptr_t(Lock), "invariant");
ParkEvent * nxt = List->ListNext;
// The following CAS() releases the lock and pops the head element.
if (Atomic::cmpxchg_ptr (intptr_t(nxt), Lock, w) != w) {
continue ;
continue;
}
List->OnList = 0 ;
OrderAccess::fence() ;
List->unpark () ;
return ;
List->OnList = 0;
OrderAccess::fence();
List->unpark();
return;
}
}

View File

@ -244,7 +244,7 @@ class Thread: public ThreadShadow {
// The two classes No_Safepoint_Verifier and No_Allocation_Verifier are used to set these counters.
//
NOT_PRODUCT(int _allow_safepoint_count;) // If 0, thread allow a safepoint to happen
debug_only (int _allow_allocation_count;) // If 0, the thread is allowed to allocate oops.
debug_only(int _allow_allocation_count;) // If 0, the thread is allowed to allocate oops.
// Used by SkipGCALot class.
NOT_PRODUCT(bool _skip_gcalot;) // Should we elide gc-a-lot?
@ -593,12 +593,12 @@ public:
bool is_inside_jvmti_env_iteration() { return _jvmti_env_iteration_count > 0; }
// Code generation
static ByteSize exception_file_offset() { return byte_offset_of(Thread, _exception_file ); }
static ByteSize exception_line_offset() { return byte_offset_of(Thread, _exception_line ); }
static ByteSize active_handles_offset() { return byte_offset_of(Thread, _active_handles ); }
static ByteSize exception_file_offset() { return byte_offset_of(Thread, _exception_file); }
static ByteSize exception_line_offset() { return byte_offset_of(Thread, _exception_line); }
static ByteSize active_handles_offset() { return byte_offset_of(Thread, _active_handles); }
static ByteSize stack_base_offset() { return byte_offset_of(Thread, _stack_base ); }
static ByteSize stack_size_offset() { return byte_offset_of(Thread, _stack_size ); }
static ByteSize stack_base_offset() { return byte_offset_of(Thread, _stack_base); }
static ByteSize stack_size_offset() { return byte_offset_of(Thread, _stack_size); }
#define TLAB_FIELD_OFFSET(name) \
static ByteSize tlab_##name##_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); }
@ -615,35 +615,35 @@ public:
#undef TLAB_FIELD_OFFSET
static ByteSize allocated_bytes_offset() { return byte_offset_of(Thread, _allocated_bytes ); }
static ByteSize allocated_bytes_offset() { return byte_offset_of(Thread, _allocated_bytes); }
public:
volatile intptr_t _Stalled ;
volatile int _TypeTag ;
ParkEvent * _ParkEvent ; // for synchronized()
ParkEvent * _SleepEvent ; // for Thread.sleep
ParkEvent * _MutexEvent ; // for native internal Mutex/Monitor
ParkEvent * _MuxEvent ; // for low-level muxAcquire-muxRelease
int NativeSyncRecursion ; // diagnostic
volatile intptr_t _Stalled;
volatile int _TypeTag;
ParkEvent * _ParkEvent; // for synchronized()
ParkEvent * _SleepEvent; // for Thread.sleep
ParkEvent * _MutexEvent; // for native internal Mutex/Monitor
ParkEvent * _MuxEvent; // for low-level muxAcquire-muxRelease
int NativeSyncRecursion; // diagnostic
volatile int _OnTrap ; // Resume-at IP delta
jint _hashStateW ; // Marsaglia Shift-XOR thread-local RNG
jint _hashStateX ; // thread-specific hashCode generator state
jint _hashStateY ;
jint _hashStateZ ;
void * _schedctl ;
volatile int _OnTrap; // Resume-at IP delta
jint _hashStateW; // Marsaglia Shift-XOR thread-local RNG
jint _hashStateX; // thread-specific hashCode generator state
jint _hashStateY;
jint _hashStateZ;
void * _schedctl;
volatile jint rng [4] ; // RNG for spin loop
volatile jint rng[4]; // RNG for spin loop
// Low-level leaf-lock primitives used to implement synchronization
// and native monitor-mutex infrastructure.
// Not for general synchronization use.
static void SpinAcquire (volatile int * Lock, const char * Name) ;
static void SpinRelease (volatile int * Lock) ;
static void muxAcquire (volatile intptr_t * Lock, const char * Name) ;
static void muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) ;
static void muxRelease (volatile intptr_t * Lock) ;
static void SpinAcquire(volatile int * Lock, const char * Name);
static void SpinRelease(volatile int * Lock);
static void muxAcquire(volatile intptr_t * Lock, const char * Name);
static void muxAcquireW(volatile intptr_t * Lock, ParkEvent * ev);
static void muxRelease(volatile intptr_t * Lock);
};
// Inline implementation of Thread::current()
@ -933,7 +933,7 @@ class JavaThread: public Thread {
intptr_t _instruction;
const char* _file;
int _line;
} _jmp_ring[ jump_ring_buffer_size ];
} _jmp_ring[jump_ring_buffer_size];
#endif /* PRODUCT */
#if INCLUDE_ALL_GCS
@ -1336,34 +1336,34 @@ class JavaThread: public Thread {
#endif /* PRODUCT */
// For assembly stub generation
static ByteSize threadObj_offset() { return byte_offset_of(JavaThread, _threadObj ); }
static ByteSize threadObj_offset() { return byte_offset_of(JavaThread, _threadObj); }
#ifndef PRODUCT
static ByteSize jmp_ring_index_offset() { return byte_offset_of(JavaThread, _jmp_ring_index ); }
static ByteSize jmp_ring_offset() { return byte_offset_of(JavaThread, _jmp_ring ); }
static ByteSize jmp_ring_index_offset() { return byte_offset_of(JavaThread, _jmp_ring_index); }
static ByteSize jmp_ring_offset() { return byte_offset_of(JavaThread, _jmp_ring); }
#endif /* PRODUCT */
static ByteSize jni_environment_offset() { return byte_offset_of(JavaThread, _jni_environment ); }
static ByteSize last_Java_sp_offset() {
static ByteSize jni_environment_offset() { return byte_offset_of(JavaThread, _jni_environment); }
static ByteSize last_Java_sp_offset() {
return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset();
}
static ByteSize last_Java_pc_offset() {
static ByteSize last_Java_pc_offset() {
return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
}
static ByteSize frame_anchor_offset() {
static ByteSize frame_anchor_offset() {
return byte_offset_of(JavaThread, _anchor);
}
static ByteSize callee_target_offset() { return byte_offset_of(JavaThread, _callee_target ); }
static ByteSize vm_result_offset() { return byte_offset_of(JavaThread, _vm_result ); }
static ByteSize vm_result_2_offset() { return byte_offset_of(JavaThread, _vm_result_2 ); }
static ByteSize thread_state_offset() { return byte_offset_of(JavaThread, _thread_state ); }
static ByteSize saved_exception_pc_offset() { return byte_offset_of(JavaThread, _saved_exception_pc ); }
static ByteSize osthread_offset() { return byte_offset_of(JavaThread, _osthread ); }
static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop ); }
static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc ); }
static ByteSize callee_target_offset() { return byte_offset_of(JavaThread, _callee_target); }
static ByteSize vm_result_offset() { return byte_offset_of(JavaThread, _vm_result); }
static ByteSize vm_result_2_offset() { return byte_offset_of(JavaThread, _vm_result_2); }
static ByteSize thread_state_offset() { return byte_offset_of(JavaThread, _thread_state); }
static ByteSize saved_exception_pc_offset() { return byte_offset_of(JavaThread, _saved_exception_pc); }
static ByteSize osthread_offset() { return byte_offset_of(JavaThread, _osthread); }
static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop); }
static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc); }
static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); }
static ByteSize stack_overflow_limit_offset() { return byte_offset_of(JavaThread, _stack_overflow_limit); }
static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); }
static ByteSize stack_guard_state_offset() { return byte_offset_of(JavaThread, _stack_guard_state ); }
static ByteSize suspend_flags_offset() { return byte_offset_of(JavaThread, _suspend_flags ); }
static ByteSize stack_guard_state_offset() { return byte_offset_of(JavaThread, _stack_guard_state); }
static ByteSize suspend_flags_offset() { return byte_offset_of(JavaThread, _suspend_flags); }
static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); }
static ByteSize should_post_on_exceptions_flag_offset() {
@ -1422,7 +1422,7 @@ class JavaThread: public Thread {
void remove_monitor_chunk(MonitorChunk* chunk);
bool in_deopt_handler() const { return _in_deopt_handler > 0; }
void inc_in_deopt_handler() { _in_deopt_handler++; }
void dec_in_deopt_handler() {
void dec_in_deopt_handler() {
assert(_in_deopt_handler > 0, "mismatched deopt nesting");
if (_in_deopt_handler > 0) { // robustness
_in_deopt_handler--;
@ -1776,7 +1776,7 @@ private:
uint _claimed_par_id;
public:
uint get_claimed_par_id() { return _claimed_par_id; }
void set_claimed_par_id(uint id) { _claimed_par_id = id;}
void set_claimed_par_id(uint id) { _claimed_par_id = id; }
};
// Inline implementation of JavaThread::current
@ -1811,7 +1811,7 @@ inline bool JavaThread::stack_yellow_zone_enabled() {
inline size_t JavaThread::stack_available(address cur_sp) {
// This code assumes java stacks grow down
address low_addr; // Limit on the address for deepest stack depth
if ( _stack_guard_state == stack_guard_unused) {
if (_stack_guard_state == stack_guard_unused) {
low_addr = stack_base() - stack_size();
} else {
low_addr = stack_yellow_zone_base();