Thu, 04 Apr 2013 10:01:26 -0700
8003310: Enable -Wunused-function when compiling with gcc
Summary: Add the -Wunused-function flag and remove a number of unused functions.
Reviewed-by: dholmes, coleenp, kvn
duke@435 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #include "precompiled.hpp" |
stefank@4299 | 26 | #include "runtime/thread.inline.hpp" |
stefank@2314 | 27 | #include "runtime/threadCritical.hpp" |
duke@435 | 28 | |
duke@435 | 29 | // OS-includes here |
duke@435 | 30 | #include <thread.h> |
duke@435 | 31 | #include <synch.h> |
duke@435 | 32 | |
duke@435 | 33 | // |
duke@435 | 34 | // See threadCritical.hpp for details of this class. |
duke@435 | 35 | // |
duke@435 | 36 | // For some reason, we don't do locking until the |
duke@435 | 37 | // os::init() call completes. I'm not sure why this |
duke@435 | 38 | // is, and have left it that way for now. This should |
duke@435 | 39 | // be reviewed later. |
duke@435 | 40 | |
duke@435 | 41 | static mutex_t global_mut; |
duke@435 | 42 | static thread_t global_mut_owner = -1; |
duke@435 | 43 | static int global_mut_count = 0; |
duke@435 | 44 | static bool initialized = false; |
duke@435 | 45 | |
duke@435 | 46 | ThreadCritical::ThreadCritical() { |
duke@435 | 47 | if (initialized) { |
duke@435 | 48 | thread_t owner = thr_self(); |
duke@435 | 49 | if (global_mut_owner != owner) { |
duke@435 | 50 | if (os::Solaris::mutex_lock(&global_mut)) |
jcoomes@1845 | 51 | fatal(err_msg("ThreadCritical::ThreadCritical: mutex_lock failed (%s)", |
jcoomes@1845 | 52 | strerror(errno))); |
duke@435 | 53 | assert(global_mut_count == 0, "must have clean count"); |
duke@435 | 54 | assert(global_mut_owner == -1, "must have clean owner"); |
duke@435 | 55 | } |
duke@435 | 56 | global_mut_owner = owner; |
duke@435 | 57 | ++global_mut_count; |
duke@435 | 58 | } else { |
duke@435 | 59 | assert (Threads::number_of_threads() == 0, "valid only during initialization"); |
duke@435 | 60 | } |
duke@435 | 61 | } |
duke@435 | 62 | |
duke@435 | 63 | ThreadCritical::~ThreadCritical() { |
duke@435 | 64 | if (initialized) { |
duke@435 | 65 | assert(global_mut_owner == thr_self(), "must have correct owner"); |
duke@435 | 66 | assert(global_mut_count > 0, "must have correct count"); |
duke@435 | 67 | --global_mut_count; |
duke@435 | 68 | if (global_mut_count == 0) { |
duke@435 | 69 | global_mut_owner = -1; |
duke@435 | 70 | if (os::Solaris::mutex_unlock(&global_mut)) |
jcoomes@1845 | 71 | fatal(err_msg("ThreadCritical::~ThreadCritical: mutex_unlock failed " |
jcoomes@1845 | 72 | "(%s)", strerror(errno))); |
duke@435 | 73 | } |
duke@435 | 74 | } else { |
duke@435 | 75 | assert (Threads::number_of_threads() == 0, "valid only during initialization"); |
duke@435 | 76 | } |
duke@435 | 77 | } |
duke@435 | 78 | |
duke@435 | 79 | void ThreadCritical::initialize() { |
duke@435 | 80 | // This method is called at the end of os::init(). Until |
duke@435 | 81 | // then, we don't do real locking. |
duke@435 | 82 | initialized = true; |
duke@435 | 83 | } |
duke@435 | 84 | |
duke@435 | 85 | void ThreadCritical::release() { |
duke@435 | 86 | } |