Mercurial > hg > truffle
annotate src/os_cpu/solaris_sparc/vm/threadLS_solaris_sparc.hpp @ 16425:8eec87d7bfc4
made Factory.newClassLoader() private
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 08 Jul 2014 21:23:22 +0200 |
parents | f95d63e2154a |
children |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef OS_CPU_SOLARIS_SPARC_VM_THREADLS_SOLARIS_SPARC_HPP |
26 #define OS_CPU_SOLARIS_SPARC_VM_THREADLS_SOLARIS_SPARC_HPP | |
27 | |
0 | 28 public: |
29 // Java Thread - force inlining | |
30 static inline Thread* thread() ; | |
31 | |
32 private: | |
33 static Thread* _get_thread_cache[]; // index by [(raw_id>>9)^(raw_id>>20) % _pd_cache_size] | |
34 static Thread* get_thread_via_cache_slowly(uintptr_t raw_id, int index); | |
35 | |
36 NOT_PRODUCT(static int _tcacheHit;) | |
37 NOT_PRODUCT(static int _tcacheMiss;) | |
38 | |
39 public: | |
40 | |
41 // Print cache hit/miss statistics | |
42 static void print_statistics() PRODUCT_RETURN; | |
43 | |
44 enum Constants { | |
45 _pd_cache_size = 256*2 // projected typical # of threads * 2 | |
46 }; | |
47 | |
48 static void set_thread_in_slot (Thread *) ; | |
49 | |
50 static uintptr_t pd_raw_thread_id() { | |
51 return _raw_thread_id(); | |
52 } | |
53 | |
54 static int pd_cache_index(uintptr_t raw_id) { | |
55 // Hash function: From email from Dave: | |
56 // The hash function deserves an explanation. %g7 points to libthread's | |
57 // "thread" structure. On T1 the thread structure is allocated on the | |
58 // user's stack (yes, really!) so the ">>20" handles T1 where the JVM's | |
59 // stack size is usually >= 1Mb. The ">>9" is for T2 where Roger allocates | |
60 // globs of thread blocks contiguously. The "9" has to do with the | |
61 // expected size of the T2 thread structure. If these constants are wrong | |
62 // the worst thing that'll happen is that the hit rate for heavily threaded | |
63 // apps won't be as good as it could be. If you want to burn another | |
64 // shift+xor you could mix together _all of the %g7 bits to form the hash, | |
65 // but I think that's excessive. Making the change above changed the | |
66 // T$ miss rate on SpecJBB (on a 16X system) from about 3% to imperceptible. | |
67 uintptr_t ix = (int) (((raw_id >> 9) ^ (raw_id >> 20)) % _pd_cache_size); | |
68 return ix; | |
69 } | |
1972 | 70 |
71 #endif // OS_CPU_SOLARIS_SPARC_VM_THREADLS_SOLARIS_SPARC_HPP |