annotate src/share/vm/runtime/threadLocalStorage.cpp @ 340:9ee9cf798b59

6754988: Update copyright year Summary: Update for files that have been modified starting July 2008 Reviewed-by: ohair, tbell
author xdono
date Thu, 02 Oct 2008 19:58:19 -0700
parents d95b224e9f17
children c18cbe5936b8
rev   line source
duke@0 1 /*
xdono@340 2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
duke@0 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 * have any questions.
duke@0 22 *
duke@0 23 */
duke@0 24
duke@0 25 # include "incls/_precompiled.incl"
duke@0 26 # include "incls/_threadLocalStorage.cpp.incl"
duke@0 27
duke@0 28 // static member initialization
duke@0 29 int ThreadLocalStorage::_thread_index = -1;
duke@0 30
duke@0 31 Thread* ThreadLocalStorage::get_thread_slow() {
duke@0 32 return (Thread*) os::thread_local_storage_at(ThreadLocalStorage::thread_index());
duke@0 33 }
duke@0 34
duke@0 35 void ThreadLocalStorage::set_thread(Thread* thread) {
duke@0 36 pd_set_thread(thread);
duke@0 37
duke@0 38 // The following ensure that any optimization tricks we have tried
duke@0 39 // did not backfire on us:
duke@0 40 guarantee(get_thread() == thread, "must be the same thread, quickly");
duke@0 41 guarantee(get_thread_slow() == thread, "must be the same thread, slowly");
duke@0 42 }
duke@0 43
duke@0 44 void ThreadLocalStorage::init() {
kamg@245 45 assert(!is_initialized(),
kamg@245 46 "More than one attempt to initialize threadLocalStorage");
duke@0 47 pd_init();
duke@0 48 set_thread_index(os::allocate_thread_local_storage());
duke@0 49 generate_code_for_get_thread();
duke@0 50 }
kamg@245 51
kamg@245 52 bool ThreadLocalStorage::is_initialized() {
kamg@245 53 return (thread_index() != -1);
kamg@245 54 }