0N/A/*
2273N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_RUNTIME_THREADLOCALSTORAGE_HPP
1879N/A#define SHARE_VM_RUNTIME_THREADLOCALSTORAGE_HPP
1879N/A
1879N/A#include "gc_implementation/shared/gcUtil.hpp"
1879N/A#include "runtime/os.hpp"
1879N/A#include "utilities/top.hpp"
1879N/A
0N/A// Interface for thread local storage
0N/A
0N/A// Fast variant of ThreadLocalStorage::get_thread_slow
0N/Aextern "C" Thread* get_thread();
0N/A
0N/A// Get raw thread id: e.g., %g7 on sparc, fs or gs on x86
0N/Aextern "C" uintptr_t _raw_thread_id();
0N/A
0N/Aclass ThreadLocalStorage : AllStatic {
0N/A public:
0N/A static void set_thread(Thread* thread);
0N/A static Thread* get_thread_slow();
0N/A static void invalidate_all() { pd_invalidate_all(); }
0N/A
0N/A // Machine dependent stuff
1879N/A#ifdef TARGET_OS_ARCH_linux_x86
1879N/A# include "threadLS_linux_x86.hpp"
1879N/A#endif
1879N/A#ifdef TARGET_OS_ARCH_linux_sparc
1879N/A# include "threadLS_linux_sparc.hpp"
1879N/A#endif
1879N/A#ifdef TARGET_OS_ARCH_linux_zero
1879N/A# include "threadLS_linux_zero.hpp"
1879N/A#endif
1879N/A#ifdef TARGET_OS_ARCH_solaris_x86
1879N/A# include "threadLS_solaris_x86.hpp"
1879N/A#endif
1879N/A#ifdef TARGET_OS_ARCH_solaris_sparc
1879N/A# include "threadLS_solaris_sparc.hpp"
1879N/A#endif
1879N/A#ifdef TARGET_OS_ARCH_windows_x86
1879N/A# include "threadLS_windows_x86.hpp"
1879N/A#endif
2073N/A#ifdef TARGET_OS_ARCH_linux_arm
2073N/A# include "threadLS_linux_arm.hpp"
2073N/A#endif
2073N/A#ifdef TARGET_OS_ARCH_linux_ppc
2073N/A# include "threadLS_linux_ppc.hpp"
2073N/A#endif
2796N/A#ifdef TARGET_OS_ARCH_bsd_x86
2796N/A# include "threadLS_bsd_x86.hpp"
2796N/A#endif
2796N/A#ifdef TARGET_OS_ARCH_bsd_zero
2796N/A# include "threadLS_bsd_zero.hpp"
2796N/A#endif
1879N/A
0N/A
0N/A public:
0N/A // Accessor
0N/A static inline int thread_index() { return _thread_index; }
0N/A static inline void set_thread_index(int index) { _thread_index = index; }
0N/A
0N/A // Initialization
0N/A // Called explicitly from VMThread::activate_system instead of init_globals.
0N/A static void init();
242N/A static bool is_initialized();
0N/A
0N/A private:
0N/A static int _thread_index;
0N/A
0N/A static void generate_code_for_get_thread();
0N/A
0N/A // Processor dependent parts of set_thread and initialization
0N/A static void pd_set_thread(Thread* thread);
0N/A static void pd_init();
0N/A // Invalidate any thread cacheing or optimization schemes.
0N/A static void pd_invalidate_all();
0N/A
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_RUNTIME_THREADLOCALSTORAGE_HPP