annotate src/share/vm/c1/c1_ValueType.cpp @ 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 8a02ca5e5576
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
2 * Copyright (c) 1999, 2012, 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: 989
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 989
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: 989
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: 1584
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
26 #include "c1/c1_ValueType.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
27 #include "ci/ciArray.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
28 #include "ci/ciInstance.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
29 #include "ci/ciNullObject.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // predefined types
a61af66fc99e Initial load
duke
parents:
diff changeset
33 VoidType* voidType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 IntType* intType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 LongType* longType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 FloatType* floatType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 DoubleType* doubleType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 ObjectType* objectType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 ArrayType* arrayType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 InstanceType* instanceType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 ClassType* classType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 AddressType* addressType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 IllegalType* illegalType = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // predefined constants
a61af66fc99e Initial load
duke
parents:
diff changeset
47 IntConstant* intZero = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 IntConstant* intOne = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 ObjectConstant* objectNull = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
52 void ValueType::initialize(Arena* arena) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // Note: Must initialize all types for each compilation
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // as they are allocated within a ResourceMark!
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // types
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
57 voidType = new (arena) VoidType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
58 intType = new (arena) IntType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
59 longType = new (arena) LongType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
60 floatType = new (arena) FloatType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
61 doubleType = new (arena) DoubleType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
62 objectType = new (arena) ObjectType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
63 arrayType = new (arena) ArrayType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
64 instanceType = new (arena) InstanceType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
65 classType = new (arena) ClassType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
66 addressType = new (arena) AddressType();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
67 illegalType = new (arena) IllegalType();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
68
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
69 intZero = new (arena) IntConstant(0);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
70 intOne = new (arena) IntConstant(1);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
71 objectNull = new (arena) ObjectConstant(ciNullObject::make());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
72 };
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 ValueType* ValueType::meet(ValueType* y) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // incomplete & conservative solution for now - fix this!
a61af66fc99e Initial load
duke
parents:
diff changeset
77 assert(tag() == y->tag(), "types must match");
a61af66fc99e Initial load
duke
parents:
diff changeset
78 return base();
a61af66fc99e Initial load
duke
parents:
diff changeset
79 }
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 ValueType* ValueType::join(ValueType* y) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 Unimplemented();
a61af66fc99e Initial load
duke
parents:
diff changeset
84 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
85 }
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
88 ciType* ObjectConstant::exact_type() const {
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
89 ciObject* c = constant_value();
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
90 return (c != NULL && !c->is_null_object()) ? c->klass() : NULL;
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
91 }
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
92 ciType* ArrayConstant::exact_type() const {
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
93 ciObject* c = constant_value();
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
94 return (c != NULL && !c->is_null_object()) ? c->klass() : NULL;
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
95 }
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
96 ciType* InstanceConstant::exact_type() const {
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
97 ciObject* c = constant_value();
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
98 return (c != NULL && !c->is_null_object()) ? c->klass() : NULL;
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
99 }
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
100 ciType* ClassConstant::exact_type() const {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
101 return Compilation::current()->env()->Class_klass();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
102 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
103
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
104
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
105 jobject ObjectType::encoding() const {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
106 assert(is_constant(), "must be");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
107 return constant_value()->constant_encoding();
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
108 }
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 1972
diff changeset
109
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
110 bool ObjectType::is_loaded() const {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
111 assert(is_constant(), "must be");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
112 return constant_value()->is_loaded();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
113 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
114
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
115 bool MetadataType::is_loaded() const {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
116 assert(is_constant(), "must be");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
117 return constant_value()->is_loaded();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
118 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
119
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
120 ciObject* ObjectConstant::constant_value() const { return _value; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
121 ciObject* ArrayConstant::constant_value() const { return _value; }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
122 ciObject* InstanceConstant::constant_value() const { return _value; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 ValueType* as_ValueType(BasicType type) {
a61af66fc99e Initial load
duke
parents:
diff changeset
125 switch (type) {
a61af66fc99e Initial load
duke
parents:
diff changeset
126 case T_VOID : return voidType;
a61af66fc99e Initial load
duke
parents:
diff changeset
127 case T_BYTE : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
128 case T_CHAR : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
129 case T_SHORT : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
130 case T_BOOLEAN: // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
131 case T_INT : return intType;
a61af66fc99e Initial load
duke
parents:
diff changeset
132 case T_LONG : return longType;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 case T_FLOAT : return floatType;
a61af66fc99e Initial load
duke
parents:
diff changeset
134 case T_DOUBLE : return doubleType;
a61af66fc99e Initial load
duke
parents:
diff changeset
135 case T_ARRAY : return arrayType;
a61af66fc99e Initial load
duke
parents:
diff changeset
136 case T_OBJECT : return objectType;
a61af66fc99e Initial load
duke
parents:
diff changeset
137 case T_ADDRESS: return addressType;
a61af66fc99e Initial load
duke
parents:
diff changeset
138 case T_ILLEGAL: return illegalType;
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
141 return illegalType;
a61af66fc99e Initial load
duke
parents:
diff changeset
142 }
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 ValueType* as_ValueType(ciConstant value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
146 switch (value.basic_type()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
147 case T_BYTE : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
148 case T_CHAR : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
149 case T_SHORT : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
150 case T_BOOLEAN: // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
151 case T_INT : return new IntConstant (value.as_int ());
a61af66fc99e Initial load
duke
parents:
diff changeset
152 case T_LONG : return new LongConstant (value.as_long ());
a61af66fc99e Initial load
duke
parents:
diff changeset
153 case T_FLOAT : return new FloatConstant (value.as_float ());
a61af66fc99e Initial load
duke
parents:
diff changeset
154 case T_DOUBLE : return new DoubleConstant(value.as_double());
a61af66fc99e Initial load
duke
parents:
diff changeset
155 case T_ARRAY : // fall through (ciConstant doesn't have an array accessor)
a61af66fc99e Initial load
duke
parents:
diff changeset
156 case T_OBJECT : return new ObjectConstant(value.as_object());
a61af66fc99e Initial load
duke
parents:
diff changeset
157 }
a61af66fc99e Initial load
duke
parents:
diff changeset
158 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
159 return illegalType;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 BasicType as_BasicType(ValueType* type) {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 switch (type->tag()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
165 case voidTag: return T_VOID;
a61af66fc99e Initial load
duke
parents:
diff changeset
166 case intTag: return T_INT;
a61af66fc99e Initial load
duke
parents:
diff changeset
167 case longTag: return T_LONG;
a61af66fc99e Initial load
duke
parents:
diff changeset
168 case floatTag: return T_FLOAT;
a61af66fc99e Initial load
duke
parents:
diff changeset
169 case doubleTag: return T_DOUBLE;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 case objectTag: return T_OBJECT;
6739
8a02ca5e5576 7195816: NPG: Crash in c1_ValueType - ShouldNotReachHere
roland
parents: 6725
diff changeset
171 case metaDataTag:return T_METADATA;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
172 case addressTag: return T_ADDRESS;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 case illegalTag: return T_ILLEGAL;
a61af66fc99e Initial load
duke
parents:
diff changeset
174 }
a61af66fc99e Initial load
duke
parents:
diff changeset
175 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
176 return T_ILLEGAL;
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }