Wed, 23 Oct 2013 12:40:23 +0200
8024070: C2 needs some form of type speculation
Summary: record unused type profile information with type system, propagate and use it.
Reviewed-by: kvn, twisti
duke@435 | 1 | /* |
coleenp@4037 | 2 | * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_CI_CIMETHODDATA_HPP |
stefank@2314 | 26 | #define SHARE_VM_CI_CIMETHODDATA_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "ci/ciClassList.hpp" |
stefank@2314 | 29 | #include "ci/ciKlass.hpp" |
stefank@2314 | 30 | #include "ci/ciObject.hpp" |
stefank@2314 | 31 | #include "ci/ciUtilities.hpp" |
coleenp@4037 | 32 | #include "oops/methodData.hpp" |
stefank@2314 | 33 | #include "oops/oop.inline.hpp" |
stefank@2314 | 34 | |
duke@435 | 35 | class ciBitData; |
duke@435 | 36 | class ciCounterData; |
duke@435 | 37 | class ciJumpData; |
duke@435 | 38 | class ciReceiverTypeData; |
duke@435 | 39 | class ciRetData; |
duke@435 | 40 | class ciBranchData; |
duke@435 | 41 | class ciArrayData; |
duke@435 | 42 | class ciMultiBranchData; |
kvn@480 | 43 | class ciArgInfoData; |
roland@5914 | 44 | class ciCallTypeData; |
roland@5914 | 45 | class ciVirtualCallTypeData; |
roland@5987 | 46 | class ciParametersTypeData; |
duke@435 | 47 | |
duke@435 | 48 | typedef ProfileData ciProfileData; |
duke@435 | 49 | |
duke@435 | 50 | class ciBitData : public BitData { |
duke@435 | 51 | public: |
duke@435 | 52 | ciBitData(DataLayout* layout) : BitData(layout) {}; |
duke@435 | 53 | }; |
duke@435 | 54 | |
duke@435 | 55 | class ciCounterData : public CounterData { |
duke@435 | 56 | public: |
duke@435 | 57 | ciCounterData(DataLayout* layout) : CounterData(layout) {}; |
duke@435 | 58 | }; |
duke@435 | 59 | |
duke@435 | 60 | class ciJumpData : public JumpData { |
duke@435 | 61 | public: |
duke@435 | 62 | ciJumpData(DataLayout* layout) : JumpData(layout) {}; |
duke@435 | 63 | }; |
duke@435 | 64 | |
roland@5914 | 65 | class ciTypeEntries { |
roland@5914 | 66 | protected: |
roland@5914 | 67 | static intptr_t translate_klass(intptr_t k) { |
roland@5914 | 68 | Klass* v = TypeEntries::valid_klass(k); |
roland@5914 | 69 | if (v != NULL) { |
roland@5914 | 70 | ciKlass* klass = CURRENT_ENV->get_klass(v); |
roland@5914 | 71 | return with_status(klass, k); |
roland@5914 | 72 | } |
roland@5914 | 73 | return with_status(NULL, k); |
roland@5914 | 74 | } |
roland@5914 | 75 | |
roland@5914 | 76 | public: |
roland@5914 | 77 | static ciKlass* valid_ciklass(intptr_t k) { |
roland@5914 | 78 | if (!TypeEntries::is_type_none(k) && |
roland@5914 | 79 | !TypeEntries::is_type_unknown(k)) { |
roland@5914 | 80 | return (ciKlass*)TypeEntries::klass_part(k); |
roland@5914 | 81 | } else { |
roland@5914 | 82 | return NULL; |
roland@5914 | 83 | } |
roland@5914 | 84 | } |
roland@5914 | 85 | |
roland@5914 | 86 | static intptr_t with_status(ciKlass* k, intptr_t in) { |
roland@5914 | 87 | return TypeEntries::with_status((intptr_t)k, in); |
roland@5914 | 88 | } |
roland@5914 | 89 | |
roland@5914 | 90 | #ifndef PRODUCT |
roland@5914 | 91 | static void print_ciklass(outputStream* st, intptr_t k); |
roland@5914 | 92 | #endif |
roland@5914 | 93 | }; |
roland@5914 | 94 | |
roland@5914 | 95 | class ciTypeStackSlotEntries : public TypeStackSlotEntries, ciTypeEntries { |
roland@5914 | 96 | public: |
roland@5914 | 97 | void translate_type_data_from(const TypeStackSlotEntries* args); |
roland@5914 | 98 | |
roland@5914 | 99 | ciKlass* valid_type(int i) const { |
roland@5914 | 100 | return valid_ciklass(type(i)); |
roland@5914 | 101 | } |
roland@5914 | 102 | |
roland@5991 | 103 | bool maybe_null(int i) const { |
roland@5991 | 104 | return was_null_seen(type(i)); |
roland@5991 | 105 | } |
roland@5991 | 106 | |
roland@5914 | 107 | #ifndef PRODUCT |
roland@5914 | 108 | void print_data_on(outputStream* st) const; |
roland@5914 | 109 | #endif |
roland@5914 | 110 | }; |
roland@5914 | 111 | |
roland@5921 | 112 | class ciReturnTypeEntry : public ReturnTypeEntry, ciTypeEntries { |
roland@5921 | 113 | public: |
roland@5921 | 114 | void translate_type_data_from(const ReturnTypeEntry* ret); |
roland@5921 | 115 | |
roland@5921 | 116 | ciKlass* valid_type() const { |
roland@5921 | 117 | return valid_ciklass(type()); |
roland@5921 | 118 | } |
roland@5921 | 119 | |
roland@5991 | 120 | bool maybe_null() const { |
roland@5991 | 121 | return was_null_seen(type()); |
roland@5991 | 122 | } |
roland@5991 | 123 | |
roland@5921 | 124 | #ifndef PRODUCT |
roland@5921 | 125 | void print_data_on(outputStream* st) const; |
roland@5921 | 126 | #endif |
roland@5921 | 127 | }; |
roland@5921 | 128 | |
roland@5914 | 129 | class ciCallTypeData : public CallTypeData { |
roland@5914 | 130 | public: |
roland@5914 | 131 | ciCallTypeData(DataLayout* layout) : CallTypeData(layout) {} |
roland@5914 | 132 | |
roland@5914 | 133 | ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)CallTypeData::args(); } |
roland@5921 | 134 | ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)CallTypeData::ret(); } |
roland@5914 | 135 | |
roland@5987 | 136 | void translate_from(const ProfileData* data) { |
roland@5921 | 137 | if (has_arguments()) { |
roland@5921 | 138 | args()->translate_type_data_from(data->as_CallTypeData()->args()); |
roland@5921 | 139 | } |
roland@5921 | 140 | if (has_return()) { |
roland@5921 | 141 | ret()->translate_type_data_from(data->as_CallTypeData()->ret()); |
roland@5921 | 142 | } |
roland@5921 | 143 | } |
roland@5921 | 144 | |
roland@5921 | 145 | intptr_t argument_type(int i) const { |
roland@5921 | 146 | assert(has_arguments(), "no arg type profiling data"); |
roland@5921 | 147 | return args()->type(i); |
roland@5914 | 148 | } |
roland@5914 | 149 | |
roland@5914 | 150 | ciKlass* valid_argument_type(int i) const { |
roland@5921 | 151 | assert(has_arguments(), "no arg type profiling data"); |
roland@5914 | 152 | return args()->valid_type(i); |
roland@5914 | 153 | } |
roland@5914 | 154 | |
roland@5921 | 155 | intptr_t return_type() const { |
roland@5921 | 156 | assert(has_return(), "no ret type profiling data"); |
roland@5921 | 157 | return ret()->type(); |
roland@5921 | 158 | } |
roland@5921 | 159 | |
roland@5921 | 160 | ciKlass* valid_return_type() const { |
roland@5921 | 161 | assert(has_return(), "no ret type profiling data"); |
roland@5921 | 162 | return ret()->valid_type(); |
roland@5921 | 163 | } |
roland@5921 | 164 | |
roland@5991 | 165 | bool argument_maybe_null(int i) const { |
roland@5991 | 166 | return args()->maybe_null(i); |
roland@5991 | 167 | } |
roland@5991 | 168 | |
roland@5991 | 169 | bool return_maybe_null() const { |
roland@5991 | 170 | return ret()->maybe_null(); |
roland@5991 | 171 | } |
roland@5991 | 172 | |
roland@5914 | 173 | #ifndef PRODUCT |
roland@5914 | 174 | void print_data_on(outputStream* st) const; |
roland@5914 | 175 | #endif |
roland@5914 | 176 | }; |
roland@5914 | 177 | |
duke@435 | 178 | class ciReceiverTypeData : public ReceiverTypeData { |
duke@435 | 179 | public: |
duke@435 | 180 | ciReceiverTypeData(DataLayout* layout) : ReceiverTypeData(layout) {}; |
duke@435 | 181 | |
duke@435 | 182 | void set_receiver(uint row, ciKlass* recv) { |
duke@435 | 183 | assert((uint)row < row_limit(), "oob"); |
duke@435 | 184 | set_intptr_at(receiver0_offset + row * receiver_type_row_cell_count, |
duke@435 | 185 | (intptr_t) recv); |
duke@435 | 186 | } |
duke@435 | 187 | |
roland@5914 | 188 | ciKlass* receiver(uint row) const { |
duke@435 | 189 | assert((uint)row < row_limit(), "oob"); |
coleenp@4037 | 190 | ciKlass* recv = (ciKlass*)intptr_at(receiver0_offset + row * receiver_type_row_cell_count); |
duke@435 | 191 | assert(recv == NULL || recv->is_klass(), "wrong type"); |
coleenp@4037 | 192 | return recv; |
duke@435 | 193 | } |
duke@435 | 194 | |
duke@435 | 195 | // Copy & translate from oop based ReceiverTypeData |
roland@5914 | 196 | virtual void translate_from(const ProfileData* data) { |
duke@435 | 197 | translate_receiver_data_from(data); |
duke@435 | 198 | } |
roland@5914 | 199 | void translate_receiver_data_from(const ProfileData* data); |
duke@435 | 200 | #ifndef PRODUCT |
roland@5914 | 201 | void print_data_on(outputStream* st) const; |
roland@5914 | 202 | void print_receiver_data_on(outputStream* st) const; |
duke@435 | 203 | #endif |
duke@435 | 204 | }; |
duke@435 | 205 | |
duke@435 | 206 | class ciVirtualCallData : public VirtualCallData { |
duke@435 | 207 | // Fake multiple inheritance... It's a ciReceiverTypeData also. |
roland@5914 | 208 | ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; } |
duke@435 | 209 | |
duke@435 | 210 | public: |
duke@435 | 211 | ciVirtualCallData(DataLayout* layout) : VirtualCallData(layout) {}; |
duke@435 | 212 | |
duke@435 | 213 | void set_receiver(uint row, ciKlass* recv) { |
duke@435 | 214 | rtd_super()->set_receiver(row, recv); |
duke@435 | 215 | } |
duke@435 | 216 | |
duke@435 | 217 | ciKlass* receiver(uint row) { |
duke@435 | 218 | return rtd_super()->receiver(row); |
duke@435 | 219 | } |
duke@435 | 220 | |
duke@435 | 221 | // Copy & translate from oop based VirtualCallData |
roland@5914 | 222 | virtual void translate_from(const ProfileData* data) { |
duke@435 | 223 | rtd_super()->translate_receiver_data_from(data); |
duke@435 | 224 | } |
duke@435 | 225 | #ifndef PRODUCT |
roland@5914 | 226 | void print_data_on(outputStream* st) const; |
roland@5914 | 227 | #endif |
roland@5914 | 228 | }; |
roland@5914 | 229 | |
roland@5914 | 230 | class ciVirtualCallTypeData : public VirtualCallTypeData { |
roland@5914 | 231 | private: |
roland@5914 | 232 | // Fake multiple inheritance... It's a ciReceiverTypeData also. |
roland@5914 | 233 | ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; } |
roland@5914 | 234 | public: |
roland@5914 | 235 | ciVirtualCallTypeData(DataLayout* layout) : VirtualCallTypeData(layout) {} |
roland@5914 | 236 | |
roland@5914 | 237 | void set_receiver(uint row, ciKlass* recv) { |
roland@5914 | 238 | rtd_super()->set_receiver(row, recv); |
roland@5914 | 239 | } |
roland@5914 | 240 | |
roland@5914 | 241 | ciKlass* receiver(uint row) const { |
roland@5914 | 242 | return rtd_super()->receiver(row); |
roland@5914 | 243 | } |
roland@5914 | 244 | |
roland@5921 | 245 | ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)VirtualCallTypeData::args(); } |
roland@5921 | 246 | ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)VirtualCallTypeData::ret(); } |
roland@5921 | 247 | |
roland@5914 | 248 | // Copy & translate from oop based VirtualCallData |
roland@5914 | 249 | virtual void translate_from(const ProfileData* data) { |
roland@5914 | 250 | rtd_super()->translate_receiver_data_from(data); |
roland@5921 | 251 | if (has_arguments()) { |
roland@5921 | 252 | args()->translate_type_data_from(data->as_VirtualCallTypeData()->args()); |
roland@5921 | 253 | } |
roland@5921 | 254 | if (has_return()) { |
roland@5921 | 255 | ret()->translate_type_data_from(data->as_VirtualCallTypeData()->ret()); |
roland@5921 | 256 | } |
roland@5921 | 257 | } |
roland@5921 | 258 | |
roland@5921 | 259 | intptr_t argument_type(int i) const { |
roland@5921 | 260 | assert(has_arguments(), "no arg type profiling data"); |
roland@5921 | 261 | return args()->type(i); |
roland@5914 | 262 | } |
roland@5914 | 263 | |
roland@5914 | 264 | ciKlass* valid_argument_type(int i) const { |
roland@5921 | 265 | assert(has_arguments(), "no arg type profiling data"); |
roland@5914 | 266 | return args()->valid_type(i); |
roland@5914 | 267 | } |
roland@5914 | 268 | |
roland@5921 | 269 | intptr_t return_type() const { |
roland@5921 | 270 | assert(has_return(), "no ret type profiling data"); |
roland@5921 | 271 | return ret()->type(); |
roland@5921 | 272 | } |
roland@5921 | 273 | |
roland@5921 | 274 | ciKlass* valid_return_type() const { |
roland@5921 | 275 | assert(has_return(), "no ret type profiling data"); |
roland@5921 | 276 | return ret()->valid_type(); |
roland@5921 | 277 | } |
roland@5921 | 278 | |
roland@5991 | 279 | bool argument_maybe_null(int i) const { |
roland@5991 | 280 | return args()->maybe_null(i); |
roland@5991 | 281 | } |
roland@5991 | 282 | |
roland@5991 | 283 | bool return_maybe_null() const { |
roland@5991 | 284 | return ret()->maybe_null(); |
roland@5991 | 285 | } |
roland@5991 | 286 | |
roland@5914 | 287 | #ifndef PRODUCT |
roland@5914 | 288 | void print_data_on(outputStream* st) const; |
duke@435 | 289 | #endif |
duke@435 | 290 | }; |
duke@435 | 291 | |
duke@435 | 292 | |
duke@435 | 293 | class ciRetData : public RetData { |
duke@435 | 294 | public: |
duke@435 | 295 | ciRetData(DataLayout* layout) : RetData(layout) {}; |
duke@435 | 296 | }; |
duke@435 | 297 | |
duke@435 | 298 | class ciBranchData : public BranchData { |
duke@435 | 299 | public: |
duke@435 | 300 | ciBranchData(DataLayout* layout) : BranchData(layout) {}; |
duke@435 | 301 | }; |
duke@435 | 302 | |
duke@435 | 303 | class ciArrayData : public ArrayData { |
duke@435 | 304 | public: |
duke@435 | 305 | ciArrayData(DataLayout* layout) : ArrayData(layout) {}; |
duke@435 | 306 | }; |
duke@435 | 307 | |
duke@435 | 308 | class ciMultiBranchData : public MultiBranchData { |
duke@435 | 309 | public: |
duke@435 | 310 | ciMultiBranchData(DataLayout* layout) : MultiBranchData(layout) {}; |
duke@435 | 311 | }; |
duke@435 | 312 | |
kvn@480 | 313 | class ciArgInfoData : public ArgInfoData { |
kvn@480 | 314 | public: |
kvn@480 | 315 | ciArgInfoData(DataLayout* layout) : ArgInfoData(layout) {}; |
kvn@480 | 316 | }; |
kvn@480 | 317 | |
roland@5987 | 318 | class ciParametersTypeData : public ParametersTypeData { |
roland@5987 | 319 | public: |
roland@5987 | 320 | ciParametersTypeData(DataLayout* layout) : ParametersTypeData(layout) {} |
roland@5987 | 321 | |
roland@5987 | 322 | virtual void translate_from(const ProfileData* data) { |
roland@5987 | 323 | parameters()->translate_type_data_from(data->as_ParametersTypeData()->parameters()); |
roland@5987 | 324 | } |
roland@5987 | 325 | |
roland@5987 | 326 | ciTypeStackSlotEntries* parameters() const { return (ciTypeStackSlotEntries*)ParametersTypeData::parameters(); } |
roland@5987 | 327 | |
roland@5987 | 328 | ciKlass* valid_parameter_type(int i) const { |
roland@5987 | 329 | return parameters()->valid_type(i); |
roland@5987 | 330 | } |
roland@5987 | 331 | |
roland@5991 | 332 | bool parameter_maybe_null(int i) const { |
roland@5991 | 333 | return parameters()->maybe_null(i); |
roland@5991 | 334 | } |
roland@5991 | 335 | |
roland@5987 | 336 | #ifndef PRODUCT |
roland@5987 | 337 | void print_data_on(outputStream* st) const; |
roland@5987 | 338 | #endif |
roland@5987 | 339 | }; |
roland@5987 | 340 | |
duke@435 | 341 | // ciMethodData |
duke@435 | 342 | // |
coleenp@4037 | 343 | // This class represents a MethodData* in the HotSpot virtual |
duke@435 | 344 | // machine. |
duke@435 | 345 | |
coleenp@4037 | 346 | class ciMethodData : public ciMetadata { |
duke@435 | 347 | CI_PACKAGE_ACCESS |
minqi@4267 | 348 | friend class ciReplay; |
duke@435 | 349 | |
duke@435 | 350 | private: |
duke@435 | 351 | // Size in bytes |
duke@435 | 352 | int _data_size; |
duke@435 | 353 | int _extra_data_size; |
duke@435 | 354 | |
duke@435 | 355 | // Data entries |
duke@435 | 356 | intptr_t* _data; |
duke@435 | 357 | |
duke@435 | 358 | // Cached hint for data_before() |
duke@435 | 359 | int _hint_di; |
duke@435 | 360 | |
duke@435 | 361 | // Is data attached? And is it mature? |
duke@435 | 362 | enum { empty_state, immature_state, mature_state }; |
duke@435 | 363 | u_char _state; |
duke@435 | 364 | |
duke@435 | 365 | // Set this true if empty extra_data slots are ever witnessed. |
duke@435 | 366 | u_char _saw_free_extra_data; |
duke@435 | 367 | |
duke@435 | 368 | // Support for interprocedural escape analysis |
duke@435 | 369 | intx _eflags; // flags on escape information |
duke@435 | 370 | intx _arg_local; // bit set of non-escaping arguments |
duke@435 | 371 | intx _arg_stack; // bit set of stack-allocatable arguments |
duke@435 | 372 | intx _arg_returned; // bit set of returned arguments |
duke@435 | 373 | |
duke@435 | 374 | // Maturity of the oop when the snapshot is taken. |
duke@435 | 375 | int _current_mileage; |
duke@435 | 376 | |
iveresov@2138 | 377 | // These counters hold the age of MDO in tiered. In tiered we can have the same method |
iveresov@2138 | 378 | // running at different compilation levels concurrently. So, in order to precisely measure |
iveresov@2138 | 379 | // its maturity we need separate counters. |
iveresov@2138 | 380 | int _invocation_counter; |
iveresov@2138 | 381 | int _backedge_counter; |
iveresov@2138 | 382 | |
duke@435 | 383 | // Coherent snapshot of original header. |
coleenp@4037 | 384 | MethodData _orig; |
duke@435 | 385 | |
roland@5987 | 386 | // Dedicated area dedicated to parameters. Null if no parameter |
roland@5987 | 387 | // profiling for this method. |
roland@5987 | 388 | DataLayout* _parameters; |
roland@5987 | 389 | |
coleenp@4037 | 390 | ciMethodData(MethodData* md); |
duke@435 | 391 | ciMethodData(); |
duke@435 | 392 | |
duke@435 | 393 | // Accessors |
kvn@480 | 394 | int data_size() const { return _data_size; } |
kvn@480 | 395 | int extra_data_size() const { return _extra_data_size; } |
kvn@480 | 396 | intptr_t * data() const { return _data; } |
duke@435 | 397 | |
coleenp@4037 | 398 | MethodData* get_MethodData() const { |
coleenp@4037 | 399 | return (MethodData*)_metadata; |
duke@435 | 400 | } |
duke@435 | 401 | |
duke@435 | 402 | const char* type_string() { return "ciMethodData"; } |
duke@435 | 403 | |
duke@435 | 404 | void print_impl(outputStream* st); |
duke@435 | 405 | |
kvn@480 | 406 | DataLayout* data_layout_at(int data_index) const { |
duke@435 | 407 | assert(data_index % sizeof(intptr_t) == 0, "unaligned"); |
duke@435 | 408 | return (DataLayout*) (((address)_data) + data_index); |
duke@435 | 409 | } |
duke@435 | 410 | |
duke@435 | 411 | bool out_of_bounds(int data_index) { |
duke@435 | 412 | return data_index >= data_size(); |
duke@435 | 413 | } |
duke@435 | 414 | |
duke@435 | 415 | // hint accessors |
duke@435 | 416 | int hint_di() const { return _hint_di; } |
duke@435 | 417 | void set_hint_di(int di) { |
duke@435 | 418 | assert(!out_of_bounds(di), "hint_di out of bounds"); |
duke@435 | 419 | _hint_di = di; |
duke@435 | 420 | } |
duke@435 | 421 | ciProfileData* data_before(int bci) { |
duke@435 | 422 | // avoid SEGV on this edge case |
duke@435 | 423 | if (data_size() == 0) |
duke@435 | 424 | return NULL; |
duke@435 | 425 | int hint = hint_di(); |
duke@435 | 426 | if (data_layout_at(hint)->bci() <= bci) |
duke@435 | 427 | return data_at(hint); |
duke@435 | 428 | return first_data(); |
duke@435 | 429 | } |
duke@435 | 430 | |
duke@435 | 431 | |
duke@435 | 432 | // What is the index of the first data entry? |
duke@435 | 433 | int first_di() { return 0; } |
duke@435 | 434 | |
kvn@480 | 435 | ciArgInfoData *arg_info() const; |
kvn@480 | 436 | |
duke@435 | 437 | public: |
coleenp@4037 | 438 | bool is_method_data() const { return true; } |
twisti@2903 | 439 | |
twisti@2903 | 440 | bool is_empty() { return _state == empty_state; } |
duke@435 | 441 | bool is_mature() { return _state == mature_state; } |
duke@435 | 442 | |
duke@435 | 443 | int creation_mileage() { return _orig.creation_mileage(); } |
duke@435 | 444 | int current_mileage() { return _current_mileage; } |
duke@435 | 445 | |
iveresov@2138 | 446 | int invocation_count() { return _invocation_counter; } |
iveresov@2138 | 447 | int backedge_count() { return _backedge_counter; } |
coleenp@4037 | 448 | // Transfer information about the method to MethodData*. |
iveresov@2138 | 449 | // would_profile means we would like to profile this method, |
iveresov@2138 | 450 | // meaning it's not trivial. |
iveresov@2138 | 451 | void set_would_profile(bool p); |
iveresov@2138 | 452 | // Also set the numer of loops and blocks in the method. |
iveresov@2138 | 453 | // Again, this is used to determine if a method is trivial. |
iveresov@2138 | 454 | void set_compilation_stats(short loops, short blocks); |
roland@5914 | 455 | // If the compiler finds a profiled type that is known statically |
roland@5914 | 456 | // for sure, set it in the MethodData |
roland@5914 | 457 | void set_argument_type(int bci, int i, ciKlass* k); |
roland@5987 | 458 | void set_parameter_type(int i, ciKlass* k); |
roland@5921 | 459 | void set_return_type(int bci, ciKlass* k); |
iveresov@2138 | 460 | |
duke@435 | 461 | void load_data(); |
duke@435 | 462 | |
duke@435 | 463 | // Convert a dp (data pointer) to a di (data index). |
duke@435 | 464 | int dp_to_di(address dp) { |
duke@435 | 465 | return dp - ((address)_data); |
duke@435 | 466 | } |
duke@435 | 467 | |
duke@435 | 468 | // Get the data at an arbitrary (sort of) data index. |
duke@435 | 469 | ciProfileData* data_at(int data_index); |
duke@435 | 470 | |
duke@435 | 471 | // Walk through the data in order. |
duke@435 | 472 | ciProfileData* first_data() { return data_at(first_di()); } |
duke@435 | 473 | ciProfileData* next_data(ciProfileData* current); |
duke@435 | 474 | bool is_valid(ciProfileData* current) { return current != NULL; } |
duke@435 | 475 | |
duke@435 | 476 | // Get the data at an arbitrary bci, or NULL if there is none. |
duke@435 | 477 | ciProfileData* bci_to_data(int bci); |
duke@435 | 478 | ciProfileData* bci_to_extra_data(int bci, bool create_if_missing); |
duke@435 | 479 | |
duke@435 | 480 | uint overflow_trap_count() const { |
duke@435 | 481 | return _orig.overflow_trap_count(); |
duke@435 | 482 | } |
duke@435 | 483 | uint overflow_recompile_count() const { |
duke@435 | 484 | return _orig.overflow_recompile_count(); |
duke@435 | 485 | } |
duke@435 | 486 | uint decompile_count() const { |
duke@435 | 487 | return _orig.decompile_count(); |
duke@435 | 488 | } |
duke@435 | 489 | uint trap_count(int reason) const { |
duke@435 | 490 | return _orig.trap_count(reason); |
duke@435 | 491 | } |
duke@435 | 492 | uint trap_reason_limit() const { return _orig.trap_reason_limit(); } |
duke@435 | 493 | uint trap_count_limit() const { return _orig.trap_count_limit(); } |
duke@435 | 494 | |
duke@435 | 495 | // Helpful query functions that decode trap_state. |
duke@435 | 496 | int has_trap_at(ciProfileData* data, int reason); |
duke@435 | 497 | int has_trap_at(int bci, int reason) { |
duke@435 | 498 | return has_trap_at(bci_to_data(bci), reason); |
duke@435 | 499 | } |
duke@435 | 500 | int trap_recompiled_at(ciProfileData* data); |
duke@435 | 501 | int trap_recompiled_at(int bci) { |
duke@435 | 502 | return trap_recompiled_at(bci_to_data(bci)); |
duke@435 | 503 | } |
duke@435 | 504 | |
duke@435 | 505 | void clear_escape_info(); |
duke@435 | 506 | bool has_escape_info(); |
duke@435 | 507 | void update_escape_info(); |
duke@435 | 508 | |
coleenp@4037 | 509 | void set_eflag(MethodData::EscapeFlag f); |
coleenp@4037 | 510 | void clear_eflag(MethodData::EscapeFlag f); |
coleenp@4037 | 511 | bool eflag_set(MethodData::EscapeFlag f) const; |
duke@435 | 512 | |
duke@435 | 513 | void set_arg_local(int i); |
duke@435 | 514 | void set_arg_stack(int i); |
duke@435 | 515 | void set_arg_returned(int i); |
kvn@480 | 516 | void set_arg_modified(int arg, uint val); |
duke@435 | 517 | |
duke@435 | 518 | bool is_arg_local(int i) const; |
duke@435 | 519 | bool is_arg_stack(int i) const; |
duke@435 | 520 | bool is_arg_returned(int i) const; |
kvn@480 | 521 | uint arg_modified(int arg) const; |
duke@435 | 522 | |
roland@5987 | 523 | ciParametersTypeData* parameters_type_data() const { |
roland@5987 | 524 | return _parameters != NULL ? new ciParametersTypeData(_parameters) : NULL; |
roland@5987 | 525 | } |
roland@5987 | 526 | |
duke@435 | 527 | // Code generation helper |
duke@435 | 528 | ByteSize offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data); |
duke@435 | 529 | int byte_offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data) { return in_bytes(offset_of_slot(data, slot_offset_in_data)); } |
duke@435 | 530 | |
duke@435 | 531 | #ifndef PRODUCT |
duke@435 | 532 | // printing support for method data |
duke@435 | 533 | void print(); |
duke@435 | 534 | void print_data_on(outputStream* st); |
duke@435 | 535 | #endif |
minqi@4267 | 536 | void dump_replay_data(outputStream* out); |
duke@435 | 537 | }; |
stefank@2314 | 538 | |
stefank@2314 | 539 | #endif // SHARE_VM_CI_CIMETHODDATA_HPP |