Mon, 12 Aug 2019 18:30:40 +0300
8223147: JFR Backport
8199712: Flight Recorder
8203346: JFR: Inconsistent signature of jfr_add_string_constant
8195817: JFR.stop should require name of recording
8195818: JFR.start should increase autogenerated name by one
8195819: Remove recording=x from jcmd JFR.check output
8203921: JFR thread sampling is missing fixes from JDK-8194552
8203929: Limit amount of data for JFR.dump
8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording
8003209: JFR events for network utilization
8207392: [PPC64] Implement JFR profiling
8202835: jfr/event/os/TestSystemProcess.java fails on missing events
Summary: Backport JFR from JDK11. Initial integration
Reviewed-by: neugens
duke@435 | 1 | /* |
mikael@6198 | 2 | * Copyright (c) 2001, 2013, 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" |
roland@6377 | 34 | #include "runtime/deoptimization.hpp" |
stefank@2314 | 35 | |
duke@435 | 36 | class ciBitData; |
duke@435 | 37 | class ciCounterData; |
duke@435 | 38 | class ciJumpData; |
duke@435 | 39 | class ciReceiverTypeData; |
duke@435 | 40 | class ciRetData; |
duke@435 | 41 | class ciBranchData; |
duke@435 | 42 | class ciArrayData; |
duke@435 | 43 | class ciMultiBranchData; |
kvn@480 | 44 | class ciArgInfoData; |
roland@5914 | 45 | class ciCallTypeData; |
roland@5914 | 46 | class ciVirtualCallTypeData; |
roland@5987 | 47 | class ciParametersTypeData; |
roland@6377 | 48 | class ciSpeculativeTrapData;; |
duke@435 | 49 | |
duke@435 | 50 | typedef ProfileData ciProfileData; |
duke@435 | 51 | |
duke@435 | 52 | class ciBitData : public BitData { |
duke@435 | 53 | public: |
duke@435 | 54 | ciBitData(DataLayout* layout) : BitData(layout) {}; |
duke@435 | 55 | }; |
duke@435 | 56 | |
duke@435 | 57 | class ciCounterData : public CounterData { |
duke@435 | 58 | public: |
duke@435 | 59 | ciCounterData(DataLayout* layout) : CounterData(layout) {}; |
duke@435 | 60 | }; |
duke@435 | 61 | |
duke@435 | 62 | class ciJumpData : public JumpData { |
duke@435 | 63 | public: |
duke@435 | 64 | ciJumpData(DataLayout* layout) : JumpData(layout) {}; |
duke@435 | 65 | }; |
duke@435 | 66 | |
roland@5914 | 67 | class ciTypeEntries { |
roland@5914 | 68 | protected: |
roland@5914 | 69 | static intptr_t translate_klass(intptr_t k) { |
roland@5914 | 70 | Klass* v = TypeEntries::valid_klass(k); |
roland@5914 | 71 | if (v != NULL) { |
roland@5914 | 72 | ciKlass* klass = CURRENT_ENV->get_klass(v); |
stefank@6992 | 73 | CURRENT_ENV->ensure_metadata_alive(klass); |
roland@5914 | 74 | return with_status(klass, k); |
roland@5914 | 75 | } |
roland@5914 | 76 | return with_status(NULL, k); |
roland@5914 | 77 | } |
roland@5914 | 78 | |
roland@5914 | 79 | public: |
roland@5914 | 80 | static ciKlass* valid_ciklass(intptr_t k) { |
roland@5914 | 81 | if (!TypeEntries::is_type_none(k) && |
roland@5914 | 82 | !TypeEntries::is_type_unknown(k)) { |
roland@6105 | 83 | ciKlass* res = (ciKlass*)TypeEntries::klass_part(k); |
roland@6105 | 84 | assert(res != NULL, "invalid"); |
roland@6105 | 85 | return res; |
roland@5914 | 86 | } else { |
roland@5914 | 87 | return NULL; |
roland@5914 | 88 | } |
roland@5914 | 89 | } |
roland@5914 | 90 | |
roland@5914 | 91 | static intptr_t with_status(ciKlass* k, intptr_t in) { |
roland@5914 | 92 | return TypeEntries::with_status((intptr_t)k, in); |
roland@5914 | 93 | } |
roland@5914 | 94 | |
roland@5914 | 95 | #ifndef PRODUCT |
roland@5914 | 96 | static void print_ciklass(outputStream* st, intptr_t k); |
roland@5914 | 97 | #endif |
roland@5914 | 98 | }; |
roland@5914 | 99 | |
roland@5914 | 100 | class ciTypeStackSlotEntries : public TypeStackSlotEntries, ciTypeEntries { |
roland@5914 | 101 | public: |
roland@5914 | 102 | void translate_type_data_from(const TypeStackSlotEntries* args); |
roland@5914 | 103 | |
roland@5914 | 104 | ciKlass* valid_type(int i) const { |
roland@5914 | 105 | return valid_ciklass(type(i)); |
roland@5914 | 106 | } |
roland@5914 | 107 | |
roland@5991 | 108 | bool maybe_null(int i) const { |
roland@5991 | 109 | return was_null_seen(type(i)); |
roland@5991 | 110 | } |
roland@5991 | 111 | |
roland@5914 | 112 | #ifndef PRODUCT |
roland@5914 | 113 | void print_data_on(outputStream* st) const; |
roland@5914 | 114 | #endif |
roland@5914 | 115 | }; |
roland@5914 | 116 | |
roland@5921 | 117 | class ciReturnTypeEntry : public ReturnTypeEntry, ciTypeEntries { |
roland@5921 | 118 | public: |
roland@5921 | 119 | void translate_type_data_from(const ReturnTypeEntry* ret); |
roland@5921 | 120 | |
roland@5921 | 121 | ciKlass* valid_type() const { |
roland@5921 | 122 | return valid_ciklass(type()); |
roland@5921 | 123 | } |
roland@5921 | 124 | |
roland@5991 | 125 | bool maybe_null() const { |
roland@5991 | 126 | return was_null_seen(type()); |
roland@5991 | 127 | } |
roland@5991 | 128 | |
roland@5921 | 129 | #ifndef PRODUCT |
roland@5921 | 130 | void print_data_on(outputStream* st) const; |
roland@5921 | 131 | #endif |
roland@5921 | 132 | }; |
roland@5921 | 133 | |
roland@5914 | 134 | class ciCallTypeData : public CallTypeData { |
roland@5914 | 135 | public: |
roland@5914 | 136 | ciCallTypeData(DataLayout* layout) : CallTypeData(layout) {} |
roland@5914 | 137 | |
roland@5914 | 138 | ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)CallTypeData::args(); } |
roland@5921 | 139 | ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)CallTypeData::ret(); } |
roland@5914 | 140 | |
roland@5987 | 141 | void translate_from(const ProfileData* data) { |
roland@5921 | 142 | if (has_arguments()) { |
roland@5921 | 143 | args()->translate_type_data_from(data->as_CallTypeData()->args()); |
roland@5921 | 144 | } |
roland@5921 | 145 | if (has_return()) { |
roland@5921 | 146 | ret()->translate_type_data_from(data->as_CallTypeData()->ret()); |
roland@5921 | 147 | } |
roland@5921 | 148 | } |
roland@5921 | 149 | |
roland@5921 | 150 | intptr_t argument_type(int i) const { |
roland@5921 | 151 | assert(has_arguments(), "no arg type profiling data"); |
roland@5921 | 152 | return args()->type(i); |
roland@5914 | 153 | } |
roland@5914 | 154 | |
roland@5914 | 155 | ciKlass* valid_argument_type(int i) const { |
roland@5921 | 156 | assert(has_arguments(), "no arg type profiling data"); |
roland@5914 | 157 | return args()->valid_type(i); |
roland@5914 | 158 | } |
roland@5914 | 159 | |
roland@5921 | 160 | intptr_t return_type() const { |
roland@5921 | 161 | assert(has_return(), "no ret type profiling data"); |
roland@5921 | 162 | return ret()->type(); |
roland@5921 | 163 | } |
roland@5921 | 164 | |
roland@5921 | 165 | ciKlass* valid_return_type() const { |
roland@5921 | 166 | assert(has_return(), "no ret type profiling data"); |
roland@5921 | 167 | return ret()->valid_type(); |
roland@5921 | 168 | } |
roland@5921 | 169 | |
roland@5991 | 170 | bool argument_maybe_null(int i) const { |
roland@5991 | 171 | return args()->maybe_null(i); |
roland@5991 | 172 | } |
roland@5991 | 173 | |
roland@5991 | 174 | bool return_maybe_null() const { |
roland@5991 | 175 | return ret()->maybe_null(); |
roland@5991 | 176 | } |
roland@5991 | 177 | |
roland@5914 | 178 | #ifndef PRODUCT |
roland@6377 | 179 | void print_data_on(outputStream* st, const char* extra) const; |
roland@5914 | 180 | #endif |
roland@5914 | 181 | }; |
roland@5914 | 182 | |
duke@435 | 183 | class ciReceiverTypeData : public ReceiverTypeData { |
duke@435 | 184 | public: |
duke@435 | 185 | ciReceiverTypeData(DataLayout* layout) : ReceiverTypeData(layout) {}; |
duke@435 | 186 | |
duke@435 | 187 | void set_receiver(uint row, ciKlass* recv) { |
duke@435 | 188 | assert((uint)row < row_limit(), "oob"); |
duke@435 | 189 | set_intptr_at(receiver0_offset + row * receiver_type_row_cell_count, |
duke@435 | 190 | (intptr_t) recv); |
duke@435 | 191 | } |
duke@435 | 192 | |
roland@5914 | 193 | ciKlass* receiver(uint row) const { |
duke@435 | 194 | assert((uint)row < row_limit(), "oob"); |
coleenp@4037 | 195 | ciKlass* recv = (ciKlass*)intptr_at(receiver0_offset + row * receiver_type_row_cell_count); |
duke@435 | 196 | assert(recv == NULL || recv->is_klass(), "wrong type"); |
coleenp@4037 | 197 | return recv; |
duke@435 | 198 | } |
duke@435 | 199 | |
duke@435 | 200 | // Copy & translate from oop based ReceiverTypeData |
roland@5914 | 201 | virtual void translate_from(const ProfileData* data) { |
duke@435 | 202 | translate_receiver_data_from(data); |
duke@435 | 203 | } |
roland@5914 | 204 | void translate_receiver_data_from(const ProfileData* data); |
duke@435 | 205 | #ifndef PRODUCT |
roland@6377 | 206 | void print_data_on(outputStream* st, const char* extra) const; |
roland@5914 | 207 | void print_receiver_data_on(outputStream* st) const; |
duke@435 | 208 | #endif |
duke@435 | 209 | }; |
duke@435 | 210 | |
duke@435 | 211 | class ciVirtualCallData : public VirtualCallData { |
duke@435 | 212 | // Fake multiple inheritance... It's a ciReceiverTypeData also. |
roland@5914 | 213 | ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; } |
duke@435 | 214 | |
duke@435 | 215 | public: |
duke@435 | 216 | ciVirtualCallData(DataLayout* layout) : VirtualCallData(layout) {}; |
duke@435 | 217 | |
duke@435 | 218 | void set_receiver(uint row, ciKlass* recv) { |
duke@435 | 219 | rtd_super()->set_receiver(row, recv); |
duke@435 | 220 | } |
duke@435 | 221 | |
duke@435 | 222 | ciKlass* receiver(uint row) { |
duke@435 | 223 | return rtd_super()->receiver(row); |
duke@435 | 224 | } |
duke@435 | 225 | |
duke@435 | 226 | // Copy & translate from oop based VirtualCallData |
roland@5914 | 227 | virtual void translate_from(const ProfileData* data) { |
duke@435 | 228 | rtd_super()->translate_receiver_data_from(data); |
duke@435 | 229 | } |
duke@435 | 230 | #ifndef PRODUCT |
roland@6377 | 231 | void print_data_on(outputStream* st, const char* extra) const; |
roland@5914 | 232 | #endif |
roland@5914 | 233 | }; |
roland@5914 | 234 | |
roland@5914 | 235 | class ciVirtualCallTypeData : public VirtualCallTypeData { |
roland@5914 | 236 | private: |
roland@5914 | 237 | // Fake multiple inheritance... It's a ciReceiverTypeData also. |
roland@5914 | 238 | ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; } |
roland@5914 | 239 | public: |
roland@5914 | 240 | ciVirtualCallTypeData(DataLayout* layout) : VirtualCallTypeData(layout) {} |
roland@5914 | 241 | |
roland@5914 | 242 | void set_receiver(uint row, ciKlass* recv) { |
roland@5914 | 243 | rtd_super()->set_receiver(row, recv); |
roland@5914 | 244 | } |
roland@5914 | 245 | |
roland@5914 | 246 | ciKlass* receiver(uint row) const { |
roland@5914 | 247 | return rtd_super()->receiver(row); |
roland@5914 | 248 | } |
roland@5914 | 249 | |
roland@5921 | 250 | ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)VirtualCallTypeData::args(); } |
roland@5921 | 251 | ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)VirtualCallTypeData::ret(); } |
roland@5921 | 252 | |
roland@5914 | 253 | // Copy & translate from oop based VirtualCallData |
roland@5914 | 254 | virtual void translate_from(const ProfileData* data) { |
roland@5914 | 255 | rtd_super()->translate_receiver_data_from(data); |
roland@5921 | 256 | if (has_arguments()) { |
roland@5921 | 257 | args()->translate_type_data_from(data->as_VirtualCallTypeData()->args()); |
roland@5921 | 258 | } |
roland@5921 | 259 | if (has_return()) { |
roland@5921 | 260 | ret()->translate_type_data_from(data->as_VirtualCallTypeData()->ret()); |
roland@5921 | 261 | } |
roland@5921 | 262 | } |
roland@5921 | 263 | |
roland@5921 | 264 | intptr_t argument_type(int i) const { |
roland@5921 | 265 | assert(has_arguments(), "no arg type profiling data"); |
roland@5921 | 266 | return args()->type(i); |
roland@5914 | 267 | } |
roland@5914 | 268 | |
roland@5914 | 269 | ciKlass* valid_argument_type(int i) const { |
roland@5921 | 270 | assert(has_arguments(), "no arg type profiling data"); |
roland@5914 | 271 | return args()->valid_type(i); |
roland@5914 | 272 | } |
roland@5914 | 273 | |
roland@5921 | 274 | intptr_t return_type() const { |
roland@5921 | 275 | assert(has_return(), "no ret type profiling data"); |
roland@5921 | 276 | return ret()->type(); |
roland@5921 | 277 | } |
roland@5921 | 278 | |
roland@5921 | 279 | ciKlass* valid_return_type() const { |
roland@5921 | 280 | assert(has_return(), "no ret type profiling data"); |
roland@5921 | 281 | return ret()->valid_type(); |
roland@5921 | 282 | } |
roland@5921 | 283 | |
roland@5991 | 284 | bool argument_maybe_null(int i) const { |
roland@5991 | 285 | return args()->maybe_null(i); |
roland@5991 | 286 | } |
roland@5991 | 287 | |
roland@5991 | 288 | bool return_maybe_null() const { |
roland@5991 | 289 | return ret()->maybe_null(); |
roland@5991 | 290 | } |
roland@5991 | 291 | |
roland@5914 | 292 | #ifndef PRODUCT |
roland@6377 | 293 | void print_data_on(outputStream* st, const char* extra) const; |
duke@435 | 294 | #endif |
duke@435 | 295 | }; |
duke@435 | 296 | |
duke@435 | 297 | |
duke@435 | 298 | class ciRetData : public RetData { |
duke@435 | 299 | public: |
duke@435 | 300 | ciRetData(DataLayout* layout) : RetData(layout) {}; |
duke@435 | 301 | }; |
duke@435 | 302 | |
duke@435 | 303 | class ciBranchData : public BranchData { |
duke@435 | 304 | public: |
duke@435 | 305 | ciBranchData(DataLayout* layout) : BranchData(layout) {}; |
duke@435 | 306 | }; |
duke@435 | 307 | |
duke@435 | 308 | class ciArrayData : public ArrayData { |
duke@435 | 309 | public: |
duke@435 | 310 | ciArrayData(DataLayout* layout) : ArrayData(layout) {}; |
duke@435 | 311 | }; |
duke@435 | 312 | |
duke@435 | 313 | class ciMultiBranchData : public MultiBranchData { |
duke@435 | 314 | public: |
duke@435 | 315 | ciMultiBranchData(DataLayout* layout) : MultiBranchData(layout) {}; |
duke@435 | 316 | }; |
duke@435 | 317 | |
kvn@480 | 318 | class ciArgInfoData : public ArgInfoData { |
kvn@480 | 319 | public: |
kvn@480 | 320 | ciArgInfoData(DataLayout* layout) : ArgInfoData(layout) {}; |
kvn@480 | 321 | }; |
kvn@480 | 322 | |
roland@5987 | 323 | class ciParametersTypeData : public ParametersTypeData { |
roland@5987 | 324 | public: |
roland@5987 | 325 | ciParametersTypeData(DataLayout* layout) : ParametersTypeData(layout) {} |
roland@5987 | 326 | |
roland@5987 | 327 | virtual void translate_from(const ProfileData* data) { |
roland@5987 | 328 | parameters()->translate_type_data_from(data->as_ParametersTypeData()->parameters()); |
roland@5987 | 329 | } |
roland@5987 | 330 | |
roland@5987 | 331 | ciTypeStackSlotEntries* parameters() const { return (ciTypeStackSlotEntries*)ParametersTypeData::parameters(); } |
roland@5987 | 332 | |
roland@5987 | 333 | ciKlass* valid_parameter_type(int i) const { |
roland@5987 | 334 | return parameters()->valid_type(i); |
roland@5987 | 335 | } |
roland@5987 | 336 | |
roland@5991 | 337 | bool parameter_maybe_null(int i) const { |
roland@5991 | 338 | return parameters()->maybe_null(i); |
roland@5991 | 339 | } |
roland@5991 | 340 | |
roland@5987 | 341 | #ifndef PRODUCT |
roland@6377 | 342 | void print_data_on(outputStream* st, const char* extra) const; |
roland@6377 | 343 | #endif |
roland@6377 | 344 | }; |
roland@6377 | 345 | |
roland@6377 | 346 | class ciSpeculativeTrapData : public SpeculativeTrapData { |
roland@6377 | 347 | public: |
roland@6377 | 348 | ciSpeculativeTrapData(DataLayout* layout) : SpeculativeTrapData(layout) {} |
roland@6377 | 349 | |
roland@6377 | 350 | virtual void translate_from(const ProfileData* data); |
roland@6377 | 351 | |
roland@6377 | 352 | ciMethod* method() const { |
roland@6377 | 353 | return (ciMethod*)intptr_at(method_offset); |
roland@6377 | 354 | } |
roland@6377 | 355 | |
roland@6377 | 356 | void set_method(ciMethod* m) { |
roland@6377 | 357 | set_intptr_at(method_offset, (intptr_t)m); |
roland@6377 | 358 | } |
roland@6377 | 359 | |
roland@6377 | 360 | #ifndef PRODUCT |
roland@6377 | 361 | void print_data_on(outputStream* st, const char* extra) const; |
roland@5987 | 362 | #endif |
roland@5987 | 363 | }; |
roland@5987 | 364 | |
duke@435 | 365 | // ciMethodData |
duke@435 | 366 | // |
coleenp@4037 | 367 | // This class represents a MethodData* in the HotSpot virtual |
duke@435 | 368 | // machine. |
duke@435 | 369 | |
coleenp@4037 | 370 | class ciMethodData : public ciMetadata { |
duke@435 | 371 | CI_PACKAGE_ACCESS |
minqi@4267 | 372 | friend class ciReplay; |
duke@435 | 373 | |
duke@435 | 374 | private: |
duke@435 | 375 | // Size in bytes |
duke@435 | 376 | int _data_size; |
duke@435 | 377 | int _extra_data_size; |
duke@435 | 378 | |
duke@435 | 379 | // Data entries |
duke@435 | 380 | intptr_t* _data; |
duke@435 | 381 | |
duke@435 | 382 | // Cached hint for data_before() |
duke@435 | 383 | int _hint_di; |
duke@435 | 384 | |
duke@435 | 385 | // Is data attached? And is it mature? |
duke@435 | 386 | enum { empty_state, immature_state, mature_state }; |
duke@435 | 387 | u_char _state; |
duke@435 | 388 | |
duke@435 | 389 | // Set this true if empty extra_data slots are ever witnessed. |
duke@435 | 390 | u_char _saw_free_extra_data; |
duke@435 | 391 | |
duke@435 | 392 | // Support for interprocedural escape analysis |
duke@435 | 393 | intx _eflags; // flags on escape information |
duke@435 | 394 | intx _arg_local; // bit set of non-escaping arguments |
duke@435 | 395 | intx _arg_stack; // bit set of stack-allocatable arguments |
duke@435 | 396 | intx _arg_returned; // bit set of returned arguments |
duke@435 | 397 | |
duke@435 | 398 | // Maturity of the oop when the snapshot is taken. |
duke@435 | 399 | int _current_mileage; |
duke@435 | 400 | |
iveresov@2138 | 401 | // These counters hold the age of MDO in tiered. In tiered we can have the same method |
iveresov@2138 | 402 | // running at different compilation levels concurrently. So, in order to precisely measure |
iveresov@2138 | 403 | // its maturity we need separate counters. |
iveresov@2138 | 404 | int _invocation_counter; |
iveresov@2138 | 405 | int _backedge_counter; |
iveresov@2138 | 406 | |
duke@435 | 407 | // Coherent snapshot of original header. |
coleenp@4037 | 408 | MethodData _orig; |
duke@435 | 409 | |
roland@5987 | 410 | // Dedicated area dedicated to parameters. Null if no parameter |
roland@5987 | 411 | // profiling for this method. |
roland@5987 | 412 | DataLayout* _parameters; |
roland@5987 | 413 | |
coleenp@4037 | 414 | ciMethodData(MethodData* md); |
duke@435 | 415 | ciMethodData(); |
duke@435 | 416 | |
duke@435 | 417 | // Accessors |
kvn@480 | 418 | int data_size() const { return _data_size; } |
kvn@480 | 419 | int extra_data_size() const { return _extra_data_size; } |
kvn@480 | 420 | intptr_t * data() const { return _data; } |
duke@435 | 421 | |
coleenp@4037 | 422 | MethodData* get_MethodData() const { |
coleenp@4037 | 423 | return (MethodData*)_metadata; |
duke@435 | 424 | } |
duke@435 | 425 | |
duke@435 | 426 | const char* type_string() { return "ciMethodData"; } |
duke@435 | 427 | |
duke@435 | 428 | void print_impl(outputStream* st); |
duke@435 | 429 | |
kvn@480 | 430 | DataLayout* data_layout_at(int data_index) const { |
duke@435 | 431 | assert(data_index % sizeof(intptr_t) == 0, "unaligned"); |
duke@435 | 432 | return (DataLayout*) (((address)_data) + data_index); |
duke@435 | 433 | } |
duke@435 | 434 | |
duke@435 | 435 | bool out_of_bounds(int data_index) { |
duke@435 | 436 | return data_index >= data_size(); |
duke@435 | 437 | } |
duke@435 | 438 | |
duke@435 | 439 | // hint accessors |
duke@435 | 440 | int hint_di() const { return _hint_di; } |
duke@435 | 441 | void set_hint_di(int di) { |
duke@435 | 442 | assert(!out_of_bounds(di), "hint_di out of bounds"); |
duke@435 | 443 | _hint_di = di; |
duke@435 | 444 | } |
duke@435 | 445 | ciProfileData* data_before(int bci) { |
duke@435 | 446 | // avoid SEGV on this edge case |
duke@435 | 447 | if (data_size() == 0) |
duke@435 | 448 | return NULL; |
duke@435 | 449 | int hint = hint_di(); |
duke@435 | 450 | if (data_layout_at(hint)->bci() <= bci) |
duke@435 | 451 | return data_at(hint); |
duke@435 | 452 | return first_data(); |
duke@435 | 453 | } |
duke@435 | 454 | |
duke@435 | 455 | |
duke@435 | 456 | // What is the index of the first data entry? |
duke@435 | 457 | int first_di() { return 0; } |
duke@435 | 458 | |
kvn@480 | 459 | ciArgInfoData *arg_info() const; |
kvn@480 | 460 | |
roland@6377 | 461 | address data_base() const { |
roland@6377 | 462 | return (address) _data; |
roland@6377 | 463 | } |
roland@6377 | 464 | DataLayout* limit_data_position() const { |
roland@6377 | 465 | return (DataLayout*)((address)data_base() + _data_size); |
roland@6377 | 466 | } |
roland@6377 | 467 | |
roland@6377 | 468 | void load_extra_data(); |
roland@6377 | 469 | ciProfileData* bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots); |
roland@6377 | 470 | |
duke@435 | 471 | public: |
coleenp@4037 | 472 | bool is_method_data() const { return true; } |
twisti@2903 | 473 | |
twisti@2903 | 474 | bool is_empty() { return _state == empty_state; } |
duke@435 | 475 | bool is_mature() { return _state == mature_state; } |
duke@435 | 476 | |
duke@435 | 477 | int creation_mileage() { return _orig.creation_mileage(); } |
duke@435 | 478 | int current_mileage() { return _current_mileage; } |
duke@435 | 479 | |
iveresov@2138 | 480 | int invocation_count() { return _invocation_counter; } |
iveresov@2138 | 481 | int backedge_count() { return _backedge_counter; } |
kvn@6429 | 482 | |
kvn@6429 | 483 | #if INCLUDE_RTM_OPT |
kvn@6429 | 484 | // return cached value |
kvn@6429 | 485 | int rtm_state() { |
kvn@6429 | 486 | if (is_empty()) { |
kvn@6429 | 487 | return NoRTM; |
kvn@6429 | 488 | } else { |
kvn@6429 | 489 | return get_MethodData()->rtm_state(); |
kvn@6429 | 490 | } |
kvn@6429 | 491 | } |
kvn@6429 | 492 | #endif |
kvn@6429 | 493 | |
coleenp@4037 | 494 | // Transfer information about the method to MethodData*. |
iveresov@2138 | 495 | // would_profile means we would like to profile this method, |
iveresov@2138 | 496 | // meaning it's not trivial. |
iveresov@2138 | 497 | void set_would_profile(bool p); |
iveresov@2138 | 498 | // Also set the numer of loops and blocks in the method. |
iveresov@2138 | 499 | // Again, this is used to determine if a method is trivial. |
iveresov@2138 | 500 | void set_compilation_stats(short loops, short blocks); |
roland@5914 | 501 | // If the compiler finds a profiled type that is known statically |
roland@5914 | 502 | // for sure, set it in the MethodData |
roland@5914 | 503 | void set_argument_type(int bci, int i, ciKlass* k); |
roland@5987 | 504 | void set_parameter_type(int i, ciKlass* k); |
roland@5921 | 505 | void set_return_type(int bci, ciKlass* k); |
iveresov@2138 | 506 | |
duke@435 | 507 | void load_data(); |
duke@435 | 508 | |
duke@435 | 509 | // Convert a dp (data pointer) to a di (data index). |
duke@435 | 510 | int dp_to_di(address dp) { |
duke@435 | 511 | return dp - ((address)_data); |
duke@435 | 512 | } |
duke@435 | 513 | |
duke@435 | 514 | // Get the data at an arbitrary (sort of) data index. |
duke@435 | 515 | ciProfileData* data_at(int data_index); |
duke@435 | 516 | |
duke@435 | 517 | // Walk through the data in order. |
duke@435 | 518 | ciProfileData* first_data() { return data_at(first_di()); } |
duke@435 | 519 | ciProfileData* next_data(ciProfileData* current); |
duke@435 | 520 | bool is_valid(ciProfileData* current) { return current != NULL; } |
duke@435 | 521 | |
roland@6377 | 522 | DataLayout* extra_data_base() const { return limit_data_position(); } |
roland@6377 | 523 | |
roland@6377 | 524 | // Get the data at an arbitrary bci, or NULL if there is none. If m |
roland@6377 | 525 | // is not NULL look for a SpeculativeTrapData if any first. |
roland@6377 | 526 | ciProfileData* bci_to_data(int bci, ciMethod* m = NULL); |
duke@435 | 527 | |
duke@435 | 528 | uint overflow_trap_count() const { |
duke@435 | 529 | return _orig.overflow_trap_count(); |
duke@435 | 530 | } |
duke@435 | 531 | uint overflow_recompile_count() const { |
duke@435 | 532 | return _orig.overflow_recompile_count(); |
duke@435 | 533 | } |
duke@435 | 534 | uint decompile_count() const { |
duke@435 | 535 | return _orig.decompile_count(); |
duke@435 | 536 | } |
duke@435 | 537 | uint trap_count(int reason) const { |
duke@435 | 538 | return _orig.trap_count(reason); |
duke@435 | 539 | } |
duke@435 | 540 | uint trap_reason_limit() const { return _orig.trap_reason_limit(); } |
duke@435 | 541 | uint trap_count_limit() const { return _orig.trap_count_limit(); } |
duke@435 | 542 | |
duke@435 | 543 | // Helpful query functions that decode trap_state. |
duke@435 | 544 | int has_trap_at(ciProfileData* data, int reason); |
roland@6377 | 545 | int has_trap_at(int bci, ciMethod* m, int reason) { |
roland@6377 | 546 | assert((m != NULL) == Deoptimization::reason_is_speculate(reason), "inconsistent method/reason"); |
roland@6377 | 547 | return has_trap_at(bci_to_data(bci, m), reason); |
duke@435 | 548 | } |
duke@435 | 549 | int trap_recompiled_at(ciProfileData* data); |
roland@6377 | 550 | int trap_recompiled_at(int bci, ciMethod* m) { |
roland@6377 | 551 | return trap_recompiled_at(bci_to_data(bci, m)); |
duke@435 | 552 | } |
duke@435 | 553 | |
duke@435 | 554 | void clear_escape_info(); |
duke@435 | 555 | bool has_escape_info(); |
duke@435 | 556 | void update_escape_info(); |
duke@435 | 557 | |
coleenp@4037 | 558 | void set_eflag(MethodData::EscapeFlag f); |
coleenp@4037 | 559 | void clear_eflag(MethodData::EscapeFlag f); |
coleenp@4037 | 560 | bool eflag_set(MethodData::EscapeFlag f) const; |
duke@435 | 561 | |
duke@435 | 562 | void set_arg_local(int i); |
duke@435 | 563 | void set_arg_stack(int i); |
duke@435 | 564 | void set_arg_returned(int i); |
kvn@480 | 565 | void set_arg_modified(int arg, uint val); |
duke@435 | 566 | |
duke@435 | 567 | bool is_arg_local(int i) const; |
duke@435 | 568 | bool is_arg_stack(int i) const; |
duke@435 | 569 | bool is_arg_returned(int i) const; |
kvn@480 | 570 | uint arg_modified(int arg) const; |
duke@435 | 571 | |
roland@5987 | 572 | ciParametersTypeData* parameters_type_data() const { |
roland@5987 | 573 | return _parameters != NULL ? new ciParametersTypeData(_parameters) : NULL; |
roland@5987 | 574 | } |
roland@5987 | 575 | |
duke@435 | 576 | // Code generation helper |
duke@435 | 577 | ByteSize offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data); |
duke@435 | 578 | 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 | 579 | |
duke@435 | 580 | #ifndef PRODUCT |
duke@435 | 581 | // printing support for method data |
duke@435 | 582 | void print(); |
duke@435 | 583 | void print_data_on(outputStream* st); |
duke@435 | 584 | #endif |
minqi@4267 | 585 | void dump_replay_data(outputStream* out); |
duke@435 | 586 | }; |
stefank@2314 | 587 | |
stefank@2314 | 588 | #endif // SHARE_VM_CI_CIMETHODDATA_HPP |