7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "runtime/interfaceSupport.inline.hpp"
28 #include "runtime/thread.hpp"
29 #include "runtime/threadSMR.hpp"
30 #include "runtime/timerTrace.hpp"
31 #include "services/threadIdTable.hpp"
32 #include "utilities/concurrentHashTable.inline.hpp"
33 #include "utilities/concurrentHashTableTasks.inline.hpp"
34
35
36 typedef ConcurrentHashTable<ThreadIdTableConfig, mtInternal> ThreadIdTableHash;
37
38 // 2^24 is max size
39 static const size_t END_SIZE = 24;
40 // Default initial size 256
41 static const size_t DEFAULT_TABLE_SIZE_LOG = 8;
42 // Prefer short chains of avg 2
43 static const double PREF_AVG_LIST_LEN = 2.0;
44 static ThreadIdTableHash* volatile _local_table = NULL;
45 static volatile size_t _current_size = 0;
46 static volatile size_t _items_count = 0;
47
48 volatile bool ThreadIdTable::_is_initialized = false;
49 volatile bool ThreadIdTable::_has_work = false;
50
51 class ThreadIdTableEntry : public CHeapObj<mtInternal> {
52 private:
53 jlong _tid;
54 JavaThread* _java_thread;
|
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "runtime/atomic.hpp"
28 #include "runtime/interfaceSupport.inline.hpp"
29 #include "runtime/thread.hpp"
30 #include "runtime/threadSMR.hpp"
31 #include "runtime/timerTrace.hpp"
32 #include "services/threadIdTable.hpp"
33 #include "utilities/concurrentHashTable.inline.hpp"
34 #include "utilities/concurrentHashTableTasks.inline.hpp"
35
36 typedef ConcurrentHashTable<ThreadIdTableConfig, mtInternal> ThreadIdTableHash;
37
38 // 2^24 is max size
39 static const size_t END_SIZE = 24;
40 // Default initial size 256
41 static const size_t DEFAULT_TABLE_SIZE_LOG = 8;
42 // Prefer short chains of avg 2
43 static const double PREF_AVG_LIST_LEN = 2.0;
44 static ThreadIdTableHash* volatile _local_table = NULL;
45 static volatile size_t _current_size = 0;
46 static volatile size_t _items_count = 0;
47
48 volatile bool ThreadIdTable::_is_initialized = false;
49 volatile bool ThreadIdTable::_has_work = false;
50
51 class ThreadIdTableEntry : public CHeapObj<mtInternal> {
52 private:
53 jlong _tid;
54 JavaThread* _java_thread;
|