annotate src/share/vm/oops/methodData.hpp @ 5486:ce0cc25bc5e2

8026054: New type profiling points: type of return values at calls Summary: x86 interpreter and c1 type profiling for return values at calls Reviewed-by: kvn, twisti
author roland
date Sat, 12 Oct 2013 12:12:59 +0200
parents d13d7aba8c12
children 5ccbab1c69f3
rev   line source
duke@0 1 /*
acorn@4062 2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
trims@1472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 * or visit www.oracle.com if you need additional information or have any
trims@1472 21 * questions.
duke@0 22 *
duke@0 23 */
duke@0 24
stefank@1879 25 #ifndef SHARE_VM_OOPS_METHODDATAOOP_HPP
stefank@1879 26 #define SHARE_VM_OOPS_METHODDATAOOP_HPP
stefank@1879 27
stefank@1879 28 #include "interpreter/bytecodes.hpp"
stefank@1879 29 #include "memory/universe.hpp"
coleenp@3602 30 #include "oops/method.hpp"
stefank@1879 31 #include "oops/oop.hpp"
stefank@1879 32 #include "runtime/orderAccess.hpp"
stefank@1879 33
duke@0 34 class BytecodeStream;
acorn@4062 35 class KlassSizeStats;
duke@0 36
duke@0 37 // The MethodData object collects counts and other profile information
duke@0 38 // during zeroth-tier (interpretive) and first-tier execution.
duke@0 39 // The profile is used later by compilation heuristics. Some heuristics
duke@0 40 // enable use of aggressive (or "heroic") optimizations. An aggressive
duke@0 41 // optimization often has a down-side, a corner case that it handles
duke@0 42 // poorly, but which is thought to be rare. The profile provides
duke@0 43 // evidence of this rarity for a given method or even BCI. It allows
duke@0 44 // the compiler to back out of the optimization at places where it
duke@0 45 // has historically been a poor choice. Other heuristics try to use
duke@0 46 // specific information gathered about types observed at a given site.
duke@0 47 //
duke@0 48 // All data in the profile is approximate. It is expected to be accurate
duke@0 49 // on the whole, but the system expects occasional inaccuraces, due to
duke@0 50 // counter overflow, multiprocessor races during data collection, space
duke@0 51 // limitations, missing MDO blocks, etc. Bad or missing data will degrade
duke@0 52 // optimization quality but will not affect correctness. Also, each MDO
duke@0 53 // is marked with its birth-date ("creation_mileage") which can be used
duke@0 54 // to assess the quality ("maturity") of its data.
duke@0 55 //
duke@0 56 // Short (<32-bit) counters are designed to overflow to a known "saturated"
duke@0 57 // state. Also, certain recorded per-BCI events are given one-bit counters
duke@0 58 // which overflow to a saturated state which applied to all counters at
duke@0 59 // that BCI. In other words, there is a small lattice which approximates
duke@0 60 // the ideal of an infinite-precision counter for each event at each BCI,
duke@0 61 // and the lattice quickly "bottoms out" in a state where all counters
duke@0 62 // are taken to be indefinitely large.
duke@0 63 //
duke@0 64 // The reader will find many data races in profile gathering code, starting
duke@0 65 // with invocation counter incrementation. None of these races harm correct
duke@0 66 // execution of the compiled code.
duke@0 67
ysr@941 68 // forward decl
ysr@941 69 class ProfileData;
ysr@941 70
duke@0 71 // DataLayout
duke@0 72 //
duke@0 73 // Overlay for generic profiling data.
duke@0 74 class DataLayout VALUE_OBJ_CLASS_SPEC {
twisti@5291 75 friend class VMStructs;
twisti@5291 76
duke@0 77 private:
duke@0 78 // Every data layout begins with a header. This header
duke@0 79 // contains a tag, which is used to indicate the size/layout
duke@0 80 // of the data, 4 bits of flags, which can be used in any way,
duke@0 81 // 4 bits of trap history (none/one reason/many reasons),
duke@0 82 // and a bci, which is used to tie this piece of data to a
duke@0 83 // specific bci in the bytecodes.
duke@0 84 union {
duke@0 85 intptr_t _bits;
duke@0 86 struct {
duke@0 87 u1 _tag;
duke@0 88 u1 _flags;
duke@0 89 u2 _bci;
duke@0 90 } _struct;
duke@0 91 } _header;
duke@0 92
duke@0 93 // The data layout has an arbitrary number of cells, each sized
duke@0 94 // to accomodate a pointer or an integer.
duke@0 95 intptr_t _cells[1];
duke@0 96
duke@0 97 // Some types of data layouts need a length field.
duke@0 98 static bool needs_array_len(u1 tag);
duke@0 99
duke@0 100 public:
duke@0 101 enum {
duke@0 102 counter_increment = 1
duke@0 103 };
duke@0 104
duke@0 105 enum {
duke@0 106 cell_size = sizeof(intptr_t)
duke@0 107 };
duke@0 108
duke@0 109 // Tag values
duke@0 110 enum {
duke@0 111 no_tag,
duke@0 112 bit_data_tag,
duke@0 113 counter_data_tag,
duke@0 114 jump_data_tag,
duke@0 115 receiver_type_data_tag,
duke@0 116 virtual_call_data_tag,
duke@0 117 ret_data_tag,
duke@0 118 branch_data_tag,
kvn@45 119 multi_branch_data_tag,
roland@5479 120 arg_info_data_tag,
roland@5479 121 call_type_data_tag,
roland@5479 122 virtual_call_type_data_tag
duke@0 123 };
duke@0 124
duke@0 125 enum {
duke@0 126 // The _struct._flags word is formatted as [trap_state:4 | flags:4].
duke@0 127 // The trap state breaks down further as [recompile:1 | reason:3].
duke@0 128 // This further breakdown is defined in deoptimization.cpp.
duke@0 129 // See Deoptimization::trap_state_reason for an assert that
duke@0 130 // trap_bits is big enough to hold reasons < Reason_RECORDED_LIMIT.
duke@0 131 //
duke@0 132 // The trap_state is collected only if ProfileTraps is true.
duke@0 133 trap_bits = 1+3, // 3: enough to distinguish [0..Reason_RECORDED_LIMIT].
duke@0 134 trap_shift = BitsPerByte - trap_bits,
duke@0 135 trap_mask = right_n_bits(trap_bits),
duke@0 136 trap_mask_in_place = (trap_mask << trap_shift),
duke@0 137 flag_limit = trap_shift,
duke@0 138 flag_mask = right_n_bits(flag_limit),
duke@0 139 first_flag = 0
duke@0 140 };
duke@0 141
duke@0 142 // Size computation
duke@0 143 static int header_size_in_bytes() {
duke@0 144 return cell_size;
duke@0 145 }
duke@0 146 static int header_size_in_cells() {
duke@0 147 return 1;
duke@0 148 }
duke@0 149
duke@0 150 static int compute_size_in_bytes(int cell_count) {
duke@0 151 return header_size_in_bytes() + cell_count * cell_size;
duke@0 152 }
duke@0 153
duke@0 154 // Initialization
duke@0 155 void initialize(u1 tag, u2 bci, int cell_count);
duke@0 156
duke@0 157 // Accessors
duke@0 158 u1 tag() {
duke@0 159 return _header._struct._tag;
duke@0 160 }
duke@0 161
duke@0 162 // Return a few bits of trap state. Range is [0..trap_mask].
duke@0 163 // The state tells if traps with zero, one, or many reasons have occurred.
duke@0 164 // It also tells whether zero or many recompilations have occurred.
duke@0 165 // The associated trap histogram in the MDO itself tells whether
duke@0 166 // traps are common or not. If a BCI shows that a trap X has
duke@0 167 // occurred, and the MDO shows N occurrences of X, we make the
duke@0 168 // simplifying assumption that all N occurrences can be blamed
duke@0 169 // on that BCI.
roland@5479 170 int trap_state() const {
duke@0 171 return ((_header._struct._flags >> trap_shift) & trap_mask);
duke@0 172 }
duke@0 173
duke@0 174 void set_trap_state(int new_state) {
duke@0 175 assert(ProfileTraps, "used only under +ProfileTraps");
duke@0 176 uint old_flags = (_header._struct._flags & flag_mask);
duke@0 177 _header._struct._flags = (new_state << trap_shift) | old_flags;
duke@0 178 }
duke@0 179
roland@5479 180 u1 flags() const {
duke@0 181 return _header._struct._flags;
duke@0 182 }
duke@0 183
roland@5479 184 u2 bci() const {
duke@0 185 return _header._struct._bci;
duke@0 186 }
duke@0 187
duke@0 188 void set_header(intptr_t value) {
duke@0 189 _header._bits = value;
duke@0 190 }
duke@0 191 void release_set_header(intptr_t value) {
duke@0 192 OrderAccess::release_store_ptr(&_header._bits, value);
duke@0 193 }
duke@0 194 intptr_t header() {
duke@0 195 return _header._bits;
duke@0 196 }
duke@0 197 void set_cell_at(int index, intptr_t value) {
duke@0 198 _cells[index] = value;
duke@0 199 }
duke@0 200 void release_set_cell_at(int index, intptr_t value) {
duke@0 201 OrderAccess::release_store_ptr(&_cells[index], value);
duke@0 202 }
roland@5479 203 intptr_t cell_at(int index) const {
duke@0 204 return _cells[index];
duke@0 205 }
duke@0 206
duke@0 207 void set_flag_at(int flag_number) {
duke@0 208 assert(flag_number < flag_limit, "oob");
duke@0 209 _header._struct._flags |= (0x1 << flag_number);
duke@0 210 }
roland@5479 211 bool flag_at(int flag_number) const {
duke@0 212 assert(flag_number < flag_limit, "oob");
duke@0 213 return (_header._struct._flags & (0x1 << flag_number)) != 0;
duke@0 214 }
duke@0 215
duke@0 216 // Low-level support for code generation.
duke@0 217 static ByteSize header_offset() {
duke@0 218 return byte_offset_of(DataLayout, _header);
duke@0 219 }
duke@0 220 static ByteSize tag_offset() {
duke@0 221 return byte_offset_of(DataLayout, _header._struct._tag);
duke@0 222 }
duke@0 223 static ByteSize flags_offset() {
duke@0 224 return byte_offset_of(DataLayout, _header._struct._flags);
duke@0 225 }
duke@0 226 static ByteSize bci_offset() {
duke@0 227 return byte_offset_of(DataLayout, _header._struct._bci);
duke@0 228 }
duke@0 229 static ByteSize cell_offset(int index) {
coleenp@2180 230 return byte_offset_of(DataLayout, _cells) + in_ByteSize(index * cell_size);
duke@0 231 }
duke@0 232 // Return a value which, when or-ed as a byte into _flags, sets the flag.
duke@0 233 static int flag_number_to_byte_constant(int flag_number) {
duke@0 234 assert(0 <= flag_number && flag_number < flag_limit, "oob");
duke@0 235 DataLayout temp; temp.set_header(0);
duke@0 236 temp.set_flag_at(flag_number);
duke@0 237 return temp._header._struct._flags;
duke@0 238 }
duke@0 239 // Return a value which, when or-ed as a word into _header, sets the flag.
duke@0 240 static intptr_t flag_mask_to_header_mask(int byte_constant) {
duke@0 241 DataLayout temp; temp.set_header(0);
duke@0 242 temp._header._struct._flags = byte_constant;
duke@0 243 return temp._header._bits;
duke@0 244 }
ysr@941 245
coleenp@3602 246 ProfileData* data_in();
coleenp@3602 247
ysr@941 248 // GC support
coleenp@3602 249 void clean_weak_klass_links(BoolObjectClosure* cl);
duke@0 250 };
duke@0 251
duke@0 252
duke@0 253 // ProfileData class hierarchy
duke@0 254 class ProfileData;
duke@0 255 class BitData;
duke@0 256 class CounterData;
duke@0 257 class ReceiverTypeData;
duke@0 258 class VirtualCallData;
roland@5479 259 class VirtualCallTypeData;
duke@0 260 class RetData;
roland@5479 261 class CallTypeData;
duke@0 262 class JumpData;
duke@0 263 class BranchData;
duke@0 264 class ArrayData;
duke@0 265 class MultiBranchData;
kvn@45 266 class ArgInfoData;
duke@0 267
duke@0 268 // ProfileData
duke@0 269 //
duke@0 270 // A ProfileData object is created to refer to a section of profiling
duke@0 271 // data in a structured way.
duke@0 272 class ProfileData : public ResourceObj {
roland@5479 273 friend class TypeEntries;
roland@5486 274 friend class ReturnTypeEntry;
roland@5479 275 friend class TypeStackSlotEntries;
duke@0 276 private:
duke@0 277 #ifndef PRODUCT
duke@0 278 enum {
duke@0 279 tab_width_one = 16,
duke@0 280 tab_width_two = 36
duke@0 281 };
duke@0 282 #endif // !PRODUCT
duke@0 283
duke@0 284 // This is a pointer to a section of profiling data.
duke@0 285 DataLayout* _data;
duke@0 286
duke@0 287 protected:
duke@0 288 DataLayout* data() { return _data; }
roland@5479 289 const DataLayout* data() const { return _data; }
duke@0 290
duke@0 291 enum {
duke@0 292 cell_size = DataLayout::cell_size
duke@0 293 };
duke@0 294
duke@0 295 public:
duke@0 296 // How many cells are in this?
roland@5479 297 virtual int cell_count() const {
duke@0 298 ShouldNotReachHere();
duke@0 299 return -1;
duke@0 300 }
duke@0 301
duke@0 302 // Return the size of this data.
duke@0 303 int size_in_bytes() {
duke@0 304 return DataLayout::compute_size_in_bytes(cell_count());
duke@0 305 }
duke@0 306
duke@0 307 protected:
duke@0 308 // Low-level accessors for underlying data
duke@0 309 void set_intptr_at(int index, intptr_t value) {
duke@0 310 assert(0 <= index && index < cell_count(), "oob");
duke@0 311 data()->set_cell_at(index, value);
duke@0 312 }
duke@0 313 void release_set_intptr_at(int index, intptr_t value) {
duke@0 314 assert(0 <= index && index < cell_count(), "oob");
duke@0 315 data()->release_set_cell_at(index, value);
duke@0 316 }
roland@5479 317 intptr_t intptr_at(int index) const {
duke@0 318 assert(0 <= index && index < cell_count(), "oob");
duke@0 319 return data()->cell_at(index);
duke@0 320 }
duke@0 321 void set_uint_at(int index, uint value) {
duke@0 322 set_intptr_at(index, (intptr_t) value);
duke@0 323 }
duke@0 324 void release_set_uint_at(int index, uint value) {
duke@0 325 release_set_intptr_at(index, (intptr_t) value);
duke@0 326 }
roland@5479 327 uint uint_at(int index) const {
duke@0 328 return (uint)intptr_at(index);
duke@0 329 }
duke@0 330 void set_int_at(int index, int value) {
duke@0 331 set_intptr_at(index, (intptr_t) value);
duke@0 332 }
duke@0 333 void release_set_int_at(int index, int value) {
duke@0 334 release_set_intptr_at(index, (intptr_t) value);
duke@0 335 }
roland@5479 336 int int_at(int index) const {
duke@0 337 return (int)intptr_at(index);
duke@0 338 }
roland@5479 339 int int_at_unchecked(int index) const {
duke@0 340 return (int)data()->cell_at(index);
duke@0 341 }
duke@0 342 void set_oop_at(int index, oop value) {
hseigel@5349 343 set_intptr_at(index, cast_from_oop<intptr_t>(value));
duke@0 344 }
roland@5479 345 oop oop_at(int index) const {
hseigel@5349 346 return cast_to_oop(intptr_at(index));
duke@0 347 }
duke@0 348
duke@0 349 void set_flag_at(int flag_number) {
duke@0 350 data()->set_flag_at(flag_number);
duke@0 351 }
roland@5479 352 bool flag_at(int flag_number) const {
duke@0 353 return data()->flag_at(flag_number);
duke@0 354 }
duke@0 355
duke@0 356 // two convenient imports for use by subclasses:
duke@0 357 static ByteSize cell_offset(int index) {
duke@0 358 return DataLayout::cell_offset(index);
duke@0 359 }
duke@0 360 static int flag_number_to_byte_constant(int flag_number) {
duke@0 361 return DataLayout::flag_number_to_byte_constant(flag_number);
duke@0 362 }
duke@0 363
duke@0 364 ProfileData(DataLayout* data) {
duke@0 365 _data = data;
duke@0 366 }
duke@0 367
duke@0 368 public:
duke@0 369 // Constructor for invalid ProfileData.
duke@0 370 ProfileData();
duke@0 371
roland@5479 372 u2 bci() const {
duke@0 373 return data()->bci();
duke@0 374 }
duke@0 375
duke@0 376 address dp() {
duke@0 377 return (address)_data;
duke@0 378 }
duke@0 379
roland@5479 380 int trap_state() const {
duke@0 381 return data()->trap_state();
duke@0 382 }
duke@0 383 void set_trap_state(int new_state) {
duke@0 384 data()->set_trap_state(new_state);
duke@0 385 }
duke@0 386
duke@0 387 // Type checking
roland@5479 388 virtual bool is_BitData() const { return false; }
roland@5479 389 virtual bool is_CounterData() const { return false; }
roland@5479 390 virtual bool is_JumpData() const { return false; }
roland@5479 391 virtual bool is_ReceiverTypeData()const { return false; }
roland@5479 392 virtual bool is_VirtualCallData() const { return false; }
roland@5479 393 virtual bool is_RetData() const { return false; }
roland@5479 394 virtual bool is_BranchData() const { return false; }
roland@5479 395 virtual bool is_ArrayData() const { return false; }
roland@5479 396 virtual bool is_MultiBranchData() const { return false; }
roland@5479 397 virtual bool is_ArgInfoData() const { return false; }
roland@5479 398 virtual bool is_CallTypeData() const { return false; }
roland@5479 399 virtual bool is_VirtualCallTypeData()const { return false; }
kvn@45 400
duke@0 401
roland@5479 402 BitData* as_BitData() const {
duke@0 403 assert(is_BitData(), "wrong type");
duke@0 404 return is_BitData() ? (BitData*) this : NULL;
duke@0 405 }
roland@5479 406 CounterData* as_CounterData() const {
duke@0 407 assert(is_CounterData(), "wrong type");
duke@0 408 return is_CounterData() ? (CounterData*) this : NULL;
duke@0 409 }
roland@5479 410 JumpData* as_JumpData() const {
duke@0 411 assert(is_JumpData(), "wrong type");
duke@0 412 return is_JumpData() ? (JumpData*) this : NULL;
duke@0 413 }
roland@5479 414 ReceiverTypeData* as_ReceiverTypeData() const {
duke@0 415 assert(is_ReceiverTypeData(), "wrong type");
duke@0 416 return is_ReceiverTypeData() ? (ReceiverTypeData*)this : NULL;
duke@0 417 }
roland@5479 418 VirtualCallData* as_VirtualCallData() const {
duke@0 419 assert(is_VirtualCallData(), "wrong type");
duke@0 420 return is_VirtualCallData() ? (VirtualCallData*)this : NULL;
duke@0 421 }
roland@5479 422 RetData* as_RetData() const {
duke@0 423 assert(is_RetData(), "wrong type");
duke@0 424 return is_RetData() ? (RetData*) this : NULL;
duke@0 425 }
roland@5479 426 BranchData* as_BranchData() const {
duke@0 427 assert(is_BranchData(), "wrong type");
duke@0 428 return is_BranchData() ? (BranchData*) this : NULL;
duke@0 429 }
roland@5479 430 ArrayData* as_ArrayData() const {
duke@0 431 assert(is_ArrayData(), "wrong type");
duke@0 432 return is_ArrayData() ? (ArrayData*) this : NULL;
duke@0 433 }
roland@5479 434 MultiBranchData* as_MultiBranchData() const {
duke@0 435 assert(is_MultiBranchData(), "wrong type");
duke@0 436 return is_MultiBranchData() ? (MultiBranchData*)this : NULL;
duke@0 437 }
roland@5479 438 ArgInfoData* as_ArgInfoData() const {
kvn@45 439 assert(is_ArgInfoData(), "wrong type");
kvn@45 440 return is_ArgInfoData() ? (ArgInfoData*)this : NULL;
kvn@45 441 }
roland@5479 442 CallTypeData* as_CallTypeData() const {
roland@5479 443 assert(is_CallTypeData(), "wrong type");
roland@5479 444 return is_CallTypeData() ? (CallTypeData*)this : NULL;
roland@5479 445 }
roland@5479 446 VirtualCallTypeData* as_VirtualCallTypeData() const {
roland@5479 447 assert(is_VirtualCallTypeData(), "wrong type");
roland@5479 448 return is_VirtualCallTypeData() ? (VirtualCallTypeData*)this : NULL;
roland@5479 449 }
duke@0 450
duke@0 451
duke@0 452 // Subclass specific initialization
coleenp@3602 453 virtual void post_initialize(BytecodeStream* stream, MethodData* mdo) {}
duke@0 454
duke@0 455 // GC support
coleenp@3602 456 virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure) {}
duke@0 457
duke@0 458 // CI translation: ProfileData can represent both MethodDataOop data
duke@0 459 // as well as CIMethodData data. This function is provided for translating
duke@0 460 // an oop in a ProfileData to the ci equivalent. Generally speaking,
duke@0 461 // most ProfileData don't require any translation, so we provide the null
duke@0 462 // translation here, and the required translators are in the ci subclasses.
roland@5479 463 virtual void translate_from(const ProfileData* data) {}
duke@0 464
roland@5479 465 virtual void print_data_on(outputStream* st) const {
duke@0 466 ShouldNotReachHere();
duke@0 467 }
duke@0 468
duke@0 469 #ifndef PRODUCT
roland@5479 470 void print_shared(outputStream* st, const char* name) const;
roland@5479 471 void tab(outputStream* st, bool first = false) const;
duke@0 472 #endif
duke@0 473 };
duke@0 474
duke@0 475 // BitData
duke@0 476 //
duke@0 477 // A BitData holds a flag or two in its header.
duke@0 478 class BitData : public ProfileData {
duke@0 479 protected:
duke@0 480 enum {
duke@0 481 // null_seen:
duke@0 482 // saw a null operand (cast/aastore/instanceof)
duke@0 483 null_seen_flag = DataLayout::first_flag + 0
duke@0 484 };
duke@0 485 enum { bit_cell_count = 0 }; // no additional data fields needed.
duke@0 486 public:
duke@0 487 BitData(DataLayout* layout) : ProfileData(layout) {
duke@0 488 }
duke@0 489
roland@5479 490 virtual bool is_BitData() const { return true; }
duke@0 491
duke@0 492 static int static_cell_count() {
duke@0 493 return bit_cell_count;
duke@0 494 }
duke@0 495
roland@5479 496 virtual int cell_count() const {
duke@0 497 return static_cell_count();
duke@0 498 }
duke@0 499
duke@0 500 // Accessor
duke@0 501
duke@0 502 // The null_seen flag bit is specially known to the interpreter.
duke@0 503 // Consulting it allows the compiler to avoid setting up null_check traps.
duke@0 504 bool null_seen() { return flag_at(null_seen_flag); }
duke@0 505 void set_null_seen() { set_flag_at(null_seen_flag); }
duke@0 506
duke@0 507
duke@0 508 // Code generation support
duke@0 509 static int null_seen_byte_constant() {
duke@0 510 return flag_number_to_byte_constant(null_seen_flag);
duke@0 511 }
duke@0 512
duke@0 513 static ByteSize bit_data_size() {
duke@0 514 return cell_offset(bit_cell_count);
duke@0 515 }
duke@0 516
duke@0 517 #ifndef PRODUCT
roland@5479 518 void print_data_on(outputStream* st) const;
duke@0 519 #endif
duke@0 520 };
duke@0 521
duke@0 522 // CounterData
duke@0 523 //
duke@0 524 // A CounterData corresponds to a simple counter.
duke@0 525 class CounterData : public BitData {
duke@0 526 protected:
duke@0 527 enum {
duke@0 528 count_off,
duke@0 529 counter_cell_count
duke@0 530 };
duke@0 531 public:
duke@0 532 CounterData(DataLayout* layout) : BitData(layout) {}
duke@0 533
roland@5479 534 virtual bool is_CounterData() const { return true; }
duke@0 535
duke@0 536 static int static_cell_count() {
duke@0 537 return counter_cell_count;
duke@0 538 }
duke@0 539
roland@5479 540 virtual int cell_count() const {
duke@0 541 return static_cell_count();
duke@0 542 }
duke@0 543
duke@0 544 // Direct accessor
roland@5479 545 uint count() const {
duke@0 546 return uint_at(count_off);
duke@0 547 }
duke@0 548
duke@0 549 // Code generation support
duke@0 550 static ByteSize count_offset() {
duke@0 551 return cell_offset(count_off);
duke@0 552 }
duke@0 553 static ByteSize counter_data_size() {
duke@0 554 return cell_offset(counter_cell_count);
duke@0 555 }
duke@0 556
kvn@1251 557 void set_count(uint count) {
kvn@1251 558 set_uint_at(count_off, count);
kvn@1251 559 }
kvn@1251 560
duke@0 561 #ifndef PRODUCT
roland@5479 562 void print_data_on(outputStream* st) const;
duke@0 563 #endif
duke@0 564 };
duke@0 565
duke@0 566 // JumpData
duke@0 567 //
duke@0 568 // A JumpData is used to access profiling information for a direct
duke@0 569 // branch. It is a counter, used for counting the number of branches,
duke@0 570 // plus a data displacement, used for realigning the data pointer to
duke@0 571 // the corresponding target bci.
duke@0 572 class JumpData : public ProfileData {
duke@0 573 protected:
duke@0 574 enum {
duke@0 575 taken_off_set,
duke@0 576 displacement_off_set,
duke@0 577 jump_cell_count
duke@0 578 };
duke@0 579
duke@0 580 void set_displacement(int displacement) {
duke@0 581 set_int_at(displacement_off_set, displacement);
duke@0 582 }
duke@0 583
duke@0 584 public:
duke@0 585 JumpData(DataLayout* layout) : ProfileData(layout) {
duke@0 586 assert(layout->tag() == DataLayout::jump_data_tag ||
duke@0 587 layout->tag() == DataLayout::branch_data_tag, "wrong type");
duke@0 588 }
duke@0 589
roland@5479 590 virtual bool is_JumpData() const { return true; }
duke@0 591
duke@0 592 static int static_cell_count() {
duke@0 593 return jump_cell_count;
duke@0 594 }
duke@0 595
roland@5479 596 virtual int cell_count() const {
duke@0 597 return static_cell_count();
duke@0 598 }
duke@0 599
duke@0 600 // Direct accessor
roland@5479 601 uint taken() const {
duke@0 602 return uint_at(taken_off_set);
duke@0 603 }
never@2670 604
never@2670 605 void set_taken(uint cnt) {
never@2670 606 set_uint_at(taken_off_set, cnt);
never@2670 607 }
never@2670 608
duke@0 609 // Saturating counter
duke@0 610 uint inc_taken() {
duke@0 611 uint cnt = taken() + 1;
duke@0 612 // Did we wrap? Will compiler screw us??
duke@0 613 if (cnt == 0) cnt--;
duke@0 614 set_uint_at(taken_off_set, cnt);
duke@0 615 return cnt;
duke@0 616 }
duke@0 617
roland@5479 618 int displacement() const {
duke@0 619 return int_at(displacement_off_set);
duke@0 620 }
duke@0 621
duke@0 622 // Code generation support
duke@0 623 static ByteSize taken_offset() {
duke@0 624 return cell_offset(taken_off_set);
duke@0 625 }
duke@0 626
duke@0 627 static ByteSize displacement_offset() {
duke@0 628 return cell_offset(displacement_off_set);
duke@0 629 }
duke@0 630
duke@0 631 // Specific initialization.
coleenp@3602 632 void post_initialize(BytecodeStream* stream, MethodData* mdo);
duke@0 633
duke@0 634 #ifndef PRODUCT
roland@5479 635 void print_data_on(outputStream* st) const;
roland@5479 636 #endif
roland@5479 637 };
roland@5479 638
roland@5479 639 // Entries in a ProfileData object to record types: it can either be
roland@5479 640 // none (no profile), unknown (conflicting profile data) or a klass if
roland@5479 641 // a single one is seen. Whether a null reference was seen is also
roland@5479 642 // recorded. No counter is associated with the type and a single type
roland@5479 643 // is tracked (unlike VirtualCallData).
roland@5479 644 class TypeEntries {
roland@5479 645
roland@5479 646 public:
roland@5479 647
roland@5479 648 // A single cell is used to record information for a type:
roland@5479 649 // - the cell is initialized to 0
roland@5479 650 // - when a type is discovered it is stored in the cell
roland@5479 651 // - bit zero of the cell is used to record whether a null reference
roland@5479 652 // was encountered or not
roland@5479 653 // - bit 1 is set to record a conflict in the type information
roland@5479 654
roland@5479 655 enum {
roland@5479 656 null_seen = 1,
roland@5479 657 type_mask = ~null_seen,
roland@5479 658 type_unknown = 2,
roland@5479 659 status_bits = null_seen | type_unknown,
roland@5479 660 type_klass_mask = ~status_bits
roland@5479 661 };
roland@5479 662
roland@5479 663 // what to initialize a cell to
roland@5479 664 static intptr_t type_none() {
roland@5479 665 return 0;
roland@5479 666 }
roland@5479 667
roland@5479 668 // null seen = bit 0 set?
roland@5479 669 static bool was_null_seen(intptr_t v) {
roland@5479 670 return (v & null_seen) != 0;
roland@5479 671 }
roland@5479 672
roland@5479 673 // conflicting type information = bit 1 set?
roland@5479 674 static bool is_type_unknown(intptr_t v) {
roland@5479 675 return (v & type_unknown) != 0;
roland@5479 676 }
roland@5479 677
roland@5479 678 // not type information yet = all bits cleared, ignoring bit 0?
roland@5479 679 static bool is_type_none(intptr_t v) {
roland@5479 680 return (v & type_mask) == 0;
roland@5479 681 }
roland@5479 682
roland@5479 683 // recorded type: cell without bit 0 and 1
roland@5479 684 static intptr_t klass_part(intptr_t v) {
roland@5479 685 intptr_t r = v & type_klass_mask;
roland@5479 686 assert (r != 0, "invalid");
roland@5479 687 return r;
roland@5479 688 }
roland@5479 689
roland@5479 690 // type recorded
roland@5479 691 static Klass* valid_klass(intptr_t k) {
roland@5479 692 if (!is_type_none(k) &&
roland@5479 693 !is_type_unknown(k)) {
roland@5479 694 return (Klass*)klass_part(k);
roland@5479 695 } else {
roland@5479 696 return NULL;
roland@5479 697 }
roland@5479 698 }
roland@5479 699
roland@5479 700 static intptr_t with_status(intptr_t k, intptr_t in) {
roland@5479 701 return k | (in & status_bits);
roland@5479 702 }
roland@5479 703
roland@5479 704 static intptr_t with_status(Klass* k, intptr_t in) {
roland@5479 705 return with_status((intptr_t)k, in);
roland@5479 706 }
roland@5479 707
roland@5479 708 #ifndef PRODUCT
roland@5479 709 static void print_klass(outputStream* st, intptr_t k);
roland@5479 710 #endif
roland@5479 711
roland@5479 712 // GC support
roland@5479 713 static bool is_loader_alive(BoolObjectClosure* is_alive_cl, intptr_t p);
roland@5479 714
roland@5479 715 protected:
roland@5479 716 // ProfileData object these entries are part of
roland@5479 717 ProfileData* _pd;
roland@5479 718 // offset within the ProfileData object where the entries start
roland@5479 719 const int _base_off;
roland@5479 720
roland@5479 721 TypeEntries(int base_off)
roland@5479 722 : _base_off(base_off), _pd(NULL) {}
roland@5479 723
roland@5479 724 void set_intptr_at(int index, intptr_t value) {
roland@5479 725 _pd->set_intptr_at(index, value);
roland@5479 726 }
roland@5479 727
roland@5479 728 intptr_t intptr_at(int index) const {
roland@5479 729 return _pd->intptr_at(index);
roland@5479 730 }
roland@5479 731
roland@5479 732 public:
roland@5479 733 void set_profile_data(ProfileData* pd) {
roland@5479 734 _pd = pd;
roland@5479 735 }
roland@5479 736 };
roland@5479 737
roland@5479 738 // Type entries used for arguments passed at a call and parameters on
roland@5479 739 // method entry. 2 cells per entry: one for the type encoded as in
roland@5479 740 // TypeEntries and one initialized with the stack slot where the
roland@5479 741 // profiled object is to be found so that the interpreter can locate
roland@5479 742 // it quickly.
roland@5479 743 class TypeStackSlotEntries : public TypeEntries {
roland@5479 744
roland@5479 745 private:
roland@5479 746 enum {
roland@5479 747 stack_slot_entry,
roland@5479 748 type_entry,
roland@5479 749 per_arg_cell_count
roland@5479 750 };
roland@5479 751
roland@5479 752 // offset of cell for stack slot for entry i within ProfileData object
roland@5486 753 int stack_slot_offset(int i) const {
roland@5479 754 return _base_off + stack_slot_local_offset(i);
roland@5479 755 }
roland@5479 756
roland@5479 757 protected:
roland@5486 758 const int _number_of_entries;
roland@5479 759
roland@5479 760 // offset of cell for type for entry i within ProfileData object
roland@5486 761 int type_offset(int i) const {
roland@5479 762 return _base_off + type_local_offset(i);
roland@5479 763 }
roland@5479 764
roland@5479 765 public:
roland@5479 766
roland@5486 767 TypeStackSlotEntries(int base_off, int nb_entries)
roland@5486 768 : TypeEntries(base_off), _number_of_entries(nb_entries) {}
roland@5479 769
roland@5486 770 static int compute_cell_count(Symbol* signature, int max);
roland@5479 771
roland@5486 772 void post_initialize(Symbol* signature, bool has_receiver);
roland@5479 773
roland@5479 774 // offset of cell for stack slot for entry i within this block of cells for a TypeStackSlotEntries
roland@5479 775 static int stack_slot_local_offset(int i) {
roland@5486 776 return i * per_arg_cell_count + stack_slot_entry;
roland@5479 777 }
roland@5479 778
roland@5479 779 // offset of cell for type for entry i within this block of cells for a TypeStackSlotEntries
roland@5479 780 static int type_local_offset(int i) {
roland@5486 781 return i * per_arg_cell_count + type_entry;
roland@5479 782 }
roland@5479 783
roland@5479 784 // stack slot for entry i
roland@5479 785 uint stack_slot(int i) const {
roland@5486 786 assert(i >= 0 && i < _number_of_entries, "oob");
roland@5486 787 return _pd->uint_at(stack_slot_offset(i));
roland@5479 788 }
roland@5479 789
roland@5479 790 // set stack slot for entry i
roland@5479 791 void set_stack_slot(int i, uint num) {
roland@5486 792 assert(i >= 0 && i < _number_of_entries, "oob");
roland@5486 793 _pd->set_uint_at(stack_slot_offset(i), num);
roland@5479 794 }
roland@5479 795
roland@5479 796 // type for entry i
roland@5479 797 intptr_t type(int i) const {
roland@5486 798 assert(i >= 0 && i < _number_of_entries, "oob");
roland@5486 799 return _pd->intptr_at(type_offset(i));
roland@5479 800 }
roland@5479 801
roland@5479 802 // set type for entry i
roland@5479 803 void set_type(int i, intptr_t k) {
roland@5486 804 assert(i >= 0 && i < _number_of_entries, "oob");
roland@5486 805 _pd->set_intptr_at(type_offset(i), k);
roland@5479 806 }
roland@5479 807
roland@5479 808 static ByteSize per_arg_size() {
roland@5479 809 return in_ByteSize(per_arg_cell_count * DataLayout::cell_size);
roland@5479 810 }
roland@5479 811
roland@5479 812 static int per_arg_count() {
roland@5479 813 return per_arg_cell_count ;
roland@5479 814 }
roland@5479 815
roland@5486 816 // GC support
roland@5486 817 void clean_weak_klass_links(BoolObjectClosure* is_alive_closure);
roland@5479 818
roland@5486 819 #ifndef PRODUCT
roland@5486 820 void print_data_on(outputStream* st) const;
roland@5486 821 #endif
roland@5486 822 };
roland@5479 823
roland@5486 824 // Type entry used for return from a call. A single cell to record the
roland@5486 825 // type.
roland@5486 826 class ReturnTypeEntry : public TypeEntries {
roland@5479 827
roland@5486 828 private:
roland@5486 829 enum {
roland@5486 830 cell_count = 1
roland@5486 831 };
roland@5486 832
roland@5486 833 public:
roland@5486 834 ReturnTypeEntry(int base_off)
roland@5486 835 : TypeEntries(base_off) {}
roland@5486 836
roland@5486 837 void post_initialize() {
roland@5486 838 set_type(type_none());
roland@5486 839 }
roland@5486 840
roland@5486 841 intptr_t type() const {
roland@5486 842 return _pd->intptr_at(_base_off);
roland@5486 843 }
roland@5486 844
roland@5486 845 void set_type(intptr_t k) {
roland@5486 846 _pd->set_intptr_at(_base_off, k);
roland@5486 847 }
roland@5486 848
roland@5486 849 static int static_cell_count() {
roland@5486 850 return cell_count;
roland@5486 851 }
roland@5486 852
roland@5486 853 static ByteSize size() {
roland@5486 854 return in_ByteSize(cell_count * DataLayout::cell_size);
roland@5486 855 }
roland@5486 856
roland@5486 857 ByteSize type_offset() {
roland@5486 858 return DataLayout::cell_offset(_base_off);
roland@5486 859 }
roland@5479 860
roland@5479 861 // GC support
roland@5479 862 void clean_weak_klass_links(BoolObjectClosure* is_alive_closure);
roland@5479 863
roland@5479 864 #ifndef PRODUCT
roland@5479 865 void print_data_on(outputStream* st) const;
roland@5479 866 #endif
roland@5479 867 };
roland@5479 868
roland@5486 869 // Entries to collect type information at a call: contains arguments
roland@5486 870 // (TypeStackSlotEntries), a return type (ReturnTypeEntry) and a
roland@5486 871 // number of cells. Because the number of cells for the return type is
roland@5486 872 // smaller than the number of cells for the type of an arguments, the
roland@5486 873 // number of cells is used to tell how many arguments are profiled and
roland@5486 874 // whether a return value is profiled. See has_arguments() and
roland@5486 875 // has_return().
roland@5486 876 class TypeEntriesAtCall {
roland@5486 877 private:
roland@5486 878 static int stack_slot_local_offset(int i) {
roland@5486 879 return header_cell_count() + TypeStackSlotEntries::stack_slot_local_offset(i);
roland@5486 880 }
roland@5486 881
roland@5486 882 static int argument_type_local_offset(int i) {
roland@5486 883 return header_cell_count() + TypeStackSlotEntries::type_local_offset(i);;
roland@5486 884 }
roland@5486 885
roland@5486 886 public:
roland@5486 887
roland@5486 888 static int header_cell_count() {
roland@5486 889 return 1;
roland@5486 890 }
roland@5486 891
roland@5486 892 static int cell_count_local_offset() {
roland@5486 893 return 0;
roland@5486 894 }
roland@5486 895
roland@5486 896 static int compute_cell_count(BytecodeStream* stream);
roland@5486 897
roland@5486 898 static void initialize(DataLayout* dl, int base, int cell_count) {
roland@5486 899 int off = base + cell_count_local_offset();
roland@5486 900 dl->set_cell_at(off, cell_count - base - header_cell_count());
roland@5486 901 }
roland@5486 902
roland@5486 903 static bool arguments_profiling_enabled();
roland@5486 904 static bool return_profiling_enabled();
roland@5486 905
roland@5486 906 // Code generation support
roland@5486 907 static ByteSize cell_count_offset() {
roland@5486 908 return in_ByteSize(cell_count_local_offset() * DataLayout::cell_size);
roland@5486 909 }
roland@5486 910
roland@5486 911 static ByteSize args_data_offset() {
roland@5486 912 return in_ByteSize(header_cell_count() * DataLayout::cell_size);
roland@5486 913 }
roland@5486 914
roland@5486 915 static ByteSize stack_slot_offset(int i) {
roland@5486 916 return in_ByteSize(stack_slot_local_offset(i) * DataLayout::cell_size);
roland@5486 917 }
roland@5486 918
roland@5486 919 static ByteSize argument_type_offset(int i) {
roland@5486 920 return in_ByteSize(argument_type_local_offset(i) * DataLayout::cell_size);
roland@5486 921 }
roland@5486 922 };
roland@5486 923
roland@5479 924 // CallTypeData
roland@5479 925 //
roland@5479 926 // A CallTypeData is used to access profiling information about a non
roland@5486 927 // virtual call for which we collect type information about arguments
roland@5486 928 // and return value.
roland@5479 929 class CallTypeData : public CounterData {
roland@5479 930 private:
roland@5486 931 // entries for arguments if any
roland@5479 932 TypeStackSlotEntries _args;
roland@5486 933 // entry for return type if any
roland@5486 934 ReturnTypeEntry _ret;
roland@5486 935
roland@5486 936 int cell_count_global_offset() const {
roland@5486 937 return CounterData::static_cell_count() + TypeEntriesAtCall::cell_count_local_offset();
roland@5486 938 }
roland@5486 939
roland@5486 940 // number of cells not counting the header
roland@5486 941 int cell_count_no_header() const {
roland@5486 942 return uint_at(cell_count_global_offset());
roland@5486 943 }
roland@5486 944
roland@5486 945 void check_number_of_arguments(int total) {
roland@5486 946 assert(number_of_arguments() == total, "should be set in DataLayout::initialize");
roland@5486 947 }
roland@5486 948
roland@5486 949 protected:
roland@5486 950 // An entry for a return value takes less space than an entry for an
roland@5486 951 // argument so if the number of cells exceeds the number of cells
roland@5486 952 // needed for an argument, this object contains type information for
roland@5486 953 // at least one argument.
roland@5486 954 bool has_arguments() const {
roland@5486 955 bool res = cell_count_no_header() >= TypeStackSlotEntries::per_arg_count();
roland@5486 956 assert (!res || TypeEntriesAtCall::arguments_profiling_enabled(), "no profiling of arguments");
roland@5486 957 return res;
roland@5486 958 }
roland@5479 959
roland@5479 960 public:
roland@5479 961 CallTypeData(DataLayout* layout) :
roland@5486 962 CounterData(layout),
roland@5486 963 _args(CounterData::static_cell_count()+TypeEntriesAtCall::header_cell_count(), number_of_arguments()),
roland@5486 964 _ret(cell_count() - ReturnTypeEntry::static_cell_count())
roland@5486 965 {
roland@5479 966 assert(layout->tag() == DataLayout::call_type_data_tag, "wrong type");
roland@5479 967 // Some compilers (VC++) don't want this passed in member initialization list
roland@5479 968 _args.set_profile_data(this);
roland@5486 969 _ret.set_profile_data(this);
roland@5479 970 }
roland@5479 971
roland@5486 972 const TypeStackSlotEntries* args() const {
roland@5486 973 assert(has_arguments(), "no profiling of arguments");
roland@5486 974 return &_args;
roland@5486 975 }
roland@5486 976
roland@5486 977 const ReturnTypeEntry* ret() const {
roland@5486 978 assert(has_return(), "no profiling of return value");
roland@5486 979 return &_ret;
roland@5486 980 }
roland@5479 981
roland@5479 982 virtual bool is_CallTypeData() const { return true; }
roland@5479 983
roland@5479 984 static int static_cell_count() {
roland@5479 985 return -1;
roland@5479 986 }
roland@5479 987
roland@5479 988 static int compute_cell_count(BytecodeStream* stream) {
roland@5486 989 return CounterData::static_cell_count() + TypeEntriesAtCall::compute_cell_count(stream);
roland@5479 990 }
roland@5479 991
roland@5479 992 static void initialize(DataLayout* dl, int cell_count) {
roland@5486 993 TypeEntriesAtCall::initialize(dl, CounterData::static_cell_count(), cell_count);
roland@5479 994 }
roland@5479 995
roland@5486 996 virtual void post_initialize(BytecodeStream* stream, MethodData* mdo);
roland@5486 997
roland@5486 998 virtual int cell_count() const {
roland@5486 999 return CounterData::static_cell_count() +
roland@5486 1000 TypeEntriesAtCall::header_cell_count() +
roland@5486 1001 int_at_unchecked(cell_count_global_offset());
roland@5479 1002 }
roland@5479 1003
roland@5486 1004 int number_of_arguments() const {
roland@5486 1005 return cell_count_no_header() / TypeStackSlotEntries::per_arg_count();
roland@5479 1006 }
roland@5479 1007
roland@5479 1008 void set_argument_type(int i, Klass* k) {
roland@5486 1009 assert(has_arguments(), "no arguments!");
roland@5479 1010 intptr_t current = _args.type(i);
roland@5479 1011 _args.set_type(i, TypeEntries::with_status(k, current));
roland@5479 1012 }
roland@5479 1013
roland@5486 1014 void set_return_type(Klass* k) {
roland@5486 1015 assert(has_return(), "no return!");
roland@5486 1016 intptr_t current = _ret.type();
roland@5486 1017 _ret.set_type(TypeEntries::with_status(k, current));
roland@5486 1018 }
roland@5486 1019
roland@5486 1020 // An entry for a return value takes less space than an entry for an
roland@5486 1021 // argument, so if the remainder of the number of cells divided by
roland@5486 1022 // the number of cells for an argument is not null, a return value
roland@5486 1023 // is profiled in this object.
roland@5486 1024 bool has_return() const {
roland@5486 1025 bool res = (cell_count_no_header() % TypeStackSlotEntries::per_arg_count()) != 0;
roland@5486 1026 assert (!res || TypeEntriesAtCall::return_profiling_enabled(), "no profiling of return values");
roland@5486 1027 return res;
roland@5486 1028 }
roland@5486 1029
roland@5479 1030 // Code generation support
roland@5479 1031 static ByteSize args_data_offset() {
roland@5486 1032 return cell_offset(CounterData::static_cell_count()) + TypeEntriesAtCall::args_data_offset();
roland@5479 1033 }
roland@5479 1034
roland@5479 1035 // GC support
roland@5479 1036 virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure) {
roland@5486 1037 if (has_arguments()) {
roland@5486 1038 _args.clean_weak_klass_links(is_alive_closure);
roland@5486 1039 }
roland@5486 1040 if (has_return()) {
roland@5486 1041 _ret.clean_weak_klass_links(is_alive_closure);
roland@5486 1042 }
roland@5479 1043 }
roland@5479 1044
roland@5479 1045 #ifndef PRODUCT
roland@5479 1046 virtual void print_data_on(outputStream* st) const;
duke@0 1047 #endif
duke@0 1048 };
duke@0 1049
duke@0 1050 // ReceiverTypeData
duke@0 1051 //
duke@0 1052 // A ReceiverTypeData is used to access profiling information about a
duke@0 1053 // dynamic type check. It consists of a counter which counts the total times
coleenp@3602 1054 // that the check is reached, and a series of (Klass*, count) pairs
duke@0 1055 // which are used to store a type profile for the receiver of the check.
duke@0 1056 class ReceiverTypeData : public CounterData {
duke@0 1057 protected:
duke@0 1058 enum {
duke@0 1059 receiver0_offset = counter_cell_count,
duke@0 1060 count0_offset,
duke@0 1061 receiver_type_row_cell_count = (count0_offset + 1) - receiver0_offset
duke@0 1062 };
duke@0 1063
duke@0 1064 public:
duke@0 1065 ReceiverTypeData(DataLayout* layout) : CounterData(layout) {
duke@0 1066 assert(layout->tag() == DataLayout::receiver_type_data_tag ||
roland@5479 1067 layout->tag() == DataLayout::virtual_call_data_tag ||
roland@5479 1068 layout->tag() == DataLayout::virtual_call_type_data_tag, "wrong type");
duke@0 1069 }
duke@0 1070
roland@5479 1071 virtual bool is_ReceiverTypeData() const { return true; }
duke@0 1072
duke@0 1073 static int static_cell_count() {
duke@0 1074 return counter_cell_count + (uint) TypeProfileWidth * receiver_type_row_cell_count;
duke@0 1075 }
duke@0 1076
roland@5479 1077 virtual int cell_count() const {
duke@0 1078 return static_cell_count();
duke@0 1079 }
duke@0 1080
duke@0 1081 // Direct accessors
duke@0 1082 static uint row_limit() {
duke@0 1083 return TypeProfileWidth;
duke@0 1084 }
duke@0 1085 static int receiver_cell_index(uint row) {
duke@0 1086 return receiver0_offset + row * receiver_type_row_cell_count;
duke@0 1087 }
duke@0 1088 static int receiver_count_cell_index(uint row) {
duke@0 1089 return count0_offset + row * receiver_type_row_cell_count;
duke@0 1090 }
duke@0 1091
roland@5479 1092 Klass* receiver(uint row) const {
duke@0 1093 assert(row < row_limit(), "oob");
duke@0 1094
coleenp@3602 1095 Klass* recv = (Klass*)intptr_at(receiver_cell_index(row));
coleenp@3602 1096 assert(recv == NULL || recv->is_klass(), "wrong type");
duke@0 1097 return recv;
duke@0 1098 }
duke@0 1099
coleenp@3602 1100 void set_receiver(uint row, Klass* k) {
ysr@941 1101 assert((uint)row < row_limit(), "oob");
coleenp@3602 1102 set_intptr_at(receiver_cell_index(row), (uintptr_t)k);
ysr@941 1103 }
ysr@941 1104
roland@5479 1105 uint receiver_count(uint row) const {
duke@0 1106 assert(row < row_limit(), "oob");
duke@0 1107 return uint_at(receiver_count_cell_index(row));
duke@0 1108 }
duke@0 1109
ysr@941 1110 void set_receiver_count(uint row, uint count) {
ysr@941 1111 assert(row < row_limit(), "oob");
ysr@941 1112 set_uint_at(receiver_count_cell_index(row), count);
ysr@941 1113 }
ysr@941 1114
ysr@941 1115 void clear_row(uint row) {
ysr@941 1116 assert(row < row_limit(), "oob");
kvn@1251 1117 // Clear total count - indicator of polymorphic call site.
kvn@1251 1118 // The site may look like as monomorphic after that but
kvn@1251 1119 // it allow to have more accurate profiling information because
kvn@1251 1120 // there was execution phase change since klasses were unloaded.
kvn@1251 1121 // If the site is still polymorphic then MDO will be updated
kvn@1251 1122 // to reflect it. But it could be the case that the site becomes
kvn@1251 1123 // only bimorphic. Then keeping total count not 0 will be wrong.
kvn@1251 1124 // Even if we use monomorphic (when it is not) for compilation
kvn@1251 1125 // we will only have trap, deoptimization and recompile again
kvn@1251 1126 // with updated MDO after executing method in Interpreter.
kvn@1251 1127 // An additional receiver will be recorded in the cleaned row
kvn@1251 1128 // during next call execution.
kvn@1251 1129 //
kvn@1251 1130 // Note: our profiling logic works with empty rows in any slot.
kvn@1251 1131 // We do sorting a profiling info (ciCallProfile) for compilation.
kvn@1251 1132 //
kvn@1251 1133 set_count(0);
ysr@941 1134 set_receiver(row, NULL);
ysr@941 1135 set_receiver_count(row, 0);
ysr@941 1136 }
ysr@941 1137
duke@0 1138 // Code generation support
duke@0 1139 static ByteSize receiver_offset(uint row) {
duke@0 1140 return cell_offset(receiver_cell_index(row));
duke@0 1141 }
duke@0 1142 static ByteSize receiver_count_offset(uint row) {
duke@0 1143 return cell_offset(receiver_count_cell_index(row));
duke@0 1144 }
duke@0 1145 static ByteSize receiver_type_data_size() {
duke@0 1146 return cell_offset(static_cell_count());
duke@0 1147 }
duke@0 1148
duke@0 1149 // GC support
coleenp@3602 1150 virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure);
duke@0 1151
duke@0 1152 #ifndef PRODUCT
roland@5479 1153 void print_receiver_data_on(outputStream* st) const;
roland@5479 1154 void print_data_on(outputStream* st) const;
duke@0 1155 #endif
duke@0 1156 };
duke@0 1157
duke@0 1158 // VirtualCallData
duke@0 1159 //
duke@0 1160 // A VirtualCallData is used to access profiling information about a
duke@0 1161 // virtual call. For now, it has nothing more than a ReceiverTypeData.
duke@0 1162 class VirtualCallData : public ReceiverTypeData {
duke@0 1163 public:
duke@0 1164 VirtualCallData(DataLayout* layout) : ReceiverTypeData(layout) {
roland@5479 1165 assert(layout->tag() == DataLayout::virtual_call_data_tag ||
roland@5479 1166 layout->tag() == DataLayout::virtual_call_type_data_tag, "wrong type");
duke@0 1167 }
duke@0 1168
roland@5479 1169 virtual bool is_VirtualCallData() const { return true; }
duke@0 1170
duke@0 1171 static int static_cell_count() {
duke@0 1172 // At this point we could add more profile state, e.g., for arguments.
duke@0 1173 // But for now it's the same size as the base record type.
duke@0 1174 return ReceiverTypeData::static_cell_count();
duke@0 1175 }
duke@0 1176
roland@5479 1177 virtual int cell_count() const {
duke@0 1178 return static_cell_count();
duke@0 1179 }
duke@0 1180
duke@0 1181 // Direct accessors
duke@0 1182 static ByteSize virtual_call_data_size() {
duke@0 1183 return cell_offset(static_cell_count());
duke@0 1184 }
duke@0 1185
duke@0 1186 #ifndef PRODUCT
roland@5479 1187 void print_data_on(outputStream* st) const;
roland@5479 1188 #endif
roland@5479 1189 };
roland@5479 1190
roland@5479 1191 // VirtualCallTypeData
roland@5479 1192 //
roland@5479 1193 // A VirtualCallTypeData is used to access profiling information about
roland@5479 1194 // a virtual call for which we collect type information about
roland@5486 1195 // arguments and return value.
roland@5479 1196 class VirtualCallTypeData : public VirtualCallData {
roland@5479 1197 private:
roland@5486 1198 // entries for arguments if any
roland@5479 1199 TypeStackSlotEntries _args;
roland@5486 1200 // entry for return type if any
roland@5486 1201 ReturnTypeEntry _ret;
roland@5486 1202
roland@5486 1203 int cell_count_global_offset() const {
roland@5486 1204 return VirtualCallData::static_cell_count() + TypeEntriesAtCall::cell_count_local_offset();
roland@5486 1205 }
roland@5486 1206
roland@5486 1207 // number of cells not counting the header
roland@5486 1208 int cell_count_no_header() const {
roland@5486 1209 return uint_at(cell_count_global_offset());
roland@5486 1210 }
roland@5486 1211
roland@5486 1212 void check_number_of_arguments(int total) {
roland@5486 1213 assert(number_of_arguments() == total, "should be set in DataLayout::initialize");
roland@5486 1214 }
roland@5486 1215
roland@5486 1216 protected:
roland@5486 1217 // An entry for a return value takes less space than an entry for an
roland@5486 1218 // argument so if the number of cells exceeds the number of cells
roland@5486 1219 // needed for an argument, this object contains type information for
roland@5486 1220 // at least one argument.
roland@5486 1221 bool has_arguments() const {
roland@5486 1222 bool res = cell_count_no_header() >= TypeStackSlotEntries::per_arg_count();
roland@5486 1223 assert (!res || TypeEntriesAtCall::arguments_profiling_enabled(), "no profiling of arguments");
roland@5486 1224 return res;
roland@5486 1225 }
roland@5479 1226
roland@5479 1227 public:
roland@5479 1228 VirtualCallTypeData(DataLayout* layout) :
roland@5486 1229 VirtualCallData(layout),
roland@5486 1230 _args(VirtualCallData::static_cell_count()+TypeEntriesAtCall::header_cell_count(), number_of_arguments()),
roland@5486 1231 _ret(cell_count() - ReturnTypeEntry::static_cell_count())
roland@5486 1232 {
roland@5479 1233 assert(layout->tag() == DataLayout::virtual_call_type_data_tag, "wrong type");
roland@5479 1234 // Some compilers (VC++) don't want this passed in member initialization list
roland@5479 1235 _args.set_profile_data(this);
roland@5486 1236 _ret.set_profile_data(this);
roland@5479 1237 }
roland@5479 1238
roland@5486 1239 const TypeStackSlotEntries* args() const {
roland@5486 1240 assert(has_arguments(), "no profiling of arguments");
roland@5486 1241 return &_args;
roland@5486 1242 }
roland@5486 1243
roland@5486 1244 const ReturnTypeEntry* ret() const {
roland@5486 1245 assert(has_return(), "no profiling of return value");
roland@5486 1246 return &_ret;
roland@5486 1247 }
roland@5479 1248
roland@5479 1249 virtual bool is_VirtualCallTypeData() const { return true; }
roland@5479 1250
roland@5479 1251 static int static_cell_count() {
roland@5479 1252 return -1;
roland@5479 1253 }
roland@5479 1254
roland@5479 1255 static int compute_cell_count(BytecodeStream* stream) {
roland@5486 1256 return VirtualCallData::static_cell_count() + TypeEntriesAtCall::compute_cell_count(stream);
roland@5479 1257 }
roland@5479 1258
roland@5479 1259 static void initialize(DataLayout* dl, int cell_count) {
roland@5486 1260 TypeEntriesAtCall::initialize(dl, VirtualCallData::static_cell_count(), cell_count);
roland@5479 1261 }
roland@5479 1262
roland@5486 1263 virtual void post_initialize(BytecodeStream* stream, MethodData* mdo);
roland@5486 1264
roland@5486 1265 virtual int cell_count() const {
roland@5486 1266 return VirtualCallData::static_cell_count() +
roland@5486 1267 TypeEntriesAtCall::header_cell_count() +
roland@5486 1268 int_at_unchecked(cell_count_global_offset());
roland@5479 1269 }
roland@5479 1270
roland@5486 1271 int number_of_arguments() const {
roland@5486 1272 return cell_count_no_header() / TypeStackSlotEntries::per_arg_count();
roland@5479 1273 }
roland@5479 1274
roland@5479 1275 void set_argument_type(int i, Klass* k) {
roland@5486 1276 assert(has_arguments(), "no arguments!");
roland@5479 1277 intptr_t current = _args.type(i);
roland@5479 1278 _args.set_type(i, TypeEntries::with_status(k, current));
roland@5479 1279 }
roland@5479 1280
roland@5486 1281 void set_return_type(Klass* k) {
roland@5486 1282 assert(has_return(), "no return!");
roland@5486 1283 intptr_t current = _ret.type();
roland@5486 1284 _ret.set_type(TypeEntries::with_status(k, current));
roland@5486 1285 }
roland@5486 1286
roland@5486 1287 // An entry for a return value takes less space than an entry for an
roland@5486 1288 // argument, so if the remainder of the number of cells divided by
roland@5486 1289 // the number of cells for an argument is not null, a return value
roland@5486 1290 // is profiled in this object.
roland@5486 1291 bool has_return() const {
roland@5486 1292 bool res = (cell_count_no_header() % TypeStackSlotEntries::per_arg_count()) != 0;
roland@5486 1293 assert (!res || TypeEntriesAtCall::return_profiling_enabled(), "no profiling of return values");
roland@5486 1294 return res;
roland@5486 1295 }
roland@5486 1296
roland@5479 1297 // Code generation support
roland@5479 1298 static ByteSize args_data_offset() {
roland@5486 1299 return cell_offset(VirtualCallData::static_cell_count()) + TypeEntriesAtCall::args_data_offset();
roland@5479 1300 }
roland@5479 1301
roland@5479 1302 // GC support
roland@5479 1303 virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure) {
roland@5479 1304 ReceiverTypeData::clean_weak_klass_links(is_alive_closure);
roland@5486 1305 if (has_arguments()) {
roland@5486 1306 _args.clean_weak_klass_links(is_alive_closure);
roland@5486 1307 }
roland@5486 1308 if (has_return()) {
roland@5486 1309 _ret.clean_weak_klass_links(is_alive_closure);
roland@5486 1310 }
roland@5479 1311 }
roland@5479 1312
roland@5479 1313 #ifndef PRODUCT
roland@5479 1314 virtual void print_data_on(outputStream* st) const;
duke@0 1315 #endif
duke@0 1316 };
duke@0 1317
duke@0 1318 // RetData
duke@0 1319 //
duke@0 1320 // A RetData is used to access profiling information for a ret bytecode.
duke@0 1321 // It is composed of a count of the number of times that the ret has
duke@0 1322 // been executed, followed by a series of triples of the form
duke@0 1323 // (bci, count, di) which count the number of times that some bci was the
duke@0 1324 // target of the ret and cache a corresponding data displacement.
duke@0 1325 class RetData : public CounterData {
duke@0 1326 protected:
duke@0 1327 enum {
duke@0 1328 bci0_offset = counter_cell_count,
duke@0 1329 count0_offset,
duke@0 1330 displacement0_offset,
duke@0 1331 ret_row_cell_count = (displacement0_offset + 1) - bci0_offset
duke@0 1332 };
duke@0 1333
duke@0 1334 void set_bci(uint row, int bci) {
duke@0 1335 assert((uint)row < row_limit(), "oob");
duke@0 1336 set_int_at(bci0_offset + row * ret_row_cell_count, bci);
duke@0 1337 }
duke@0 1338 void release_set_bci(uint row, int bci) {
duke@0 1339 assert((uint)row < row_limit(), "oob");
duke@0 1340 // 'release' when setting the bci acts as a valid flag for other
duke@0 1341 // threads wrt bci_count and bci_displacement.
duke@0 1342 release_set_int_at(bci0_offset + row * ret_row_cell_count, bci);
duke@0 1343 }
duke@0 1344 void set_bci_count(uint row, uint count) {
duke@0 1345 assert((uint)row < row_limit(), "oob");
duke@0 1346 set_uint_at(count0_offset + row * ret_row_cell_count, count);
duke@0 1347 }
duke@0 1348 void set_bci_displacement(uint row, int disp) {
duke@0 1349 set_int_at(displacement0_offset + row * ret_row_cell_count, disp);
duke@0 1350 }
duke@0 1351
duke@0 1352 public:
duke@0 1353 RetData(DataLayout* layout) : CounterData(layout) {
duke@0 1354 assert(layout->tag() == DataLayout::ret_data_tag, "wrong type");
duke@0 1355 }
duke@0 1356
roland@5479 1357 virtual bool is_RetData() const { return true; }
duke@0 1358
duke@0 1359 enum {
duke@0 1360 no_bci = -1 // value of bci when bci1/2 are not in use.
duke@0 1361 };
duke@0 1362
duke@0 1363 static int static_cell_count() {
duke@0 1364 return counter_cell_count + (uint) BciProfileWidth * ret_row_cell_count;
duke@0 1365 }
duke@0 1366
roland@5479 1367 virtual int cell_count() const {
duke@0 1368 return static_cell_count();
duke@0 1369 }
duke@0 1370
duke@0 1371 static uint row_limit() {
duke@0 1372 return BciProfileWidth;
duke@0 1373 }
duke@0 1374 static int bci_cell_index(uint row) {
duke@0 1375 return bci0_offset + row * ret_row_cell_count;
duke@0 1376 }
duke@0 1377 static int bci_count_cell_index(uint row) {
duke@0 1378 return count0_offset + row * ret_row_cell_count;
duke@0 1379 }
duke@0 1380 static int bci_displacement_cell_index(uint row) {
duke@0 1381 return displacement0_offset + row * ret_row_cell_count;
duke@0 1382 }
duke@0 1383
duke@0 1384 // Direct accessors
roland@5479 1385 int bci(uint row) const {
duke@0 1386 return int_at(bci_cell_index(row));
duke@0 1387 }
roland@5479 1388 uint bci_count(uint row) const {
duke@0 1389 return uint_at(bci_count_cell_index(row));
duke@0 1390 }
roland@5479 1391 int bci_displacement(uint row) const {
duke@0 1392 return int_at(bci_displacement_cell_index(row));
duke@0 1393 }
duke@0 1394
duke@0 1395 // Interpreter Runtime support
coleenp@3602 1396 address fixup_ret(int return_bci, MethodData* mdo);
duke@0 1397
duke@0 1398 // Code generation support
duke@0 1399 static ByteSize bci_offset(uint row) {
duke@0 1400 return cell_offset(bci_cell_index(row));
duke@0 1401 }
duke@0 1402 static ByteSize bci_count_offset(uint row) {
duke@0 1403 return cell_offset(bci_count_cell_index(row));
duke@0 1404 }
duke@0 1405 static ByteSize bci_displacement_offset(uint row) {
duke@0 1406 return cell_offset(bci_displacement_cell_index(row));
duke@0 1407 }
duke@0 1408
duke@0 1409 // Specific initialization.
coleenp@3602 1410 void post_initialize(BytecodeStream* stream, MethodData* mdo);
duke@0 1411
duke@0 1412 #ifndef PRODUCT
roland@5479 1413 void print_data_on(outputStream* st) const;
duke@0 1414 #endif
duke@0 1415 };
duke@0 1416
duke@0 1417 // BranchData
duke@0 1418 //
duke@0 1419 // A BranchData is used to access profiling data for a two-way branch.
duke@0 1420 // It consists of taken and not_taken counts as well as a data displacement
duke@0 1421 // for the taken case.
duke@0 1422 class BranchData : public JumpData {
duke@0 1423 protected:
duke@0 1424 enum {
duke@0 1425 not_taken_off_set = jump_cell_count,
duke@0 1426 branch_cell_count
duke@0 1427 };
duke@0 1428
duke@0 1429 void set_displacement(int displacement) {
duke@0 1430 set_int_at(displacement_off_set, displacement);
duke@0 1431 }
duke@0 1432
duke@0 1433 public:
duke@0 1434 BranchData(DataLayout* layout) : JumpData(layout) {
duke@0 1435 assert(layout->tag() == DataLayout::branch_data_tag, "wrong type");
duke@0 1436 }
duke@0 1437
roland@5479 1438 virtual bool is_BranchData() const { return true; }
duke@0 1439
duke@0 1440 static int static_cell_count() {
duke@0 1441 return branch_cell_count;
duke@0 1442 }
duke@0 1443
roland@5479 1444 virtual int cell_count() const {
duke@0 1445 return static_cell_count();
duke@0 1446 }
duke@0 1447
duke@0 1448 // Direct accessor
roland@5479 1449 uint not_taken() const {
duke@0 1450 return uint_at(not_taken_off_set);
duke@0 1451 }
duke@0 1452
never@2670 1453 void set_not_taken(uint cnt) {
never@2670 1454 set_uint_at(not_taken_off_set, cnt);
never@2670 1455 }
never@2670 1456
duke@0 1457 uint inc_not_taken() {
duke@0 1458 uint cnt = not_taken() + 1;
duke@0 1459 // Did we wrap? Will compiler screw us??
duke@0 1460 if (cnt == 0) cnt--;
duke@0 1461 set_uint_at(not_taken_off_set, cnt);
duke@0 1462 return cnt;
duke@0 1463 }
duke@0 1464
duke@0 1465 // Code generation support
duke@0 1466 static ByteSize not_taken_offset() {
duke@0 1467 return cell_offset(not_taken_off_set);
duke@0 1468 }
duke@0 1469 static ByteSize branch_data_size() {
duke@0 1470 return cell_offset(branch_cell_count);
duke@0 1471 }
duke@0 1472
duke@0 1473 // Specific initialization.
coleenp@3602 1474 void post_initialize(BytecodeStream* stream, MethodData* mdo);
duke@0 1475
duke@0 1476 #ifndef PRODUCT
roland@5479 1477 void print_data_on(outputStream* st) const;
duke@0 1478 #endif
duke@0 1479 };
duke@0 1480
duke@0 1481 // ArrayData
duke@0 1482 //
duke@0 1483 // A ArrayData is a base class for accessing profiling data which does
duke@0 1484 // not have a statically known size. It consists of an array length
duke@0 1485 // and an array start.
duke@0 1486 class ArrayData : public ProfileData {
duke@0 1487 protected:
duke@0 1488 friend class DataLayout;
duke@0 1489
duke@0 1490 enum {
duke@0 1491 array_len_off_set,
duke@0 1492 array_start_off_set
duke@0 1493 };
duke@0 1494
roland@5479 1495 uint array_uint_at(int index) const {
duke@0 1496 int aindex = index + array_start_off_set;
duke@0 1497 return uint_at(aindex);
duke@0 1498 }
roland@5479 1499 int array_int_at(int index) const {
duke@0 1500 int aindex = index + array_start_off_set;
duke@0 1501 return int_at(aindex);
duke@0 1502 }
roland@5479 1503 oop array_oop_at(int index) const {
duke@0 1504 int aindex = index + array_start_off_set;
duke@0 1505 return oop_at(aindex);
duke@0 1506 }
duke@0 1507 void array_set_int_at(int index, int value) {
duke@0 1508 int aindex = index + array_start_off_set;
duke@0 1509 set_int_at(aindex, value);
duke@0 1510 }
duke@0 1511
duke@0 1512 // Code generation support for subclasses.
duke@0 1513 static ByteSize array_element_offset(int index) {
duke@0 1514 return cell_offset(array_start_off_set + index);
duke@0 1515 }
duke@0 1516
duke@0 1517 public:
duke@0 1518 ArrayData(DataLayout* layout) : ProfileData(layout) {}
duke@0 1519
roland@5479 1520 virtual bool is_ArrayData() const { return true; }
duke@0 1521
duke@0 1522 static int static_cell_count() {
duke@0 1523 return -1;
duke@0 1524 }
duke@0 1525
roland@5479 1526 int array_len() const {
duke@0 1527 return int_at_unchecked(array_len_off_set);
duke@0 1528 }
duke@0 1529
roland@5479 1530 virtual int cell_count() const {
duke@0 1531 return array_len() + 1;
duke@0 1532 }
duke@0 1533
duke@0 1534 // Code generation support
duke@0 1535 static ByteSize array_len_offset() {
duke@0 1536 return cell_offset(array_len_off_set);
duke@0 1537 }
duke@0 1538 static ByteSize array_start_offset() {
duke@0 1539 return cell_offset(array_start_off_set);
duke@0 1540 }
duke@0 1541 };
duke@0 1542
duke@0 1543 // MultiBranchData
duke@0 1544 //
duke@0 1545 // A MultiBranchData is used to access profiling information for
duke@0 1546 // a multi-way branch (*switch bytecodes). It consists of a series
duke@0 1547 // of (count, displacement) pairs, which count the number of times each
duke@0 1548 // case was taken and specify the data displacment for each branch target.
duke@0 1549 class MultiBranchData : public ArrayData {
duke@0 1550 protected:
duke@0 1551 enum {
duke@0 1552 default_count_off_set,
duke@0 1553 default_disaplacement_off_set,
duke@0 1554 case_array_start
duke@0 1555 };
duke@0 1556 enum {
duke@0 1557 relative_count_off_set,
duke@0 1558 relative_displacement_off_set,
duke@0 1559 per_case_cell_count
duke@0 1560 };
duke@0 1561
duke@0 1562 void set_default_displacement(int displacement) {
duke@0 1563 array_set_int_at(default_disaplacement_off_set, displacement);
duke@0 1564 }
duke@0 1565 void set_displacement_at(int index, int displacement) {
duke@0 1566 array_set_int_at(case_array_start +
duke@0 1567 index * per_case_cell_count +
duke@0 1568 relative_displacement_off_set,
duke@0 1569 displacement);
duke@0 1570 }
duke@0 1571
duke@0 1572 public:
duke@0 1573 MultiBranchData(DataLayout* layout) : ArrayData(layout) {
duke@0 1574 assert(layout->tag() == DataLayout::multi_branch_data_tag, "wrong type");
duke@0 1575 }
duke@0 1576
roland@5479 1577 virtual bool is_MultiBranchData() const { return true; }
duke@0 1578
duke@0 1579 static int compute_cell_count(BytecodeStream* stream);
duke@0 1580
roland@5479 1581 int number_of_cases() const {
duke@0 1582 int alen = array_len() - 2; // get rid of default case here.
duke@0 1583 assert(alen % per_case_cell_count == 0, "must be even");
duke@0 1584 return (alen / per_case_cell_count);
duke@0 1585 }
duke@0 1586
roland@5479 1587 uint default_count() const {
duke@0 1588 return array_uint_at(default_count_off_set);
duke@0 1589 }
roland@5479 1590 int default_displacement() const {
duke@0 1591 return array_int_at(default_disaplacement_off_set);
duke@0 1592 }
duke@0 1593
roland@5479 1594 uint count_at(int index) const {
duke@0 1595 return array_uint_at(case_array_start +
duke@0 1596 index * per_case_cell_count +
duke@0 1597 relative_count_off_set);
duke@0 1598 }
roland@5479 1599 int displacement_at(int index) const {
duke@0 1600 return array_int_at(case_array_start +
duke@0 1601 index * per_case_cell_count +
duke@0 1602 relative_displacement_off_set);
duke@0 1603 }
duke@0 1604
duke@0 1605 // Code generation support
duke@0 1606 static ByteSize default_count_offset() {
duke@0 1607 return array_element_offset(default_count_off_set);
duke@0 1608 }
duke@0 1609 static ByteSize default_displacement_offset() {
duke@0 1610 return array_element_offset(default_disaplacement_off_set);
duke@0 1611 }
duke@0 1612 static ByteSize case_count_offset(int index) {
duke@0 1613 return case_array_offset() +
duke@0 1614 (per_case_size() * index) +
duke@0 1615 relative_count_offset();
duke@0 1616 }
duke@0 1617 static ByteSize case_array_offset() {
duke@0 1618 return array_element_offset(case_array_start);
duke@0 1619 }
duke@0 1620 static ByteSize per_case_size() {
duke@0 1621 return in_ByteSize(per_case_cell_count) * cell_size;
duke@0 1622 }
duke@0 1623 static ByteSize relative_count_offset() {
duke@0 1624 return in_ByteSize(relative_count_off_set) * cell_size;
duke@0 1625 }
duke@0 1626 static ByteSize relative_displacement_offset() {
duke@0 1627 return in_ByteSize(relative_displacement_off_set) * cell_size;
duke@0 1628 }
duke@0 1629
duke@0 1630 // Specific initialization.
coleenp@3602 1631 void post_initialize(BytecodeStream* stream, MethodData* mdo);
duke@0 1632
duke@0 1633 #ifndef PRODUCT
roland@5479 1634 void print_data_on(outputStream* st) const;
duke@0 1635 #endif
duke@0 1636 };
duke@0 1637
kvn@45 1638 class ArgInfoData : public ArrayData {
kvn@45 1639
kvn@45 1640 public:
kvn@45 1641 ArgInfoData(DataLayout* layout) : ArrayData(layout) {
kvn@45 1642 assert(layout->tag() == DataLayout::arg_info_data_tag, "wrong type");
kvn@45 1643 }
kvn@45 1644
roland@5479 1645 virtual bool is_ArgInfoData() const { return true; }
kvn@45 1646
kvn@45 1647
roland@5479 1648 int number_of_args() const {
kvn@45 1649 return array_len();
kvn@45 1650 }
kvn@45 1651
roland@5479 1652 uint arg_modified(int arg) const {
kvn@45 1653 return array_uint_at(arg);
kvn@45 1654 }
kvn@45 1655
kvn@45 1656 void set_arg_modified(int arg, uint val) {
kvn@45 1657 array_set_int_at(arg, val);
kvn@45 1658 }
kvn@45 1659
kvn@45 1660 #ifndef PRODUCT
roland@5479 1661 void print_data_on(outputStream* st) const;
kvn@45 1662 #endif
kvn@45 1663 };
kvn@45 1664
coleenp@3602 1665 // MethodData*
duke@0 1666 //
coleenp@3602 1667 // A MethodData* holds information which has been collected about
duke@0 1668 // a method. Its layout looks like this:
duke@0 1669 //
duke@0 1670 // -----------------------------
duke@0 1671 // | header |
duke@0 1672 // | klass |
duke@0 1673 // -----------------------------
duke@0 1674 // | method |
coleenp@3602 1675 // | size of the MethodData* |
duke@0 1676 // -----------------------------
duke@0 1677 // | Data entries... |
duke@0 1678 // | (variable size) |
duke@0 1679 // | |
duke@0 1680 // . .
duke@0 1681 // . .
duke@0 1682 // . .
duke@0 1683 // | |
duke@0 1684 // -----------------------------
duke@0 1685 //
duke@0 1686 // The data entry area is a heterogeneous array of DataLayouts. Each
duke@0 1687 // DataLayout in the array corresponds to a specific bytecode in the
duke@0 1688 // method. The entries in the array are sorted by the corresponding
duke@0 1689 // bytecode. Access to the data is via resource-allocated ProfileData,
duke@0 1690 // which point to the underlying blocks of DataLayout structures.
duke@0 1691 //
duke@0 1692 // During interpretation, if profiling in enabled, the interpreter
duke@0 1693 // maintains a method data pointer (mdp), which points at the entry
duke@0 1694 // in the array corresponding to the current bci. In the course of
duke@0 1695 // intepretation, when a bytecode is encountered that has profile data
duke@0 1696 // associated with it, the entry pointed to by mdp is updated, then the
duke@0 1697 // mdp is adjusted to point to the next appropriate DataLayout. If mdp
duke@0 1698 // is NULL to begin with, the interpreter assumes that the current method
duke@0 1699 // is not (yet) being profiled.
duke@0 1700 //
coleenp@3602 1701 // In MethodData* parlance, "dp" is a "data pointer", the actual address
duke@0 1702 // of a DataLayout element. A "di" is a "data index", the offset in bytes
duke@0 1703 // from the base of the data entry array. A "displacement" is the byte offset
duke@0 1704 // in certain ProfileData objects that indicate the amount the mdp must be
duke@0 1705 // adjusted in the event of a change in control flow.
duke@0 1706 //
duke@0 1707
coleenp@3602 1708 class MethodData : public Metadata {
duke@0 1709 friend class VMStructs;
duke@0 1710 private:
duke@0 1711 friend class ProfileData;
duke@0 1712
coleenp@3602 1713 // Back pointer to the Method*
coleenp@3602 1714 Method* _method;
duke@0 1715
duke@0 1716 // Size of this oop in bytes
duke@0 1717 int _size;
duke@0 1718
duke@0 1719 // Cached hint for bci_to_dp and bci_to_data
duke@0 1720 int _hint_di;
duke@0 1721
coleenp@3602 1722 MethodData(methodHandle method, int size, TRAPS);
coleenp@3602 1723 public:
coleenp@3602 1724 static MethodData* allocate(ClassLoaderData* loader_data, methodHandle method, TRAPS);
coleenp@3602 1725 MethodData() {}; // For ciMethodData
coleenp@3602 1726
coleenp@3602 1727 bool is_methodData() const volatile { return true; }
coleenp@3602 1728
duke@0 1729 // Whole-method sticky bits and flags
duke@0 1730 enum {
kvn@2442 1731 _trap_hist_limit = 17, // decoupled from Deoptimization::Reason_LIMIT
duke@0 1732 _trap_hist_mask = max_jubyte,
duke@0 1733 _extra_data_count = 4 // extra DataLayout headers, for trap history
duke@0 1734 }; // Public flag values
duke@0 1735 private:
duke@0 1736 uint _nof_decompiles; // count of all nmethod removals
duke@0 1737 uint _nof_overflow_recompiles; // recompile count, excluding recomp. bits
duke@0 1738 uint _nof_overflow_traps; // trap count, excluding _trap_hist
duke@0 1739 union {
duke@0 1740 intptr_t _align;
duke@0 1741 u1 _array[_trap_hist_limit];
duke@0 1742 } _trap_hist;
duke@0 1743
duke@0 1744 // Support for interprocedural escape analysis, from Thomas Kotzmann.
duke@0 1745 intx _eflags; // flags on escape information
duke@0 1746 intx _arg_local; // bit set of non-escaping arguments
duke@0 1747 intx _arg_stack; // bit set of stack-allocatable arguments
duke@0 1748 intx _arg_returned; // bit set of returned arguments
duke@0 1749
iveresov@1703 1750 int _creation_mileage; // method mileage at MDO creation
iveresov@1703 1751
iveresov@1703 1752 // How many invocations has this MDO seen?
iveresov@1703 1753 // These counters are used to determine the exact age of MDO.
iveresov@1703 1754 // We need those because in tiered a method can be concurrently
iveresov@1703 1755 // executed at different levels.
iveresov@1703 1756 InvocationCounter _invocation_counter;
iveresov@1703 1757 // Same for backedges.
iveresov@1703 1758 InvocationCounter _backedge_counter;
iveresov@2124 1759 // Counter values at the time profiling started.
iveresov@2124 1760 int _invocation_counter_start;
iveresov@2124 1761 int _backedge_counter_start;
iveresov@1703 1762 // Number of loops and blocks is computed when compiling the first
iveresov@1703 1763 // time with C1. It is used to determine if method is trivial.
iveresov@1703 1764 short _num_loops;
iveresov@1703 1765 short _num_blocks;
iveresov@1703 1766 // Highest compile level this method has ever seen.
iveresov@1703 1767 u1 _highest_comp_level;
iveresov@1703 1768 // Same for OSR level
iveresov@1703 1769 u1 _highest_osr_comp_level;
iveresov@1703 1770 // Does this method contain anything worth profiling?
iveresov@1703 1771 bool _would_profile;
duke@0 1772
duke@0 1773 // Size of _data array in bytes. (Excludes header and extra_data fields.)
duke@0 1774 int _data_size;
duke@0 1775
duke@0 1776 // Beginning of the data entries
duke@0 1777 intptr_t _data[1];
duke@0 1778
duke@0 1779 // Helper for size computation
duke@0 1780 static int compute_data_size(BytecodeStream* stream);
duke@0 1781 static int bytecode_cell_count(Bytecodes::Code code);
duke@0 1782 enum { no_profile_data = -1, variable_cell_count = -2 };
duke@0 1783
duke@0 1784 // Helper for initialization
coleenp@3602 1785 DataLayout* data_layout_at(int data_index) const {
duke@0 1786 assert(data_index % sizeof(intptr_t) == 0, "unaligned");
duke@0 1787 return (DataLayout*) (((address)_data) + data_index);
duke@0 1788 }
duke@0 1789
duke@0 1790 // Initialize an individual data segment. Returns the size of
duke@0 1791 // the segment in bytes.
duke@0 1792 int initialize_data(BytecodeStream* stream, int data_index);
duke@0 1793
duke@0 1794 // Helper for data_at
coleenp@3602 1795 DataLayout* limit_data_position() const {
duke@0 1796 return (DataLayout*)((address)data_base() + _data_size);
duke@0 1797 }
coleenp@3602 1798 bool out_of_bounds(int data_index) const {
duke@0 1799 return data_index >= data_size();
duke@0 1800 }
duke@0 1801
duke@0 1802 // Give each of the data entries a chance to perform specific
duke@0 1803 // data initialization.
duke@0 1804 void post_initialize(BytecodeStream* stream);
duke@0 1805
duke@0 1806 // hint accessors
duke@0 1807 int hint_di() const { return _hint_di; }
duke@0 1808 void set_hint_di(int di) {
duke@0 1809 assert(!out_of_bounds(di), "hint_di out of bounds");
duke@0 1810 _hint_di = di;
duke@0 1811 }
duke@0 1812 ProfileData* data_before(int bci) {
duke@0 1813 // avoid SEGV on this edge case
duke@0 1814 if (data_size() == 0)
duke@0 1815 return NULL;
duke@0 1816 int hint = hint_di();
duke@0 1817 if (data_layout_at(hint)->bci() <= bci)
duke@0 1818 return data_at(hint);
duke@0 1819 return first_data();
duke@0 1820 }
duke@0 1821
duke@0 1822 // What is the index of the first data entry?
coleenp@3602 1823 int first_di() const { return 0; }
duke@0 1824
duke@0 1825 // Find or create an extra ProfileData:
duke@0 1826 ProfileData* bci_to_extra_data(int bci, bool create_if_missing);
duke@0 1827
kvn@45 1828 // return the argument info cell
kvn@45 1829 ArgInfoData *arg_info();
kvn@45 1830
roland@5479 1831 enum {
roland@5479 1832 no_type_profile = 0,
roland@5479 1833 type_profile_jsr292 = 1,
roland@5479 1834 type_profile_all = 2
roland@5479 1835 };
roland@5479 1836
roland@5479 1837 static bool profile_jsr292(methodHandle m, int bci);
roland@5479 1838 static int profile_arguments_flag();
roland@5479 1839 static bool profile_arguments_jsr292_only();
roland@5479 1840 static bool profile_all_arguments();
roland@5479 1841 static bool profile_arguments_for_invoke(methodHandle m, int bci);
roland@5486 1842 static int profile_return_flag();
roland@5486 1843 static bool profile_all_return();
roland@5486 1844 static bool profile_return_for_invoke(methodHandle m, int bci);
roland@5479 1845
duke@0 1846 public:
duke@0 1847 static int header_size() {
coleenp@3602 1848 return sizeof(MethodData)/wordSize;
duke@0 1849 }
duke@0 1850
coleenp@3602 1851 // Compute the size of a MethodData* before it is created.
duke@0 1852 static int compute_allocation_size_in_bytes(methodHandle method);
duke@0 1853 static int compute_allocation_size_in_words(methodHandle method);
duke@0 1854 static int compute_extra_data_count(int data_size, int empty_bc_count);
duke@0 1855
duke@0 1856 // Determine if a given bytecode can have profile information.
duke@0 1857 static bool bytecode_has_profile(Bytecodes::Code code) {
duke@0 1858 return bytecode_cell_count(code) != no_profile_data;
duke@0 1859 }
duke@0 1860
iignatyev@4473 1861 // reset into original state
iignatyev@4473 1862 void init();
duke@0 1863
duke@0 1864 // My size
coleenp@3602 1865 int size_in_bytes() const { return _size; }
coleenp@3602 1866 int size() const { return align_object_size(align_size_up(_size, BytesPerWord)/BytesPerWord); }
acorn@4062 1867 #if INCLUDE_SERVICES
acorn@4062 1868 void collect_statistics(KlassSizeStats *sz) const;
acorn@4062 1869 #endif
duke@0 1870
duke@0 1871 int creation_mileage() const { return _creation_mileage; }
duke@0 1872 void set_creation_mileage(int x) { _creation_mileage = x; }
iveresov@1703 1873
iveresov@1703 1874 int invocation_count() {
iveresov@1703 1875 if (invocation_counter()->carry()) {
iveresov@1703 1876 return InvocationCounter::count_limit;
iveresov@1703 1877 }
iveresov@1703 1878 return invocation_counter()->count();
iveresov@1703 1879 }
iveresov@1703 1880 int backedge_count() {
iveresov@1703 1881 if (backedge_counter()->carry()) {
iveresov@1703 1882 return InvocationCounter::count_limit;
iveresov@1703 1883 }
iveresov@1703 1884 return backedge_counter()->count();
iveresov@1703 1885 }
iveresov@1703 1886
iveresov@2124 1887 int invocation_count_start() {
iveresov@2124 1888 if (invocation_counter()->carry()) {
iveresov@2124 1889 return 0;
iveresov@2124 1890 }
iveresov@2124 1891 return _invocation_counter_start;
iveresov@2124 1892 }
iveresov@2124 1893
iveresov@2124 1894 int backedge_count_start() {
iveresov@2124 1895 if (backedge_counter()->carry()) {
iveresov@2124 1896 return 0;
iveresov@2124 1897 }
iveresov@2124 1898 return _backedge_counter_start;
iveresov@2124 1899 }
iveresov@2124 1900
iveresov@2124 1901 int invocation_count_delta() { return invocation_count() - invocation_count_start(); }
iveresov@2124 1902 int backedge_count_delta() { return backedge_count() - backedge_count_start(); }
iveresov@2124 1903
iveresov@2124 1904 void reset_start_counters() {
iveresov@2124 1905 _invocation_counter_start = invocation_count();
iveresov@2124 1906 _backedge_counter_start = backedge_count();
iveresov@2124 1907 }
iveresov@2124 1908
iveresov@1703 1909 InvocationCounter* invocation_counter() { return &_invocation_counter; }
iveresov@1703 1910 InvocationCounter* backedge_counter() { return &_backedge_counter; }
iveresov@1703 1911
iveresov@1703 1912 void set_would_profile(bool p) { _would_profile = p; }
iveresov@1703 1913 bool would_profile() const { return _would_profile; }
iveresov@1703 1914
minqi@4662 1915 int highest_comp_level() const { return _highest_comp_level; }
iveresov@1703 1916 void set_highest_comp_level(int level) { _highest_comp_level = level; }
minqi@4662 1917 int highest_osr_comp_level() const { return _highest_osr_comp_level; }
iveresov@1703 1918 void set_highest_osr_comp_level(int level) { _highest_osr_comp_level = level; }
iveresov@1703 1919
iveresov@1703 1920 int num_loops() const { return _num_loops; }
iveresov@1703 1921 void set_num_loops(int n) { _num_loops = n; }
iveresov@1703 1922 int num_blocks() const { return _num_blocks; }
iveresov@1703 1923 void set_num_blocks(int n) { _num_blocks = n; }
iveresov@1703 1924
duke@0 1925 bool is_mature() const; // consult mileage and ProfileMaturityPercentage
coleenp@3602 1926 static int mileage_of(Method* m);
duke@0 1927
duke@0 1928 // Support for interprocedural escape analysis, from Thomas Kotzmann.
duke@0 1929 enum EscapeFlag {
duke@0 1930 estimated = 1 << 0,
kvn@78 1931 return_local = 1 << 1,
kvn@78 1932 return_allocated = 1 << 2,
kvn@78 1933 allocated_escapes = 1 << 3,
kvn@78 1934 unknown_modified = 1 << 4
duke@0 1935 };
duke@0 1936
duke@0 1937 intx eflags() { return _eflags; }
duke@0 1938 intx arg_local() { return _arg_local; }
duke@0 1939 intx arg_stack() { return _arg_stack; }
duke@0 1940 intx arg_returned() { return _arg_returned; }
kvn@45 1941 uint arg_modified(int a) { ArgInfoData *aid = arg_info();
iignatyev@4473 1942 assert(aid != NULL, "arg_info must be not null");
kvn@45 1943 assert(a >= 0 && a < aid->number_of_args(), "valid argument number");
kvn@45 1944 return aid->arg_modified(a); }
duke@0 1945
duke@0 1946 void set_eflags(intx v) { _eflags = v; }
duke@0 1947 void set_arg_local(intx v) { _arg_local = v; }
duke@0 1948 void set_arg_stack(intx v) { _arg_stack = v; }
duke@0 1949 void set_arg_returned(intx v) { _arg_returned = v; }
kvn@45 1950 void set_arg_modified(int a, uint v) { ArgInfoData *aid = arg_info();
iignatyev@4473 1951 assert(aid != NULL, "arg_info must be not null");
kvn@45 1952 assert(a >= 0 && a < aid->number_of_args(), "valid argument number");
kvn@45 1953 aid->set_arg_modified(a, v); }
duke@0 1954
duke@0 1955 void clear_escape_info() { _eflags = _arg_local = _arg_stack = _arg_returned = 0; }
duke@0 1956
duke@0 1957 // Location and size of data area
duke@0 1958 address data_base() const {
duke@0 1959 return (address) _data;
duke@0 1960 }
coleenp@3602 1961 int data_size() const {
duke@0 1962 return _data_size;
duke@0 1963 }
duke@0 1964
duke@0 1965 // Accessors
coleenp@3602 1966 Method* method() const { return _method; }
duke@0 1967
duke@0 1968 // Get the data at an arbitrary (sort of) data index.
coleenp@3602 1969 ProfileData* data_at(int data_index) const;
duke@0 1970
duke@0 1971 // Walk through the data in order.
coleenp@3602 1972 ProfileData* first_data() const { return data_at(first_di()); }
coleenp@3602 1973 ProfileData* next_data(ProfileData* current) const;
coleenp@3602 1974 bool is_valid(ProfileData* current) const { return current != NULL; }
duke@0 1975
duke@0 1976 // Convert a dp (data pointer) to a di (data index).
coleenp@3602 1977 int dp_to_di(address dp) const {
duke@0 1978 return dp - ((address)_data);
duke@0 1979 }
duke@0 1980
duke@0 1981 address di_to_dp(int di) {
duke@0 1982 return (address)data_layout_at(di);
duke@0 1983 }
duke@0 1984
duke@0 1985 // bci to di/dp conversion.
duke@0 1986 address bci_to_dp(int bci);
duke@0 1987 int bci_to_di(int bci) {
duke@0 1988 return dp_to_di(bci_to_dp(bci));
duke@0 1989 }
duke@0 1990
duke@0 1991 // Get the data at an arbitrary bci, or NULL if there is none.
duke@0 1992 ProfileData* bci_to_data(int bci);
duke@0 1993
duke@0 1994 // Same, but try to create an extra_data record if one is needed:
duke@0 1995 ProfileData* allocate_bci_to_data(int bci) {
duke@0 1996 ProfileData* data = bci_to_data(bci);
duke@0 1997 return (data != NULL) ? data : bci_to_extra_data(bci, true);
duke@0 1998 }
duke@0 1999
duke@0 2000 // Add a handful of extra data records, for trap tracking.
coleenp@3602 2001 DataLayout* extra_data_base() const { return limit_data_position(); }
coleenp@3602 2002 DataLayout* extra_data_limit() const { return (DataLayout*)((address)this + size_in_bytes()); }
coleenp@3602 2003 int extra_data_size() const { return (address)extra_data_limit()
duke@0 2004 - (address)extra_data_base(); }
duke@0 2005 static DataLayout* next_extra(DataLayout* dp) { return (DataLayout*)((address)dp + in_bytes(DataLayout::cell_offset(0))); }
duke@0 2006
duke@0 2007 // Return (uint)-1 for overflow.
duke@0 2008 uint trap_count(int reason) const {
duke@0 2009 assert((uint)reason < _trap_hist_limit, "oob");
duke@0 2010 return (int)((_trap_hist._array[reason]+1) & _trap_hist_mask) - 1;
duke@0 2011 }
duke@0 2012 // For loops:
duke@0 2013 static uint trap_reason_limit() { return _trap_hist_limit; }
duke@0 2014 static uint trap_count_limit() { return _trap_hist_mask; }
duke@0 2015 uint inc_trap_count(int reason) {
duke@0 2016 // Count another trap, anywhere in this method.
duke@0 2017 assert(reason >= 0, "must be single trap");
duke@0 2018 if ((uint)reason < _trap_hist_limit) {
duke@0 2019 uint cnt1 = 1 + _trap_hist._array[reason];
duke@0 2020 if ((cnt1 & _trap_hist_mask) != 0) { // if no counter overflow...
duke@0 2021 _trap_hist._array[reason] = cnt1;
duke@0 2022 return cnt1;
duke@0 2023 } else {
duke@0 2024 return _trap_hist_mask + (++_nof_overflow_traps);
duke@0 2025 }
duke@0 2026 } else {
duke@0 2027 // Could not represent the count in the histogram.
duke@0 2028 return (++_nof_overflow_traps);
duke@0 2029 }
duke@0 2030 }
duke@0 2031
duke@0 2032 uint overflow_trap_count() const {
duke@0 2033 return _nof_overflow_traps;
duke@0 2034 }
duke@0 2035 uint overflow_recompile_count() const {
duke@0 2036 return _nof_overflow_recompiles;
duke@0 2037 }
duke@0 2038 void inc_overflow_recompile_count() {
duke@0 2039 _nof_overflow_recompiles += 1;
duke@0 2040 }
duke@0 2041 uint decompile_count() const {
duke@0 2042 return _nof_decompiles;
duke@0 2043 }
duke@0 2044 void inc_decompile_count() {
duke@0 2045 _nof_decompiles += 1;
kvn@1206 2046 if (decompile_count() > (uint)PerMethodRecompilationCutoff) {
vlivanov@4104 2047 method()->set_not_compilable(CompLevel_full_optimization, true, "decompile_count > PerMethodRecompilationCutoff");
kvn@1206 2048 }
duke@0 2049 }
duke@0 2050
duke@0 2051 // Support for code generation
duke@0 2052 static ByteSize data_offset() {
coleenp@3602 2053 return byte_offset_of(MethodData, _data[0]);
duke@0 2054 }
duke@0 2055
iveresov@1703 2056 static ByteSize invocation_counter_offset() {
coleenp@3602 2057 return byte_offset_of(MethodData, _invocation_counter);
iveresov@1703 2058 }
iveresov@1703 2059 static ByteSize backedge_counter_offset() {
coleenp@3602 2060 return byte_offset_of(MethodData, _backedge_counter);
iveresov@1703 2061 }
iveresov@1703 2062
coleenp@3602 2063 // Deallocation support - no pointer fields to deallocate
coleenp@3602 2064 void deallocate_contents(ClassLoaderData* loader_data) {}
coleenp@3602 2065
duke@0 2066 // GC support
coleenp@3602 2067 void set_size(int object_size_in_bytes) { _size = object_size_in_bytes; }
coleenp@3602 2068
coleenp@3602 2069 // Printing
coleenp@3602 2070 #ifndef PRODUCT
coleenp@3602 2071 void print_on (outputStream* st) const;
coleenp@3602 2072 #endif
coleenp@3602 2073 void print_value_on(outputStream* st) const;
duke@0 2074
duke@0 2075 #ifndef PRODUCT
duke@0 2076 // printing support for method data
coleenp@3602 2077 void print_data_on(outputStream* st) const;
duke@0 2078 #endif
duke@0 2079
coleenp@3602 2080 const char* internal_name() const { return "{method data}"; }
coleenp@3602 2081
duke@0 2082 // verification
coleenp@3602 2083 void verify_on(outputStream* st);
duke@0 2084 void verify_data_on(outputStream* st);
roland@5479 2085
roland@5479 2086 static bool profile_arguments();
roland@5486 2087 static bool profile_return();
roland@5486 2088 static bool profile_return_jsr292_only();
duke@0 2089 };
stefank@1879 2090
stefank@1879 2091 #endif // SHARE_VM_OOPS_METHODDATAOOP_HPP