< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page

        

*** 1459,1477 **** ::exit(1); } // Die immediately, no exit hook, no abort hook, no cleanup. - // Dump a core file, if possible, for debugging. void os::die() { ! if (TestUnresponsiveErrorHandler && !CreateCoredumpOnCrash) { ! // For TimeoutInErrorHandlingTest.java, we just kill the VM ! // and don't take the time to generate a core file. ! os::signal_raise(SIGKILL); ! } else { ! ::abort(); ! } } // thread_id is kernel thread id (similar to Solaris LWP id) intx os::current_thread_id() { return os::Linux::gettid(); } int os::current_process_id() { --- 1459,1470 ---- ::exit(1); } // Die immediately, no exit hook, no abort hook, no cleanup. void os::die() { ! ::abort(); } // thread_id is kernel thread id (similar to Solaris LWP id) intx os::current_thread_id() { return os::Linux::gettid(); } int os::current_process_id() {
*** 1879,1899 **** void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) { void * result = ::dlopen(filename, RTLD_LAZY); if (result == NULL) { ! const char* error_report = ::dlerror(); ! if (error_report == NULL) { ! error_report = "dlerror returned no error description"; ! } ! if (ebuf != NULL && ebuflen > 0) { ! ::strncpy(ebuf, error_report, ebuflen-1); ! ebuf[ebuflen-1]='\0'; ! } ! Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report); ! } else { ! Events::log(NULL, "Loaded shared library %s", filename); } return result; } void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf, --- 1872,1883 ---- void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) { void * result = ::dlopen(filename, RTLD_LAZY); if (result == NULL) { ! ::strncpy(ebuf, ::dlerror(), ebuflen - 1); ! ebuf[ebuflen-1] = '\0'; } return result; } void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf,
*** 4103,4112 **** --- 4087,4101 ---- // Reserve memory at an arbitrary address, only if that area is // available (and not reserved for something else). char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) { + const int max_tries = 10; + char* base[max_tries]; + size_t size[max_tries]; + const size_t gap = 0x000000; + // Assert only that the size is a multiple of the page size, since // that's all that mmap requires, and since that's all we really know // about at this low abstraction level. If we need higher alignment, // we can either pass an alignment to this method or verify alignment // in one of the methods further up the call chain. See bug 5044738.
*** 4125,4135 **** if (addr != NULL) { // mmap() is successful but it fails to reserve at the requested address anon_munmap(addr, bytes); } ! return NULL; } // Sleep forever; naked call to OS-specific sleep; use with CAUTION void os::infinite_sleep() { while (true) { // sleep forever ... --- 4114,4167 ---- if (addr != NULL) { // mmap() is successful but it fails to reserve at the requested address anon_munmap(addr, bytes); } ! int i; ! for (i = 0; i < max_tries; ++i) { ! base[i] = reserve_memory(bytes); ! ! if (base[i] != NULL) { ! // Is this the block we wanted? ! if (base[i] == requested_addr) { ! size[i] = bytes; ! break; ! } ! ! // Does this overlap the block we wanted? Give back the overlapped ! // parts and try again. ! ! ptrdiff_t top_overlap = requested_addr + (bytes + gap) - base[i]; ! if (top_overlap >= 0 && (size_t)top_overlap < bytes) { ! unmap_memory(base[i], top_overlap); ! base[i] += top_overlap; ! size[i] = bytes - top_overlap; ! } else { ! ptrdiff_t bottom_overlap = base[i] + bytes - requested_addr; ! if (bottom_overlap >= 0 && (size_t)bottom_overlap < bytes) { ! unmap_memory(requested_addr, bottom_overlap); ! size[i] = bytes - bottom_overlap; ! } else { ! size[i] = bytes; ! } ! } ! } ! } ! ! // Give back the unused reserved pieces. ! ! for (int j = 0; j < i; ++j) { ! if (base[j] != NULL) { ! unmap_memory(base[j], size[j]); ! } ! } ! ! if (i < max_tries) { ! return requested_addr; ! } else { ! return NULL; ! } } // Sleep forever; naked call to OS-specific sleep; use with CAUTION void os::infinite_sleep() { while (true) { // sleep forever ...
< prev index next >