1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
139 logAliasCacheSize = 6, |
139 logAliasCacheSize = 6, |
140 AliasCacheSize = (1<<logAliasCacheSize) |
140 AliasCacheSize = (1<<logAliasCacheSize) |
141 }; |
141 }; |
142 struct AliasCacheEntry { const TypePtr* _adr_type; int _index; }; // simple duple type |
142 struct AliasCacheEntry { const TypePtr* _adr_type; int _index; }; // simple duple type |
143 enum { |
143 enum { |
144 trapHistLength = methodDataOopDesc::_trap_hist_limit |
144 trapHistLength = MethodData::_trap_hist_limit |
145 }; |
145 }; |
146 |
146 |
147 // Constant entry of the constant table. |
147 // Constant entry of the constant table. |
148 class Constant { |
148 class Constant { |
149 private: |
149 private: |
150 BasicType _type; |
150 BasicType _type; |
|
151 union { |
151 jvalue _value; |
152 jvalue _value; |
|
153 Metadata* _metadata; |
|
154 } _v; |
152 int _offset; // offset of this constant (in bytes) relative to the constant table base. |
155 int _offset; // offset of this constant (in bytes) relative to the constant table base. |
153 float _freq; |
156 float _freq; |
154 bool _can_be_reused; // true (default) if the value can be shared with other users. |
157 bool _can_be_reused; // true (default) if the value can be shared with other users. |
155 |
158 |
156 public: |
159 public: |
157 Constant() : _type(T_ILLEGAL), _offset(-1), _freq(0.0f), _can_be_reused(true) { _value.l = 0; } |
160 Constant() : _type(T_ILLEGAL), _offset(-1), _freq(0.0f), _can_be_reused(true) { _v._value.l = 0; } |
158 Constant(BasicType type, jvalue value, float freq = 0.0f, bool can_be_reused = true) : |
161 Constant(BasicType type, jvalue value, float freq = 0.0f, bool can_be_reused = true) : |
159 _type(type), |
162 _type(type), |
160 _value(value), |
|
161 _offset(-1), |
163 _offset(-1), |
162 _freq(freq), |
164 _freq(freq), |
163 _can_be_reused(can_be_reused) |
165 _can_be_reused(can_be_reused) |
164 {} |
166 { |
|
167 assert(type != T_METADATA, "wrong constructor"); |
|
168 _v._value = value; |
|
169 } |
|
170 Constant(Metadata* metadata, bool can_be_reused = true) : |
|
171 _type(T_METADATA), |
|
172 _offset(-1), |
|
173 _freq(0.0f), |
|
174 _can_be_reused(can_be_reused) |
|
175 { |
|
176 _v._metadata = metadata; |
|
177 } |
165 |
178 |
166 bool operator==(const Constant& other); |
179 bool operator==(const Constant& other); |
167 |
180 |
168 BasicType type() const { return _type; } |
181 BasicType type() const { return _type; } |
169 |
182 |
170 jlong get_jlong() const { return _value.j; } |
183 jlong get_jlong() const { return _v._value.j; } |
171 jfloat get_jfloat() const { return _value.f; } |
184 jfloat get_jfloat() const { return _v._value.f; } |
172 jdouble get_jdouble() const { return _value.d; } |
185 jdouble get_jdouble() const { return _v._value.d; } |
173 jobject get_jobject() const { return _value.l; } |
186 jobject get_jobject() const { return _v._value.l; } |
|
187 |
|
188 Metadata* get_metadata() const { return _v._metadata; } |
174 |
189 |
175 int offset() const { return _offset; } |
190 int offset() const { return _offset; } |
176 void set_offset(int offset) { _offset = offset; } |
191 void set_offset(int offset) { _offset = offset; } |
177 |
192 |
178 float freq() const { return _freq; } |
193 float freq() const { return _freq; } |
217 void calculate_offsets_and_size(); |
232 void calculate_offsets_and_size(); |
218 int find_offset(Constant& con) const; |
233 int find_offset(Constant& con) const; |
219 |
234 |
220 void add(Constant& con); |
235 void add(Constant& con); |
221 Constant add(MachConstantNode* n, BasicType type, jvalue value); |
236 Constant add(MachConstantNode* n, BasicType type, jvalue value); |
|
237 Constant add(Metadata* metadata); |
222 Constant add(MachConstantNode* n, MachOper* oper); |
238 Constant add(MachConstantNode* n, MachOper* oper); |
223 Constant add(MachConstantNode* n, jfloat f) { |
239 Constant add(MachConstantNode* n, jfloat f) { |
224 jvalue value; value.f = f; |
240 jvalue value; value.f = f; |
225 return add(n, T_FLOAT, value); |
241 return add(n, T_FLOAT, value); |
226 } |
242 } |
268 uint _decompile_count; // Cumulative decompilation counts. |
284 uint _decompile_count; // Cumulative decompilation counts. |
269 bool _do_inlining; // True if we intend to do inlining |
285 bool _do_inlining; // True if we intend to do inlining |
270 bool _do_scheduling; // True if we intend to do scheduling |
286 bool _do_scheduling; // True if we intend to do scheduling |
271 bool _do_freq_based_layout; // True if we intend to do frequency based block layout |
287 bool _do_freq_based_layout; // True if we intend to do frequency based block layout |
272 bool _do_count_invocations; // True if we generate code to count invocations |
288 bool _do_count_invocations; // True if we generate code to count invocations |
273 bool _do_method_data_update; // True if we generate code to update methodDataOops |
289 bool _do_method_data_update; // True if we generate code to update MethodData*s |
274 int _AliasLevel; // Locally-adjusted version of AliasLevel flag. |
290 int _AliasLevel; // Locally-adjusted version of AliasLevel flag. |
275 bool _print_assembly; // True if we should dump assembly code for this compilation |
291 bool _print_assembly; // True if we should dump assembly code for this compilation |
276 #ifndef PRODUCT |
292 #ifndef PRODUCT |
277 bool _trace_opto_output; |
293 bool _trace_opto_output; |
278 bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing |
294 bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing |
894 // correspondence between Use-Def edges and Def-Use edges |
910 // correspondence between Use-Def edges and Def-Use edges |
895 // The option no_dead_code enables stronger checks that the |
911 // The option no_dead_code enables stronger checks that the |
896 // graph is strongly connected from root in both directions. |
912 // graph is strongly connected from root in both directions. |
897 void verify_graph_edges(bool no_dead_code = false) PRODUCT_RETURN; |
913 void verify_graph_edges(bool no_dead_code = false) PRODUCT_RETURN; |
898 |
914 |
899 // Print bytecodes, including the scope inlining tree |
|
900 void print_codes(); |
|
901 |
|
902 // End-of-run dumps. |
915 // End-of-run dumps. |
903 static void print_statistics() PRODUCT_RETURN; |
916 static void print_statistics() PRODUCT_RETURN; |
904 |
917 |
905 // Dump formatted assembly |
918 // Dump formatted assembly |
906 void dump_asm(int *pcs = NULL, uint pc_limit = 0) PRODUCT_RETURN; |
919 void dump_asm(int *pcs = NULL, uint pc_limit = 0) PRODUCT_RETURN; |