Mercurial > hg > graal-jvmci-8
comparison src/os/solaris/vm/os_solaris.cpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 897b7d18bebc 65906dc96aa1 |
children | e522a00b91aa |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
544 uint_t* id_length) { | 544 uint_t* id_length) { |
545 bool result = false; | 545 bool result = false; |
546 // Find the number of processors in the processor set. | 546 // Find the number of processors in the processor set. |
547 if (pset_info(pset, NULL, id_length, NULL) == 0) { | 547 if (pset_info(pset, NULL, id_length, NULL) == 0) { |
548 // Make up an array to hold their ids. | 548 // Make up an array to hold their ids. |
549 *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length); | 549 *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length, mtInternal); |
550 // Fill in the array with their processor ids. | 550 // Fill in the array with their processor ids. |
551 if (pset_info(pset, NULL, id_length, *id_array) == 0) { | 551 if (pset_info(pset, NULL, id_length, *id_array) == 0) { |
552 result = true; | 552 result = true; |
553 } | 553 } |
554 } | 554 } |
575 uint* id_length) { | 575 uint* id_length) { |
576 const processorid_t MAX_PROCESSOR_ID = 100000 ; | 576 const processorid_t MAX_PROCESSOR_ID = 100000 ; |
577 // Find the number of processors online. | 577 // Find the number of processors online. |
578 *id_length = sysconf(_SC_NPROCESSORS_ONLN); | 578 *id_length = sysconf(_SC_NPROCESSORS_ONLN); |
579 // Make up an array to hold their ids. | 579 // Make up an array to hold their ids. |
580 *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length); | 580 *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length, mtInternal); |
581 // Processors need not be numbered consecutively. | 581 // Processors need not be numbered consecutively. |
582 long found = 0; | 582 long found = 0; |
583 processorid_t next = 0; | 583 processorid_t next = 0; |
584 while (found < *id_length && next < MAX_PROCESSOR_ID) { | 584 while (found < *id_length && next < MAX_PROCESSOR_ID) { |
585 processor_info_t info; | 585 processor_info_t info; |
627 max_id = MAX2(max_id, id_array[m]); | 627 max_id = MAX2(max_id, id_array[m]); |
628 } | 628 } |
629 // The next id, to limit loops. | 629 // The next id, to limit loops. |
630 const processorid_t limit_id = max_id + 1; | 630 const processorid_t limit_id = max_id + 1; |
631 // Make up markers for available processors. | 631 // Make up markers for available processors. |
632 bool* available_id = NEW_C_HEAP_ARRAY(bool, limit_id); | 632 bool* available_id = NEW_C_HEAP_ARRAY(bool, limit_id, mtInternal); |
633 for (uint c = 0; c < limit_id; c += 1) { | 633 for (uint c = 0; c < limit_id; c += 1) { |
634 available_id[c] = false; | 634 available_id[c] = false; |
635 } | 635 } |
636 for (uint a = 0; a < id_length; a += 1) { | 636 for (uint a = 0; a < id_length; a += 1) { |
637 available_id[id_array[a]] = true; | 637 available_id[id_array[a]] = true; |
664 if (board * processors_per_board + 0 >= limit_id) { | 664 if (board * processors_per_board + 0 >= limit_id) { |
665 board = 0; | 665 board = 0; |
666 } | 666 } |
667 } | 667 } |
668 if (available_id != NULL) { | 668 if (available_id != NULL) { |
669 FREE_C_HEAP_ARRAY(bool, available_id); | 669 FREE_C_HEAP_ARRAY(bool, available_id, mtInternal); |
670 } | 670 } |
671 return true; | 671 return true; |
672 } | 672 } |
673 | 673 |
674 void os::set_native_thread_name(const char *name) { | 674 void os::set_native_thread_name(const char *name) { |
696 } else { | 696 } else { |
697 result = false; | 697 result = false; |
698 } | 698 } |
699 } | 699 } |
700 if (id_array != NULL) { | 700 if (id_array != NULL) { |
701 FREE_C_HEAP_ARRAY(processorid_t, id_array); | 701 FREE_C_HEAP_ARRAY(processorid_t, id_array, mtInternal); |
702 } | 702 } |
703 return result; | 703 return result; |
704 } | 704 } |
705 | 705 |
706 bool os::bind_to_processor(uint processor_id) { | 706 bool os::bind_to_processor(uint processor_id) { |
769 // | 769 // |
770 // Important note: if the location of libjvm.so changes this | 770 // Important note: if the location of libjvm.so changes this |
771 // code needs to be changed accordingly. | 771 // code needs to be changed accordingly. |
772 | 772 |
773 // The next few definitions allow the code to be verbatim: | 773 // The next few definitions allow the code to be verbatim: |
774 #define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n)) | 774 #define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n), mtInternal) |
775 #define free(p) FREE_C_HEAP_ARRAY(char, p) | 775 #define free(p) FREE_C_HEAP_ARRAY(char, p, mtInternal) |
776 #define getenv(n) ::getenv(n) | 776 #define getenv(n) ::getenv(n) |
777 | 777 |
778 #define EXTENSIONS_DIR "/lib/ext" | 778 #define EXTENSIONS_DIR "/lib/ext" |
779 #define ENDORSED_DIR "/lib/endorsed" | 779 #define ENDORSED_DIR "/lib/endorsed" |
780 #define COMMON_DIR "/usr/jdk/packages" | 780 #define COMMON_DIR "/usr/jdk/packages" |
1009 return false; | 1009 return false; |
1010 } | 1010 } |
1011 | 1011 |
1012 extern "C" void breakpoint() { | 1012 extern "C" void breakpoint() { |
1013 // use debugger to set breakpoint here | 1013 // use debugger to set breakpoint here |
1014 } | |
1015 | |
1016 // Returns an estimate of the current stack pointer. Result must be guaranteed to | |
1017 // point into the calling threads stack, and be no lower than the current stack | |
1018 // pointer. | |
1019 address os::current_stack_pointer() { | |
1020 volatile int dummy; | |
1021 address sp = (address)&dummy + 8; // %%%% need to confirm if this is right | |
1022 return sp; | |
1023 } | 1014 } |
1024 | 1015 |
1025 static thread_t main_thread; | 1016 static thread_t main_thread; |
1026 | 1017 |
1027 // Thread start routine for all new Java threads | 1018 // Thread start routine for all new Java threads |
1934 } | 1925 } |
1935 } | 1926 } |
1936 // release the storage | 1927 // release the storage |
1937 for (int i = 0 ; i < n ; i++) { | 1928 for (int i = 0 ; i < n ; i++) { |
1938 if (pelements[i] != NULL) { | 1929 if (pelements[i] != NULL) { |
1939 FREE_C_HEAP_ARRAY(char, pelements[i]); | 1930 FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal); |
1940 } | 1931 } |
1941 } | 1932 } |
1942 if (pelements != NULL) { | 1933 if (pelements != NULL) { |
1943 FREE_C_HEAP_ARRAY(char*, pelements); | 1934 FREE_C_HEAP_ARRAY(char*, pelements, mtInternal); |
1944 } | 1935 } |
1945 } else { | 1936 } else { |
1946 snprintf(buffer, buflen, "%s/lib%s.so", pname, fname); | 1937 snprintf(buffer, buflen, "%s/lib%s.so", pname, fname); |
1947 } | 1938 } |
1948 } | 1939 } |
2249 ::close(fd); | 2240 ::close(fd); |
2250 | 2241 |
2251 return true; | 2242 return true; |
2252 } | 2243 } |
2253 | 2244 |
2245 void os::print_os_info_brief(outputStream* st) { | |
2246 os::Solaris::print_distro_info(st); | |
2247 | |
2248 os::Posix::print_uname_info(st); | |
2249 | |
2250 os::Solaris::print_libversion_info(st); | |
2251 } | |
2252 | |
2254 void os::print_os_info(outputStream* st) { | 2253 void os::print_os_info(outputStream* st) { |
2255 st->print("OS:"); | 2254 st->print("OS:"); |
2256 | 2255 |
2256 os::Solaris::print_distro_info(st); | |
2257 | |
2258 os::Posix::print_uname_info(st); | |
2259 | |
2260 os::Solaris::print_libversion_info(st); | |
2261 | |
2262 os::Posix::print_rlimit_info(st); | |
2263 | |
2264 os::Posix::print_load_average(st); | |
2265 } | |
2266 | |
2267 void os::Solaris::print_distro_info(outputStream* st) { | |
2257 if (!_print_ascii_file("/etc/release", st)) { | 2268 if (!_print_ascii_file("/etc/release", st)) { |
2258 st->print("Solaris"); | 2269 st->print("Solaris"); |
2270 } | |
2271 st->cr(); | |
2272 } | |
2273 | |
2274 void os::Solaris::print_libversion_info(outputStream* st) { | |
2275 if (os::Solaris::T2_libthread()) { | |
2276 st->print(" (T2 libthread)"); | |
2277 } | |
2278 else { | |
2279 st->print(" (T1 libthread)"); | |
2259 } | 2280 } |
2260 st->cr(); | 2281 st->cr(); |
2261 | 2282 } |
2262 // kernel | |
2263 st->print("uname:"); | |
2264 struct utsname name; | |
2265 uname(&name); | |
2266 st->print(name.sysname); st->print(" "); | |
2267 st->print(name.release); st->print(" "); | |
2268 st->print(name.version); st->print(" "); | |
2269 st->print(name.machine); | |
2270 | |
2271 // libthread | |
2272 if (os::Solaris::T2_libthread()) st->print(" (T2 libthread)"); | |
2273 else st->print(" (T1 libthread)"); | |
2274 st->cr(); | |
2275 | |
2276 // rlimit | |
2277 st->print("rlimit:"); | |
2278 struct rlimit rlim; | |
2279 | |
2280 st->print(" STACK "); | |
2281 getrlimit(RLIMIT_STACK, &rlim); | |
2282 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); | |
2283 else st->print("%uk", rlim.rlim_cur >> 10); | |
2284 | |
2285 st->print(", CORE "); | |
2286 getrlimit(RLIMIT_CORE, &rlim); | |
2287 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); | |
2288 else st->print("%uk", rlim.rlim_cur >> 10); | |
2289 | |
2290 st->print(", NOFILE "); | |
2291 getrlimit(RLIMIT_NOFILE, &rlim); | |
2292 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); | |
2293 else st->print("%d", rlim.rlim_cur); | |
2294 | |
2295 st->print(", AS "); | |
2296 getrlimit(RLIMIT_AS, &rlim); | |
2297 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); | |
2298 else st->print("%uk", rlim.rlim_cur >> 10); | |
2299 st->cr(); | |
2300 | |
2301 // load average | |
2302 st->print("load average:"); | |
2303 double loadavg[3]; | |
2304 os::loadavg(loadavg, 3); | |
2305 st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); | |
2306 st->cr(); | |
2307 } | |
2308 | |
2309 | 2283 |
2310 static bool check_addr0(outputStream* st) { | 2284 static bool check_addr0(outputStream* st) { |
2311 jboolean status = false; | 2285 jboolean status = false; |
2312 int fd = ::open("/proc/self/map",O_RDONLY); | 2286 int fd = ::open("/proc/self/map",O_RDONLY); |
2313 if (fd >= 0) { | 2287 if (fd >= 0) { |
2686 | 2660 |
2687 Maxlibjsigsigs = Maxsignum; | 2661 Maxlibjsigsigs = Maxsignum; |
2688 | 2662 |
2689 // pending_signals has one int per signal | 2663 // pending_signals has one int per signal |
2690 // The additional signal is for SIGEXIT - exit signal to signal_thread | 2664 // The additional signal is for SIGEXIT - exit signal to signal_thread |
2691 pending_signals = (jint *)os::malloc(sizeof(jint) * (Sigexit+1)); | 2665 pending_signals = (jint *)os::malloc(sizeof(jint) * (Sigexit+1), mtInternal); |
2692 memset(pending_signals, 0, (sizeof(jint) * (Sigexit+1))); | 2666 memset(pending_signals, 0, (sizeof(jint) * (Sigexit+1))); |
2693 | 2667 |
2694 if (UseSignalChaining) { | 2668 if (UseSignalChaining) { |
2695 chainedsigactions = (struct sigaction *)malloc(sizeof(struct sigaction) | 2669 chainedsigactions = (struct sigaction *)malloc(sizeof(struct sigaction) |
2696 * (Maxsignum + 1)); | 2670 * (Maxsignum + 1), mtInternal); |
2697 memset(chainedsigactions, 0, (sizeof(struct sigaction) * (Maxsignum + 1))); | 2671 memset(chainedsigactions, 0, (sizeof(struct sigaction) * (Maxsignum + 1))); |
2698 preinstalled_sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1)); | 2672 preinstalled_sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1), mtInternal); |
2699 memset(preinstalled_sigs, 0, (sizeof(int) * (Maxsignum + 1))); | 2673 memset(preinstalled_sigs, 0, (sizeof(int) * (Maxsignum + 1))); |
2700 } | 2674 } |
2701 ourSigFlags = (int*)malloc(sizeof(int) * (Maxsignum + 1 )); | 2675 ourSigFlags = (int*)malloc(sizeof(int) * (Maxsignum + 1 ), mtInternal); |
2702 memset(ourSigFlags, 0, sizeof(int) * (Maxsignum + 1)); | 2676 memset(ourSigFlags, 0, sizeof(int) * (Maxsignum + 1)); |
2703 } | 2677 } |
2704 | 2678 |
2705 void os::signal_init_pd() { | 2679 void os::signal_init_pd() { |
2706 int ret; | 2680 int ret; |
2784 int os::vm_allocation_granularity() { | 2758 int os::vm_allocation_granularity() { |
2785 assert(page_size != -1, "must call os::init"); | 2759 assert(page_size != -1, "must call os::init"); |
2786 return page_size; | 2760 return page_size; |
2787 } | 2761 } |
2788 | 2762 |
2789 bool os::commit_memory(char* addr, size_t bytes, bool exec) { | 2763 bool os::pd_commit_memory(char* addr, size_t bytes, bool exec) { |
2790 int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE; | 2764 int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE; |
2791 size_t size = bytes; | 2765 size_t size = bytes; |
2792 char *res = Solaris::mmap_chunk(addr, size, MAP_PRIVATE|MAP_FIXED, prot); | 2766 char *res = Solaris::mmap_chunk(addr, size, MAP_PRIVATE|MAP_FIXED, prot); |
2793 if (res != NULL) { | 2767 if (res != NULL) { |
2794 if (UseNUMAInterleaving) { | 2768 if (UseNUMAInterleaving) { |
2797 return true; | 2771 return true; |
2798 } | 2772 } |
2799 return false; | 2773 return false; |
2800 } | 2774 } |
2801 | 2775 |
2802 bool os::commit_memory(char* addr, size_t bytes, size_t alignment_hint, | 2776 bool os::pd_commit_memory(char* addr, size_t bytes, size_t alignment_hint, |
2803 bool exec) { | 2777 bool exec) { |
2804 if (commit_memory(addr, bytes, exec)) { | 2778 if (commit_memory(addr, bytes, exec)) { |
2805 if (UseMPSS && alignment_hint > (size_t)vm_page_size()) { | 2779 if (UseMPSS && alignment_hint > (size_t)vm_page_size()) { |
2806 // If the large page size has been set and the VM | 2780 // If the large page size has been set and the VM |
2807 // is using large pages, use the large page size | 2781 // is using large pages, use the large page size |
2827 } | 2801 } |
2828 return false; | 2802 return false; |
2829 } | 2803 } |
2830 | 2804 |
2831 // Uncommit the pages in a specified region. | 2805 // Uncommit the pages in a specified region. |
2832 void os::free_memory(char* addr, size_t bytes, size_t alignment_hint) { | 2806 void os::pd_free_memory(char* addr, size_t bytes, size_t alignment_hint) { |
2833 if (madvise(addr, bytes, MADV_FREE) < 0) { | 2807 if (madvise(addr, bytes, MADV_FREE) < 0) { |
2834 debug_only(warning("MADV_FREE failed.")); | 2808 debug_only(warning("MADV_FREE failed.")); |
2835 return; | 2809 return; |
2836 } | 2810 } |
2837 } | 2811 } |
2838 | 2812 |
2839 bool os::create_stack_guard_pages(char* addr, size_t size) { | 2813 bool os::pd_create_stack_guard_pages(char* addr, size_t size) { |
2840 return os::commit_memory(addr, size); | 2814 return os::commit_memory(addr, size); |
2841 } | 2815 } |
2842 | 2816 |
2843 bool os::remove_stack_guard_pages(char* addr, size_t size) { | 2817 bool os::remove_stack_guard_pages(char* addr, size_t size) { |
2844 return os::uncommit_memory(addr, size); | 2818 return os::uncommit_memory(addr, size); |
2845 } | 2819 } |
2846 | 2820 |
2847 // Change the page size in a given range. | 2821 // Change the page size in a given range. |
2848 void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { | 2822 void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) { |
2849 assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned."); | 2823 assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned."); |
2850 assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned."); | 2824 assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned."); |
2851 if (UseLargePages && UseMPSS) { | 2825 if (UseLargePages && UseMPSS) { |
2852 Solaris::set_mpss_range(addr, bytes, alignment_hint); | 2826 Solaris::set_mpss_range(addr, bytes, alignment_hint); |
2853 } | 2827 } |
3030 p = addrs[addrs_count - 1] + page_size; | 3004 p = addrs[addrs_count - 1] + page_size; |
3031 } | 3005 } |
3032 return end; | 3006 return end; |
3033 } | 3007 } |
3034 | 3008 |
3035 bool os::uncommit_memory(char* addr, size_t bytes) { | 3009 bool os::pd_uncommit_memory(char* addr, size_t bytes) { |
3036 size_t size = bytes; | 3010 size_t size = bytes; |
3037 // Map uncommitted pages PROT_NONE so we fail early if we touch an | 3011 // Map uncommitted pages PROT_NONE so we fail early if we touch an |
3038 // uncommitted page. Otherwise, the read/write might succeed if we | 3012 // uncommitted page. Otherwise, the read/write might succeed if we |
3039 // have enough swap space to back the physical page. | 3013 // have enough swap space to back the physical page. |
3040 return | 3014 return |
3069 // uncommitted page. Otherwise, the read/write might succeed if we | 3043 // uncommitted page. Otherwise, the read/write might succeed if we |
3070 // have enough swap space to back the physical page. | 3044 // have enough swap space to back the physical page. |
3071 return mmap_chunk(addr, bytes, flags, PROT_NONE); | 3045 return mmap_chunk(addr, bytes, flags, PROT_NONE); |
3072 } | 3046 } |
3073 | 3047 |
3074 char* os::reserve_memory(size_t bytes, char* requested_addr, size_t alignment_hint) { | 3048 char* os::pd_reserve_memory(size_t bytes, char* requested_addr, size_t alignment_hint) { |
3075 char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint, (requested_addr != NULL)); | 3049 char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint, (requested_addr != NULL)); |
3076 | 3050 |
3077 guarantee(requested_addr == NULL || requested_addr == addr, | 3051 guarantee(requested_addr == NULL || requested_addr == addr, |
3078 "OS failed to return requested mmap address."); | 3052 "OS failed to return requested mmap address."); |
3079 return addr; | 3053 return addr; |
3080 } | 3054 } |
3081 | 3055 |
3082 // Reserve memory at an arbitrary address, only if that area is | 3056 // Reserve memory at an arbitrary address, only if that area is |
3083 // available (and not reserved for something else). | 3057 // available (and not reserved for something else). |
3084 | 3058 |
3085 char* os::attempt_reserve_memory_at(size_t bytes, char* requested_addr) { | 3059 char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) { |
3086 const int max_tries = 10; | 3060 const int max_tries = 10; |
3087 char* base[max_tries]; | 3061 char* base[max_tries]; |
3088 size_t size[max_tries]; | 3062 size_t size[max_tries]; |
3089 | 3063 |
3090 // Solaris adds a gap between mmap'ed regions. The size of the gap | 3064 // Solaris adds a gap between mmap'ed regions. The size of the gap |
3202 } | 3176 } |
3203 | 3177 |
3204 return (i < max_tries) ? requested_addr : NULL; | 3178 return (i < max_tries) ? requested_addr : NULL; |
3205 } | 3179 } |
3206 | 3180 |
3207 bool os::release_memory(char* addr, size_t bytes) { | 3181 bool os::pd_release_memory(char* addr, size_t bytes) { |
3208 size_t size = bytes; | 3182 size_t size = bytes; |
3209 return munmap(addr, size) == 0; | 3183 return munmap(addr, size) == 0; |
3210 } | 3184 } |
3211 | 3185 |
3212 static bool solaris_mprotect(char* addr, size_t bytes, int prot) { | 3186 static bool solaris_mprotect(char* addr, size_t bytes, int prot) { |
4816 return false; | 4790 return false; |
4817 } | 4791 } |
4818 lwpSize = 16*1024; | 4792 lwpSize = 16*1024; |
4819 for (;;) { | 4793 for (;;) { |
4820 ::lseek64 (lwpFile, 0, SEEK_SET); | 4794 ::lseek64 (lwpFile, 0, SEEK_SET); |
4821 lwpArray = (prheader_t *)NEW_C_HEAP_ARRAY(char, lwpSize); | 4795 lwpArray = (prheader_t *)NEW_C_HEAP_ARRAY(char, lwpSize, mtInternal); |
4822 if (::read(lwpFile, lwpArray, lwpSize) < 0) { | 4796 if (::read(lwpFile, lwpArray, lwpSize) < 0) { |
4823 if (ThreadPriorityVerbose) warning("Error reading /proc/self/lstatus\n"); | 4797 if (ThreadPriorityVerbose) warning("Error reading /proc/self/lstatus\n"); |
4824 break; | 4798 break; |
4825 } | 4799 } |
4826 if ((lwpArray->pr_nent * lwpArray->pr_entsize) <= lwpSize) { | 4800 if ((lwpArray->pr_nent * lwpArray->pr_entsize) <= lwpSize) { |
4834 } | 4808 } |
4835 if (aslwpcount == 0) isT2 = true; | 4809 if (aslwpcount == 0) isT2 = true; |
4836 break; | 4810 break; |
4837 } | 4811 } |
4838 lwpSize = lwpArray->pr_nent * lwpArray->pr_entsize; | 4812 lwpSize = lwpArray->pr_nent * lwpArray->pr_entsize; |
4839 FREE_C_HEAP_ARRAY(char, lwpArray); // retry. | 4813 FREE_C_HEAP_ARRAY(char, lwpArray, mtInternal); // retry. |
4840 } | 4814 } |
4841 | 4815 |
4842 FREE_C_HEAP_ARRAY(char, lwpArray); | 4816 FREE_C_HEAP_ARRAY(char, lwpArray, mtInternal); |
4843 ::close (lwpFile); | 4817 ::close (lwpFile); |
4844 if (ThreadPriorityVerbose) { | 4818 if (ThreadPriorityVerbose) { |
4845 if (isT2) tty->print_cr("We are running with a T2 libthread\n"); | 4819 if (isT2) tty->print_cr("We are running with a T2 libthread\n"); |
4846 else tty->print_cr("We are not running with a T2 libthread\n"); | 4820 else tty->print_cr("We are not running with a T2 libthread\n"); |
4847 } | 4821 } |
5161 if (UseNUMA) { | 5135 if (UseNUMA) { |
5162 if (!Solaris::liblgrp_init()) { | 5136 if (!Solaris::liblgrp_init()) { |
5163 UseNUMA = false; | 5137 UseNUMA = false; |
5164 } else { | 5138 } else { |
5165 size_t lgrp_limit = os::numa_get_groups_num(); | 5139 size_t lgrp_limit = os::numa_get_groups_num(); |
5166 int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit); | 5140 int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtInternal); |
5167 size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit); | 5141 size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit); |
5168 FREE_C_HEAP_ARRAY(int, lgrp_ids); | 5142 FREE_C_HEAP_ARRAY(int, lgrp_ids, mtInternal); |
5169 if (lgrp_num < 2) { | 5143 if (lgrp_num < 2) { |
5170 // There's only one locality group, disable NUMA. | 5144 // There's only one locality group, disable NUMA. |
5171 UseNUMA = false; | 5145 UseNUMA = false; |
5172 } | 5146 } |
5173 } | 5147 } |
5509 *bytes = end - cur; | 5483 *bytes = end - cur; |
5510 return 1; | 5484 return 1; |
5511 } | 5485 } |
5512 | 5486 |
5513 // Map a block of memory. | 5487 // Map a block of memory. |
5514 char* os::map_memory(int fd, const char* file_name, size_t file_offset, | 5488 char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, |
5515 char *addr, size_t bytes, bool read_only, | 5489 char *addr, size_t bytes, bool read_only, |
5516 bool allow_exec) { | 5490 bool allow_exec) { |
5517 int prot; | 5491 int prot; |
5518 int flags; | 5492 int flags; |
5519 | 5493 |
5541 return mapped_address; | 5515 return mapped_address; |
5542 } | 5516 } |
5543 | 5517 |
5544 | 5518 |
5545 // Remap a block of memory. | 5519 // Remap a block of memory. |
5546 char* os::remap_memory(int fd, const char* file_name, size_t file_offset, | 5520 char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset, |
5547 char *addr, size_t bytes, bool read_only, | 5521 char *addr, size_t bytes, bool read_only, |
5548 bool allow_exec) { | 5522 bool allow_exec) { |
5549 // same as map_memory() on this OS | 5523 // same as map_memory() on this OS |
5550 return os::map_memory(fd, file_name, file_offset, addr, bytes, read_only, | 5524 return os::map_memory(fd, file_name, file_offset, addr, bytes, read_only, |
5551 allow_exec); | 5525 allow_exec); |
5552 } | 5526 } |
5553 | 5527 |
5554 | 5528 |
5555 // Unmap a block of memory. | 5529 // Unmap a block of memory. |
5556 bool os::unmap_memory(char* addr, size_t bytes) { | 5530 bool os::pd_unmap_memory(char* addr, size_t bytes) { |
5557 return munmap(addr, bytes) == 0; | 5531 return munmap(addr, bytes) == 0; |
5558 } | 5532 } |
5559 | 5533 |
5560 void os::pause() { | 5534 void os::pause() { |
5561 char filename[MAX_PATH]; | 5535 char filename[MAX_PATH]; |
6561 | 6535 |
6562 int os::bind(int fd, struct sockaddr* him, socklen_t len) { | 6536 int os::bind(int fd, struct sockaddr* him, socklen_t len) { |
6563 INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\ | 6537 INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\ |
6564 os::Solaris::clear_interrupted); | 6538 os::Solaris::clear_interrupted); |
6565 } | 6539 } |
6540 | |
6541 // Get the default path to the core file | |
6542 // Returns the length of the string | |
6543 int os::get_core_path(char* buffer, size_t bufferSize) { | |
6544 const char* p = get_current_directory(buffer, bufferSize); | |
6545 | |
6546 if (p == NULL) { | |
6547 assert(p != NULL, "failed to get current directory"); | |
6548 return 0; | |
6549 } | |
6550 | |
6551 return strlen(buffer); | |
6552 } |