equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
51 // don't use specialized code if +UseMallocOnly -- may confuse Purify et al. |
51 // don't use specialized code if +UseMallocOnly -- may confuse Purify et al. |
52 debug_only(if (UseMallocOnly) return get_thread_slow();); |
52 debug_only(if (UseMallocOnly) return get_thread_slow();); |
53 |
53 |
54 uintptr_t raw = pd_raw_thread_id(); |
54 uintptr_t raw = pd_raw_thread_id(); |
55 int ix = pd_cache_index(raw); |
55 int ix = pd_cache_index(raw); |
56 Thread *Candidate = ThreadLocalStorage::_get_thread_cache[ix]; |
56 Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix]; |
57 if (Candidate->_self_raw_id == raw) { |
57 if (candidate->self_raw_id() == raw) { |
58 // hit |
58 // hit |
59 return Candidate; |
59 return candidate; |
60 } else { |
60 } else { |
61 return ThreadLocalStorage::get_thread_via_cache_slowly(raw, ix); |
61 return ThreadLocalStorage::get_thread_via_cache_slowly(raw, ix); |
62 } |
62 } |
63 } |
63 } |
64 |
64 |