Mercurial > hg > graal-jvmci-8
diff src/os/solaris/vm/thread_solaris.inline.hpp @ 23602:dce99debdba2 jdk8u66-b36
8130212: Thread::current() might access freed memory on Solaris
Reviewed-by: kvn, twisti, stuefe
author | dholmes |
---|---|
date | Mon, 07 Dec 2015 13:25:13 +0100 |
parents | c49dcaf78a65 |
children | b5f3a471e646 |
line wrap: on
line diff
--- a/src/os/solaris/vm/thread_solaris.inline.hpp Thu Dec 03 10:31:10 2015 -0800 +++ b/src/os/solaris/vm/thread_solaris.inline.hpp Mon Dec 07 13:25:13 2015 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,19 +40,12 @@ // For SPARC, to avoid excessive register window spill-fill faults, // we aggressively inline these routines. -inline Thread* ThreadLocalStorage::thread() { - // don't use specialized code if +UseMallocOnly -- may confuse Purify et al. - debug_only(if (UseMallocOnly) return get_thread_slow();); +inline void ThreadLocalStorage::set_thread(Thread* thread) { + _thr_current = thread; +} - uintptr_t raw = pd_raw_thread_id(); - int ix = pd_cache_index(raw); - Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix]; - if (candidate->self_raw_id() == raw) { - // hit - return candidate; - } else { - return ThreadLocalStorage::get_thread_via_cache_slowly(raw, ix); - } +inline Thread* ThreadLocalStorage::thread() { + return _thr_current; } #endif // OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP