Tue, 18 Jun 2013 12:31:07 -0700
8015237: Parallelize string table scanning during strong root processing
Summary: Parallelize the scanning of the intern string table by having each GC worker claim a given number of buckets. Changes were also reviewed by Per Liden <per.liden@oracle.com>.
Reviewed-by: tschatzl, stefank, twisti
1 /*
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
25 #ifndef SHARE_VM_CI_CICONSTANT_HPP
26 #define SHARE_VM_CI_CICONSTANT_HPP
28 #include "ci/ciClassList.hpp"
29 #include "ci/ciNullObject.hpp"
31 // ciConstant
32 //
33 // This class represents a constant value.
34 class ciConstant VALUE_OBJ_CLASS_SPEC {
35 friend class VMStructs;
36 private:
37 friend class ciEnv;
38 friend class ciField;
40 BasicType _type;
41 union {
42 jint _int;
43 jlong _long;
44 jint _long_half[2];
45 jfloat _float;
46 jdouble _double;
47 ciObject* _object;
48 } _value;
50 public:
52 ciConstant() {
53 _type = T_ILLEGAL; _value._long = -1;
54 }
55 ciConstant(BasicType type, jint value) {
56 assert(type != T_LONG && type != T_DOUBLE && type != T_FLOAT,
57 "using the wrong ciConstant constructor");
58 _type = type; _value._int = value;
59 }
60 ciConstant(jlong value) {
61 _type = T_LONG; _value._long = value;
62 }
63 ciConstant(jfloat value) {
64 _type = T_FLOAT; _value._float = value;
65 }
66 ciConstant(jdouble value) {
67 _type = T_DOUBLE; _value._double = value;
68 }
69 ciConstant(BasicType type, ciObject* p) {
70 _type = type; _value._object = p;
71 }
73 BasicType basic_type() const { return _type; }
75 jboolean as_boolean() {
76 assert(basic_type() == T_BOOLEAN, "wrong type");
77 return (jboolean)_value._int;
78 }
79 jchar as_char() {
80 assert(basic_type() == T_CHAR, "wrong type");
81 return (jchar)_value._int;
82 }
83 jbyte as_byte() {
84 assert(basic_type() == T_BYTE, "wrong type");
85 return (jbyte)_value._int;
86 }
87 jshort as_short() {
88 assert(basic_type() == T_SHORT, "wrong type");
89 return (jshort)_value._int;
90 }
91 jint as_int() {
92 assert(basic_type() == T_BOOLEAN || basic_type() == T_CHAR ||
93 basic_type() == T_BYTE || basic_type() == T_SHORT ||
94 basic_type() == T_INT, "wrong type");
95 return _value._int;
96 }
97 jlong as_long() {
98 assert(basic_type() == T_LONG, "wrong type");
99 return _value._long;
100 }
101 jfloat as_float() {
102 assert(basic_type() == T_FLOAT, "wrong type");
103 return _value._float;
104 }
105 jdouble as_double() {
106 assert(basic_type() == T_DOUBLE, "wrong type");
107 return _value._double;
108 }
109 ciObject* as_object() const {
110 assert(basic_type() == T_OBJECT || basic_type() == T_ARRAY, "wrong type");
111 return _value._object;
112 }
114 // Debugging output
115 void print();
116 };
118 #endif // SHARE_VM_CI_CICONSTANT_HPP