annotate src/share/vm/ci/ciConstant.hpp @ 20543:e7d0505c8a30

8059758: Footprint regressions with JDK-8038423 Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything. Reviewed-by: jwilhelm, brutisso
author tschatzl
date Fri, 10 Oct 2014 15:51:58 +0200
parents 55fb97c4c58d
children 4ca6dc0799b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17467
55fb97c4c58d 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 12190
diff changeset
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_CI_CICONSTANT_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_CI_CICONSTANT_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "ci/ciClassList.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "ci/ciNullObject.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30
0
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // ciConstant
a61af66fc99e Initial load
duke
parents:
diff changeset
32 //
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // This class represents a constant value.
a61af66fc99e Initial load
duke
parents:
diff changeset
34 class ciConstant VALUE_OBJ_CLASS_SPEC {
3939
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents: 3899
diff changeset
35 friend class VMStructs;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
36 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
37 friend class ciEnv;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 friend class ciField;
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 BasicType _type;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 union {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 jint _int;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 jlong _long;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 jfloat _float;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 jdouble _double;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 ciObject* _object;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 } _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 ciConstant() {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 _type = T_ILLEGAL; _value._long = -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 }
a61af66fc99e Initial load
duke
parents:
diff changeset
54 ciConstant(BasicType type, jint value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 assert(type != T_LONG && type != T_DOUBLE && type != T_FLOAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
56 "using the wrong ciConstant constructor");
a61af66fc99e Initial load
duke
parents:
diff changeset
57 _type = type; _value._int = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 }
a61af66fc99e Initial load
duke
parents:
diff changeset
59 ciConstant(jlong value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
60 _type = T_LONG; _value._long = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 }
a61af66fc99e Initial load
duke
parents:
diff changeset
62 ciConstant(jfloat value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 _type = T_FLOAT; _value._float = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 ciConstant(jdouble value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
66 _type = T_DOUBLE; _value._double = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 }
a61af66fc99e Initial load
duke
parents:
diff changeset
68 ciConstant(BasicType type, ciObject* p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
69 _type = type; _value._object = p;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 BasicType basic_type() const { return _type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 jboolean as_boolean() {
a61af66fc99e Initial load
duke
parents:
diff changeset
75 assert(basic_type() == T_BOOLEAN, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
76 return (jboolean)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
77 }
a61af66fc99e Initial load
duke
parents:
diff changeset
78 jchar as_char() {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 assert(basic_type() == T_CHAR, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
80 return (jchar)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82 jbyte as_byte() {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 assert(basic_type() == T_BYTE, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
84 return (jbyte)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
85 }
a61af66fc99e Initial load
duke
parents:
diff changeset
86 jshort as_short() {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 assert(basic_type() == T_SHORT, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
88 return (jshort)_value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 }
a61af66fc99e Initial load
duke
parents:
diff changeset
90 jint as_int() {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 assert(basic_type() == T_BOOLEAN || basic_type() == T_CHAR ||
a61af66fc99e Initial load
duke
parents:
diff changeset
92 basic_type() == T_BYTE || basic_type() == T_SHORT ||
a61af66fc99e Initial load
duke
parents:
diff changeset
93 basic_type() == T_INT, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
94 return _value._int;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96 jlong as_long() {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 assert(basic_type() == T_LONG, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
98 return _value._long;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 jfloat as_float() {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 assert(basic_type() == T_FLOAT, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
102 return _value._float;
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104 jdouble as_double() {
a61af66fc99e Initial load
duke
parents:
diff changeset
105 assert(basic_type() == T_DOUBLE, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
106 return _value._double;
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 ciObject* as_object() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 assert(basic_type() == T_OBJECT || basic_type() == T_ARRAY, "wrong type");
a61af66fc99e Initial load
duke
parents:
diff changeset
110 return _value._object;
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
12190
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
113 bool is_null_or_zero() const {
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
114 if (!is_java_primitive(basic_type())) {
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
115 return as_object()->is_null_object();
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
116 } else if (type2size[basic_type()] == 1) {
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
117 // treat float bits as int, to avoid comparison with -0 and NaN
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
118 return (_value._int == 0);
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
119 } else if (type2size[basic_type()] == 2) {
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
120 // treat double bits as long, to avoid comparison with -0 and NaN
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
121 return (_value._long == 0);
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
122 } else {
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
123 return false;
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
124 }
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
125 }
edb5ab0f3fe5 8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents: 3939
diff changeset
126
0
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // Debugging output
a61af66fc99e Initial load
duke
parents:
diff changeset
128 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
129 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
130
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
131 #endif // SHARE_VM_CI_CICONSTANT_HPP