src/os/solaris/vm/thread_solaris.inline.hpp

Wed, 27 Mar 2013 19:21:18 +0100

author
tschatzl
date
Wed, 27 Mar 2013 19:21:18 +0100
changeset 4854
754c24457b20
parent 4299
f34d701e952e
child 6876
710a3c8b516e
child 6911
ce8f6bb717c9
permissions
-rw-r--r--

7112912: Message "Error occurred during initialization of VM" on boxes with lots of RAM
Summary: Ergonomics now also takes available virtual memory into account when deciding for a heap size. The helper method to determine the maximum allocatable memory block now uses the appropriate OS specific calls to retrieve available virtual memory for the java process. In 32 bit environments this method now also searches for the maximum actually reservable amount of memory. Merge previously separate implementations for Linux/BSD/Solaris into a single method.
Reviewed-by: jmasa, tamao

duke@435 1 /*
phh@2423 2 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP
stefank@2314 26 #define OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP
stefank@2314 27
stefank@4299 28 #ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
stefank@4299 29 #error "This file should only be included from thread.inline.hpp"
stefank@4299 30 #endif
stefank@4299 31
stefank@2314 32 #include "runtime/atomic.hpp"
stefank@2314 33 #include "runtime/prefetch.hpp"
stefank@2314 34 #include "runtime/thread.hpp"
stefank@2314 35 #include "runtime/threadLocalStorage.hpp"
stefank@2314 36 #ifdef TARGET_OS_ARCH_solaris_x86
stefank@2314 37 # include "atomic_solaris_x86.inline.hpp"
stefank@2314 38 # include "orderAccess_solaris_x86.inline.hpp"
stefank@2314 39 # include "prefetch_solaris_x86.inline.hpp"
stefank@2314 40 #endif
stefank@2314 41 #ifdef TARGET_OS_ARCH_solaris_sparc
stefank@2314 42 # include "atomic_solaris_sparc.inline.hpp"
stefank@2314 43 # include "orderAccess_solaris_sparc.inline.hpp"
stefank@2314 44 # include "prefetch_solaris_sparc.inline.hpp"
stefank@2314 45 #endif
stefank@2314 46
duke@435 47 // Thread::current is "hot" it's called > 128K times in the 1st 500 msecs of
duke@435 48 // startup.
duke@435 49 // ThreadLocalStorage::thread is warm -- it's called > 16K times in the same
duke@435 50 // period. Thread::current() now calls ThreadLocalStorage::thread() directly.
duke@435 51 // For SPARC, to avoid excessive register window spill-fill faults,
duke@435 52 // we aggressively inline these routines.
duke@435 53
duke@435 54 inline Thread* ThreadLocalStorage::thread() {
duke@435 55 // don't use specialized code if +UseMallocOnly -- may confuse Purify et al.
duke@435 56 debug_only(if (UseMallocOnly) return get_thread_slow(););
duke@435 57
duke@435 58 uintptr_t raw = pd_raw_thread_id();
duke@435 59 int ix = pd_cache_index(raw);
phh@2423 60 Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix];
phh@2423 61 if (candidate->self_raw_id() == raw) {
duke@435 62 // hit
phh@2423 63 return candidate;
duke@435 64 } else {
duke@435 65 return ThreadLocalStorage::get_thread_via_cache_slowly(raw, ix);
duke@435 66 }
duke@435 67 }
stefank@2314 68
stefank@2314 69 #endif // OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP

mercurial