Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/threadLocalStorage.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 | bdd155477289 |
children | b5f3a471e646 |
comparison
equal
deleted
inserted
replaced
23596:bfad3b98ecf3 | 23602:dce99debdba2 |
---|---|
36 | 36 |
37 // Get raw thread id: e.g., %g7 on sparc, fs or gs on x86 | 37 // Get raw thread id: e.g., %g7 on sparc, fs or gs on x86 |
38 extern "C" uintptr_t _raw_thread_id(); | 38 extern "C" uintptr_t _raw_thread_id(); |
39 | 39 |
40 class ThreadLocalStorage : AllStatic { | 40 class ThreadLocalStorage : AllStatic { |
41 | |
42 // Exported API | |
41 public: | 43 public: |
42 static void set_thread(Thread* thread); | 44 static void set_thread(Thread* thread); |
43 static Thread* get_thread_slow(); | 45 static Thread* get_thread_slow(); |
44 static void invalidate_all() { pd_invalidate_all(); } | 46 static void invalidate_all() { pd_invalidate_all(); } |
47 static void init(); | |
48 static bool is_initialized(); | |
45 | 49 |
46 // Machine dependent stuff | 50 // Machine dependent stuff |
47 #ifdef TARGET_OS_ARCH_linux_x86 | 51 #ifdef TARGET_OS_ARCH_linux_x86 |
48 # include "threadLS_linux_x86.hpp" | 52 # include "threadLS_linux_x86.hpp" |
49 #endif | 53 #endif |
76 #endif | 80 #endif |
77 #ifdef TARGET_OS_ARCH_bsd_zero | 81 #ifdef TARGET_OS_ARCH_bsd_zero |
78 # include "threadLS_bsd_zero.hpp" | 82 # include "threadLS_bsd_zero.hpp" |
79 #endif | 83 #endif |
80 | 84 |
81 | 85 #ifndef SOLARIS |
82 public: | 86 public: |
83 // Accessor | 87 // Accessor |
84 static inline int thread_index() { return _thread_index; } | 88 static inline int thread_index() { return _thread_index; } |
85 static inline void set_thread_index(int index) { _thread_index = index; } | 89 static inline void set_thread_index(int index) { _thread_index = index; } |
86 | |
87 // Initialization | |
88 // Called explicitly from VMThread::activate_system instead of init_globals. | |
89 static void init(); | |
90 static bool is_initialized(); | |
91 | 90 |
92 private: | 91 private: |
93 static int _thread_index; | 92 static int _thread_index; |
94 | 93 |
95 static void generate_code_for_get_thread(); | 94 static void generate_code_for_get_thread(); |
96 | 95 |
97 // Processor dependent parts of set_thread and initialization | 96 // Processor dependent parts of set_thread and initialization |
98 static void pd_set_thread(Thread* thread); | 97 static void pd_set_thread(Thread* thread); |
99 static void pd_init(); | 98 static void pd_init(); |
99 | |
100 #endif // SOLARIS | |
101 | |
100 // Invalidate any thread cacheing or optimization schemes. | 102 // Invalidate any thread cacheing or optimization schemes. |
101 static void pd_invalidate_all(); | 103 static void pd_invalidate_all(); |
102 | 104 |
103 }; | 105 }; |
104 | 106 |