219 return OS_OK;
220 }
221
222
223 // --------------------- sun.misc.Signal (optional) ---------------------
224
225
226 // SIGBREAK is sent by the keyboard to query the VM state
227 #ifndef SIGBREAK
228 #define SIGBREAK SIGQUIT
229 #endif
230
231 // sigexitnum_pd is a platform-specific special signal used for terminating the Signal thread.
232
233
234 static void signal_thread_entry(JavaThread* thread, TRAPS) {
235 os::set_priority(thread, NearMaxPriority);
236 while (true) {
237 int sig;
238 {
239 // FIXME : Currently we have not decieded what should be the status
240 // for this java thread blocked here. Once we decide about
241 // that we should fix this.
242 sig = os::signal_wait();
243 }
244 if (sig == os::sigexitnum_pd()) {
245 // Terminate the signal thread
246 return;
247 }
248
249 switch (sig) {
250 case SIGBREAK: {
251 // Check if the signal is a trigger to start the Attach Listener - in that
252 // case don't print stack traces.
253 if (!DisableAttachMechanism && AttachListener::is_init_trigger()) {
254 continue;
255 }
256 // Print stack traces
257 // Any SIGBREAK operations added here should make sure to flush
258 // the output stream (e.g. tty->flush()) after output. See 4803766.
259 // Each module also prints an extra carriage return after its output.
566 p[2] != badResourceValue || p[3] != badResourceValue) p++;
567 // ok, we have four consecutive marker bytes; find end of cushion
568 u_char* q = p + 4;
569 while (*q == badResourceValue) q++;
570 return q - MallocCushion;
571 }
572
573 void print_neighbor_blocks(void* ptr) {
574 // find block allocated before ptr (not entirely crash-proof)
575 if (MallocCushion < 4) {
576 tty->print_cr("### cannot find previous block (MallocCushion < 4)");
577 return;
578 }
579 u_char* start_of_this_block = (u_char*)ptr - space_before;
580 u_char* end_of_prev_block_data = start_of_this_block - space_after -1;
581 // look for cushion in front of prev. block
582 u_char* start_of_prev_block = find_cushion_backwards(end_of_prev_block_data);
583 ptrdiff_t size = *size_addr_from_base(start_of_prev_block);
584 u_char* obj = start_of_prev_block + space_before;
585 if (size <= 0 ) {
586 // start is bad; mayhave been confused by OS data inbetween objects
587 // search one more backwards
588 start_of_prev_block = find_cushion_backwards(start_of_prev_block);
589 size = *size_addr_from_base(start_of_prev_block);
590 obj = start_of_prev_block + space_before;
591 }
592
593 if (start_of_prev_block + space_before + size + space_after == start_of_this_block) {
594 tty->print_cr("### previous object: " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
595 } else {
596 tty->print_cr("### previous object (not sure if correct): " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
597 }
598
599 // now find successor block
600 u_char* start_of_next_block = (u_char*)ptr + *size_addr_from_obj(ptr) + space_after;
601 start_of_next_block = find_cushion_forwards(start_of_next_block);
602 u_char* next_obj = start_of_next_block + space_before;
603 ptrdiff_t next_size = *size_addr_from_base(start_of_next_block);
604 if (start_of_next_block[0] == badResourceValue &&
605 start_of_next_block[1] == badResourceValue &&
606 start_of_next_block[2] == badResourceValue &&
994 if (nm != NULL) {
995 ResourceMark rm;
996 st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT,
997 addr, (int)(addr - nm->entry_point()), nm);
998 if (verbose) {
999 st->print(" for ");
1000 nm->method()->print_value_on(st);
1001 }
1002 st->cr();
1003 nm->print_nmethod(verbose);
1004 return;
1005 }
1006 st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", addr, (int)(addr - b->code_begin()));
1007 b->print_on(st);
1008 return;
1009 }
1010
1011 if (Universe::heap()->is_in(addr)) {
1012 HeapWord* p = Universe::heap()->block_start(addr);
1013 bool print = false;
1014 // If we couldn't find it it just may mean that heap wasn't parseable
1015 // See if we were just given an oop directly
1016 if (p != NULL && Universe::heap()->block_is_obj(p)) {
1017 print = true;
1018 } else if (p == NULL && ((oopDesc*)addr)->is_oop()) {
1019 p = (HeapWord*) addr;
1020 print = true;
1021 }
1022 if (print) {
1023 if (p == (HeapWord*) addr) {
1024 st->print_cr(INTPTR_FORMAT " is an oop", addr);
1025 } else {
1026 st->print_cr(INTPTR_FORMAT " is pointing into object: " INTPTR_FORMAT, addr, p);
1027 }
1028 oop(p)->print_on(st);
1029 return;
1030 }
1031 } else {
1032 if (Universe::heap()->is_in_reserved(addr)) {
1033 st->print_cr(INTPTR_FORMAT " is an unallocated location "
1034 "in the heap", addr);
1431 }
1432
1433 void os::trace_page_sizes(const char* str, const size_t region_min_size,
1434 const size_t region_max_size, const size_t page_size,
1435 const char* base, const size_t size)
1436 {
1437 if (TracePageSizes) {
1438 tty->print_cr("%s: min=" SIZE_FORMAT " max=" SIZE_FORMAT
1439 " pg_sz=" SIZE_FORMAT " base=" PTR_FORMAT
1440 " size=" SIZE_FORMAT,
1441 str, region_min_size, region_max_size,
1442 page_size, base, size);
1443 }
1444 }
1445 #endif // #ifndef PRODUCT
1446
1447 // This is the working definition of a server class machine:
1448 // >= 2 physical CPU's and >=2GB of memory, with some fuzz
1449 // because the graphics memory (?) sometimes masks physical memory.
1450 // If you want to change the definition of a server class machine
1451 // on some OS or platform, e.g., >=4GB on Windohs platforms,
1452 // then you'll have to parameterize this method based on that state,
1453 // as was done for logical processors here, or replicate and
1454 // specialize this method for each platform. (Or fix os to have
1455 // some inheritance structure and use subclassing. Sigh.)
1456 // If you want some platform to always or never behave as a server
1457 // class machine, change the setting of AlwaysActAsServerClassMachine
1458 // and NeverActAsServerClassMachine in globals*.hpp.
1459 bool os::is_server_class_machine() {
1460 // First check for the early returns
1461 if (NeverActAsServerClassMachine) {
1462 return false;
1463 }
1464 if (AlwaysActAsServerClassMachine) {
1465 return true;
1466 }
1467 // Then actually look at the machine
1468 bool result = false;
1469 const unsigned int server_processors = 2;
1470 const julong server_memory = 2UL * G;
1471 // We seem not to get our full complement of memory.
|
219 return OS_OK;
220 }
221
222
223 // --------------------- sun.misc.Signal (optional) ---------------------
224
225
226 // SIGBREAK is sent by the keyboard to query the VM state
227 #ifndef SIGBREAK
228 #define SIGBREAK SIGQUIT
229 #endif
230
231 // sigexitnum_pd is a platform-specific special signal used for terminating the Signal thread.
232
233
234 static void signal_thread_entry(JavaThread* thread, TRAPS) {
235 os::set_priority(thread, NearMaxPriority);
236 while (true) {
237 int sig;
238 {
239 // FIXME : Currently we have not decided what should be the status
240 // for this java thread blocked here. Once we decide about
241 // that we should fix this.
242 sig = os::signal_wait();
243 }
244 if (sig == os::sigexitnum_pd()) {
245 // Terminate the signal thread
246 return;
247 }
248
249 switch (sig) {
250 case SIGBREAK: {
251 // Check if the signal is a trigger to start the Attach Listener - in that
252 // case don't print stack traces.
253 if (!DisableAttachMechanism && AttachListener::is_init_trigger()) {
254 continue;
255 }
256 // Print stack traces
257 // Any SIGBREAK operations added here should make sure to flush
258 // the output stream (e.g. tty->flush()) after output. See 4803766.
259 // Each module also prints an extra carriage return after its output.
566 p[2] != badResourceValue || p[3] != badResourceValue) p++;
567 // ok, we have four consecutive marker bytes; find end of cushion
568 u_char* q = p + 4;
569 while (*q == badResourceValue) q++;
570 return q - MallocCushion;
571 }
572
573 void print_neighbor_blocks(void* ptr) {
574 // find block allocated before ptr (not entirely crash-proof)
575 if (MallocCushion < 4) {
576 tty->print_cr("### cannot find previous block (MallocCushion < 4)");
577 return;
578 }
579 u_char* start_of_this_block = (u_char*)ptr - space_before;
580 u_char* end_of_prev_block_data = start_of_this_block - space_after -1;
581 // look for cushion in front of prev. block
582 u_char* start_of_prev_block = find_cushion_backwards(end_of_prev_block_data);
583 ptrdiff_t size = *size_addr_from_base(start_of_prev_block);
584 u_char* obj = start_of_prev_block + space_before;
585 if (size <= 0 ) {
586 // start is bad; may have been confused by OS data in between objects
587 // search one more backwards
588 start_of_prev_block = find_cushion_backwards(start_of_prev_block);
589 size = *size_addr_from_base(start_of_prev_block);
590 obj = start_of_prev_block + space_before;
591 }
592
593 if (start_of_prev_block + space_before + size + space_after == start_of_this_block) {
594 tty->print_cr("### previous object: " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
595 } else {
596 tty->print_cr("### previous object (not sure if correct): " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
597 }
598
599 // now find successor block
600 u_char* start_of_next_block = (u_char*)ptr + *size_addr_from_obj(ptr) + space_after;
601 start_of_next_block = find_cushion_forwards(start_of_next_block);
602 u_char* next_obj = start_of_next_block + space_before;
603 ptrdiff_t next_size = *size_addr_from_base(start_of_next_block);
604 if (start_of_next_block[0] == badResourceValue &&
605 start_of_next_block[1] == badResourceValue &&
606 start_of_next_block[2] == badResourceValue &&
994 if (nm != NULL) {
995 ResourceMark rm;
996 st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT,
997 addr, (int)(addr - nm->entry_point()), nm);
998 if (verbose) {
999 st->print(" for ");
1000 nm->method()->print_value_on(st);
1001 }
1002 st->cr();
1003 nm->print_nmethod(verbose);
1004 return;
1005 }
1006 st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", addr, (int)(addr - b->code_begin()));
1007 b->print_on(st);
1008 return;
1009 }
1010
1011 if (Universe::heap()->is_in(addr)) {
1012 HeapWord* p = Universe::heap()->block_start(addr);
1013 bool print = false;
1014 // If we couldn't find it it just may mean that heap wasn't parsable
1015 // See if we were just given an oop directly
1016 if (p != NULL && Universe::heap()->block_is_obj(p)) {
1017 print = true;
1018 } else if (p == NULL && ((oopDesc*)addr)->is_oop()) {
1019 p = (HeapWord*) addr;
1020 print = true;
1021 }
1022 if (print) {
1023 if (p == (HeapWord*) addr) {
1024 st->print_cr(INTPTR_FORMAT " is an oop", addr);
1025 } else {
1026 st->print_cr(INTPTR_FORMAT " is pointing into object: " INTPTR_FORMAT, addr, p);
1027 }
1028 oop(p)->print_on(st);
1029 return;
1030 }
1031 } else {
1032 if (Universe::heap()->is_in_reserved(addr)) {
1033 st->print_cr(INTPTR_FORMAT " is an unallocated location "
1034 "in the heap", addr);
1431 }
1432
1433 void os::trace_page_sizes(const char* str, const size_t region_min_size,
1434 const size_t region_max_size, const size_t page_size,
1435 const char* base, const size_t size)
1436 {
1437 if (TracePageSizes) {
1438 tty->print_cr("%s: min=" SIZE_FORMAT " max=" SIZE_FORMAT
1439 " pg_sz=" SIZE_FORMAT " base=" PTR_FORMAT
1440 " size=" SIZE_FORMAT,
1441 str, region_min_size, region_max_size,
1442 page_size, base, size);
1443 }
1444 }
1445 #endif // #ifndef PRODUCT
1446
1447 // This is the working definition of a server class machine:
1448 // >= 2 physical CPU's and >=2GB of memory, with some fuzz
1449 // because the graphics memory (?) sometimes masks physical memory.
1450 // If you want to change the definition of a server class machine
1451 // on some OS or platform, e.g., >=4GB on Windows platforms,
1452 // then you'll have to parameterize this method based on that state,
1453 // as was done for logical processors here, or replicate and
1454 // specialize this method for each platform. (Or fix os to have
1455 // some inheritance structure and use subclassing. Sigh.)
1456 // If you want some platform to always or never behave as a server
1457 // class machine, change the setting of AlwaysActAsServerClassMachine
1458 // and NeverActAsServerClassMachine in globals*.hpp.
1459 bool os::is_server_class_machine() {
1460 // First check for the early returns
1461 if (NeverActAsServerClassMachine) {
1462 return false;
1463 }
1464 if (AlwaysActAsServerClassMachine) {
1465 return true;
1466 }
1467 // Then actually look at the machine
1468 bool result = false;
1469 const unsigned int server_processors = 2;
1470 const julong server_memory = 2UL * G;
1471 // We seem not to get our full complement of memory.
|