src/share/vm/oops/constMethod.hpp

Tue, 17 Mar 2015 17:11:14 -0700

author
sspitsyn
date
Tue, 17 Mar 2015 17:11:14 -0700
changeset 7636
fdde6a70ea85
parent 4837
0c3ee6f1fa23
child 7994
04ff2f6cd0eb
child 8368
32b682649973
permissions
-rw-r--r--

8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
Summary: optimize the adjust_method_entries functions by using the orig_method_idnum() function
Reviewed-by: coleenp, dcubed

duke@435 1 /*
sspitsyn@7636 2 * Copyright (c) 2003, 2015, 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_OOPS_CONSTMETHODOOP_HPP
stefank@2314 26 #define SHARE_VM_OOPS_CONSTMETHODOOP_HPP
stefank@2314 27
stefank@2314 28 #include "oops/oop.hpp"
stefank@2314 29
coleenp@4037 30 // An ConstMethod* represents portions of a Java method which
duke@435 31 // do not vary.
duke@435 32 //
duke@435 33 // Memory layout (each line represents a word). Note that most
duke@435 34 // applications load thousands of methods, so keeping the size of this
duke@435 35 // structure small has a big impact on footprint.
duke@435 36 //
duke@435 37 // |------------------------------------------------------|
duke@435 38 // | header |
duke@435 39 // | klass |
duke@435 40 // |------------------------------------------------------|
duke@435 41 // | fingerprint 1 |
duke@435 42 // | fingerprint 2 |
jiangli@3826 43 // | constants (oop) |
duke@435 44 // | stackmap_data (oop) |
duke@435 45 // | constMethod_size |
duke@435 46 // | interp_kind | flags | code_size |
duke@435 47 // | name index | signature index |
jiangli@4302 48 // | method_idnum | max_stack |
jiangli@4338 49 // | max_locals | size_of_parameters |
duke@435 50 // |------------------------------------------------------|
duke@435 51 // | |
duke@435 52 // | byte codes |
duke@435 53 // | |
duke@435 54 // |------------------------------------------------------|
duke@435 55 // | compressed linenumber table |
duke@435 56 // | (see class CompressedLineNumberReadStream) |
duke@435 57 // | (note that length is unknown until decompressed) |
duke@435 58 // | (access flags bit tells whether table is present) |
jiangli@4302 59 // | (indexed from start of ConstMethod*) |
duke@435 60 // | (elements not necessarily sorted!) |
duke@435 61 // |------------------------------------------------------|
duke@435 62 // | localvariable table elements + length (length last) |
duke@435 63 // | (length is u2, elements are 6-tuples of u2) |
duke@435 64 // | (see class LocalVariableTableElement) |
duke@435 65 // | (access flags bit tells whether table is present) |
jiangli@4302 66 // | (indexed from end of ConstMethod*) |
jiangli@3917 67 // |------------------------------------------------------|
jiangli@3917 68 // | exception table + length (length last) |
jiangli@3917 69 // | (length is u2, elements are 4-tuples of u2) |
jiangli@3917 70 // | (see class ExceptionTableElement) |
jiangli@3917 71 // | (access flags bit tells whether table is present) |
jiangli@4302 72 // | (indexed from end of ConstMethod*) |
duke@435 73 // |------------------------------------------------------|
duke@435 74 // | checked exceptions elements + length (length last) |
duke@435 75 // | (length is u2, elements are u2) |
duke@435 76 // | (see class CheckedExceptionElement) |
duke@435 77 // | (access flags bit tells whether table is present) |
jiangli@4302 78 // | (indexed from end of ConstMethod*) |
jiangli@4302 79 // |------------------------------------------------------|
coleenp@4398 80 // | method parameters elements + length (length last) |
coleenp@4398 81 // | (length is u2, elements are u2, u4 structures) |
coleenp@4398 82 // | (see class MethodParametersElement) |
coleenp@4398 83 // | (access flags bit tells whether table is present) |
coleenp@4398 84 // | (indexed from end of ConstMethod*) |
coleenp@4398 85 // |------------------------------------------------------|
jiangli@4302 86 // | generic signature index (u2) |
jiangli@4302 87 // | (indexed from start of constMethodOop) |
duke@435 88 // |------------------------------------------------------|
coleenp@4572 89 // | annotations arrays - method, parameter, type, default|
coleenp@4572 90 // | pointer to Array<u1> if annotation is present |
coleenp@4572 91 // |------------------------------------------------------|
coleenp@4398 92 //
coleenp@4398 93 // IMPORTANT: If anything gets added here, there need to be changes to
coleenp@4398 94 // ensure that ServicabilityAgent doesn't get broken as a result!
duke@435 95
duke@435 96
coleenp@4572 97 // Utility class describing elements in checked exceptions table inlined in Method*.
duke@435 98 class CheckedExceptionElement VALUE_OBJ_CLASS_SPEC {
duke@435 99 public:
duke@435 100 u2 class_cp_index;
duke@435 101 };
duke@435 102
duke@435 103
coleenp@4572 104 // Utility class describing elements in local variable table inlined in Method*.
duke@435 105 class LocalVariableTableElement VALUE_OBJ_CLASS_SPEC {
duke@435 106 public:
duke@435 107 u2 start_bci;
duke@435 108 u2 length;
duke@435 109 u2 name_cp_index;
duke@435 110 u2 descriptor_cp_index;
duke@435 111 u2 signature_cp_index;
duke@435 112 u2 slot;
duke@435 113 };
duke@435 114
coleenp@4572 115 // Utility class describing elements in exception table
jiangli@3917 116 class ExceptionTableElement VALUE_OBJ_CLASS_SPEC {
jiangli@3917 117 public:
jiangli@3917 118 u2 start_pc;
jiangli@3917 119 u2 end_pc;
jiangli@3917 120 u2 handler_pc;
jiangli@3917 121 u2 catch_type_index;
jiangli@3917 122 };
jiangli@3917 123
coleenp@4398 124 // Utility class describing elements in method parameters
coleenp@4398 125 class MethodParametersElement VALUE_OBJ_CLASS_SPEC {
coleenp@4398 126 public:
coleenp@4398 127 u2 name_cp_index;
emc@4524 128 u2 flags;
coleenp@4398 129 };
coleenp@4398 130
acorn@4497 131 class KlassSizeStats;
coleenp@4037 132
coleenp@4572 133 // Class to collect the sizes of ConstMethod inline tables
coleenp@4572 134 #define INLINE_TABLES_DO(do_element) \
coleenp@4572 135 do_element(localvariable_table_length) \
coleenp@4572 136 do_element(compressed_linenumber_size) \
coleenp@4572 137 do_element(exception_table_length) \
coleenp@4572 138 do_element(checked_exceptions_length) \
coleenp@4572 139 do_element(method_parameters_length) \
coleenp@4572 140 do_element(generic_signature_index) \
coleenp@4572 141 do_element(method_annotations_length) \
coleenp@4572 142 do_element(parameter_annotations_length) \
coleenp@4572 143 do_element(type_annotations_length) \
coleenp@4572 144 do_element(default_annotations_length)
coleenp@4572 145
coleenp@4572 146 #define INLINE_TABLE_DECLARE(sym) int _##sym;
coleenp@4572 147 #define INLINE_TABLE_PARAM(sym) int sym,
coleenp@4572 148 #define INLINE_TABLE_INIT(sym) _##sym(sym),
coleenp@4572 149 #define INLINE_TABLE_NULL(sym) _##sym(0),
coleenp@4572 150 #define INLINE_TABLE_ACCESSOR(sym) int sym() const { return _##sym; }
coleenp@4572 151
coleenp@4572 152 class InlineTableSizes : StackObj {
coleenp@4572 153 // declarations
coleenp@4572 154 INLINE_TABLES_DO(INLINE_TABLE_DECLARE)
coleenp@4572 155 int _end;
coleenp@4572 156 public:
coleenp@4572 157 InlineTableSizes(
coleenp@4572 158 INLINE_TABLES_DO(INLINE_TABLE_PARAM)
coleenp@4572 159 int end) :
coleenp@4572 160 INLINE_TABLES_DO(INLINE_TABLE_INIT)
coleenp@4572 161 _end(end) {}
coleenp@4572 162
coleenp@4572 163 // Default constructor for no inlined tables
coleenp@4572 164 InlineTableSizes() :
coleenp@4572 165 INLINE_TABLES_DO(INLINE_TABLE_NULL)
coleenp@4572 166 _end(0) {}
coleenp@4572 167
coleenp@4572 168 // Accessors
coleenp@4572 169 INLINE_TABLES_DO(INLINE_TABLE_ACCESSOR)
coleenp@4572 170 };
coleenp@4572 171 #undef INLINE_TABLE_ACCESSOR
coleenp@4572 172 #undef INLINE_TABLE_NULL
coleenp@4572 173 #undef INLINE_TABLE_INIT
coleenp@4572 174 #undef INLINE_TABLE_PARAM
coleenp@4572 175 #undef INLINE_TABLE_DECLARE
coleenp@4572 176
coleenp@4572 177
coleenp@4037 178 class ConstMethod : public MetaspaceObj {
duke@435 179 friend class VMStructs;
kamg@4245 180
kamg@4245 181 public:
kamg@4245 182 typedef enum { NORMAL, OVERPASS } MethodType;
kamg@4245 183
duke@435 184 private:
duke@435 185 enum {
coleenp@4572 186 _has_linenumber_table = 0x0001,
coleenp@4572 187 _has_checked_exceptions = 0x0002,
coleenp@4572 188 _has_localvariable_table = 0x0004,
coleenp@4572 189 _has_exception_table = 0x0008,
coleenp@4572 190 _has_generic_signature = 0x0010,
coleenp@4572 191 _has_method_parameters = 0x0020,
coleenp@4572 192 _is_overpass = 0x0040,
coleenp@4572 193 _has_method_annotations = 0x0080,
coleenp@4572 194 _has_parameter_annotations = 0x0100,
coleenp@4572 195 _has_type_annotations = 0x0200,
coleenp@4572 196 _has_default_annotations = 0x0400
duke@435 197 };
duke@435 198
duke@435 199 // Bit vector of signature
duke@435 200 // Callers interpret 0=not initialized yet and
duke@435 201 // -1=too many args to fix, must parse the slow way.
duke@435 202 // The real initial value is special to account for nonatomicity of 64 bit
duke@435 203 // loads and stores. This value may updated and read without a lock by
duke@435 204 // multiple threads, so is volatile.
duke@435 205 volatile uint64_t _fingerprint;
duke@435 206
coleenp@4037 207 ConstantPool* _constants; // Constant pool
duke@435 208
duke@435 209 // Raw stackmap data for the method
coleenp@4037 210 Array<u1>* _stackmap_data;
duke@435 211
duke@435 212 int _constMethod_size;
coleenp@4572 213 u2 _flags;
duke@435 214
coleenp@4037 215 // Size of Java bytecodes allocated immediately after Method*.
duke@435 216 u2 _code_size;
duke@435 217 u2 _name_index; // Method name (index in constant pool)
duke@435 218 u2 _signature_index; // Method signature (index in constant pool)
duke@435 219 u2 _method_idnum; // unique identification number for the method within the class
duke@435 220 // initially corresponds to the index into the methods array.
duke@435 221 // but this may change with redefinition
jiangli@4302 222 u2 _max_stack; // Maximum number of entries on the expression stack
jiangli@4338 223 u2 _max_locals; // Number of local variables used by this method
jiangli@4338 224 u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words
sspitsyn@7636 225 u2 _orig_method_idnum; // Original unique identification number for the method
coleenp@4037 226
coleenp@4037 227 // Constructor
coleenp@4037 228 ConstMethod(int byte_code_size,
coleenp@4572 229 InlineTableSizes* sizes,
kamg@4245 230 MethodType is_overpass,
kamg@4245 231 int size);
duke@435 232 public:
kamg@4245 233
coleenp@4037 234 static ConstMethod* allocate(ClassLoaderData* loader_data,
kamg@4245 235 int byte_code_size,
coleenp@4572 236 InlineTableSizes* sizes,
kamg@4245 237 MethodType mt,
kamg@4245 238 TRAPS);
coleenp@4037 239
coleenp@4037 240 bool is_constMethod() const { return true; }
coleenp@4037 241
duke@435 242 // Inlined tables
coleenp@4572 243 void set_inlined_tables_length(InlineTableSizes* sizes);
duke@435 244
jiangli@4302 245 bool has_generic_signature() const
jiangli@4302 246 { return (_flags & _has_generic_signature) != 0; }
jiangli@4302 247
duke@435 248 bool has_linenumber_table() const
duke@435 249 { return (_flags & _has_linenumber_table) != 0; }
duke@435 250
duke@435 251 bool has_checked_exceptions() const
duke@435 252 { return (_flags & _has_checked_exceptions) != 0; }
duke@435 253
duke@435 254 bool has_localvariable_table() const
duke@435 255 { return (_flags & _has_localvariable_table) != 0; }
duke@435 256
jiangli@3917 257 bool has_exception_handler() const
jiangli@3917 258 { return (_flags & _has_exception_table) != 0; }
jiangli@3917 259
coleenp@4398 260 bool has_method_parameters() const
coleenp@4398 261 { return (_flags & _has_method_parameters) != 0; }
coleenp@4398 262
kamg@4245 263 MethodType method_type() const {
kamg@4245 264 return ((_flags & _is_overpass) == 0) ? NORMAL : OVERPASS;
kamg@4245 265 }
kamg@4245 266
kamg@4245 267 void set_method_type(MethodType mt) {
kamg@4245 268 if (mt == NORMAL) {
kamg@4245 269 _flags &= ~(_is_overpass);
kamg@4245 270 } else {
kamg@4245 271 _flags |= _is_overpass;
kamg@4245 272 }
kamg@4245 273 }
kamg@4245 274
jiangli@3826 275 // constant pool
coleenp@4037 276 ConstantPool* constants() const { return _constants; }
coleenp@4037 277 void set_constants(ConstantPool* c) { _constants = c; }
duke@435 278
coleenp@4037 279 Method* method() const;
duke@435 280
duke@435 281 // stackmap table data
coleenp@4037 282 Array<u1>* stackmap_data() const { return _stackmap_data; }
coleenp@4037 283 void set_stackmap_data(Array<u1>* sd) { _stackmap_data = sd; }
coleenp@4719 284 void copy_stackmap_data(ClassLoaderData* loader_data, u1* sd, int length, TRAPS);
duke@435 285 bool has_stackmap_table() const { return _stackmap_data != NULL; }
duke@435 286
duke@435 287 void init_fingerprint() {
duke@435 288 const uint64_t initval = CONST64(0x8000000000000000);
duke@435 289 _fingerprint = initval;
duke@435 290 }
duke@435 291
duke@435 292 uint64_t fingerprint() const {
duke@435 293 // Since reads aren't atomic for 64 bits, if any of the high or low order
duke@435 294 // word is the initial value, return 0. See init_fingerprint for initval.
duke@435 295 uint high_fp = (uint)(_fingerprint >> 32);
duke@435 296 if ((int) _fingerprint == 0 || high_fp == 0x80000000) {
duke@435 297 return 0L;
duke@435 298 } else {
duke@435 299 return _fingerprint;
duke@435 300 }
duke@435 301 }
duke@435 302
duke@435 303 uint64_t set_fingerprint(uint64_t new_fingerprint) {
duke@435 304 #ifdef ASSERT
duke@435 305 // Assert only valid if complete/valid 64 bit _fingerprint value is read.
duke@435 306 uint64_t oldfp = fingerprint();
duke@435 307 #endif // ASSERT
duke@435 308 _fingerprint = new_fingerprint;
duke@435 309 assert(oldfp == 0L || new_fingerprint == oldfp,
duke@435 310 "fingerprint cannot change");
duke@435 311 assert(((new_fingerprint >> 32) != 0x80000000) && (int)new_fingerprint !=0,
duke@435 312 "fingerprint should call init to set initial value");
duke@435 313 return new_fingerprint;
duke@435 314 }
duke@435 315
duke@435 316 // name
duke@435 317 int name_index() const { return _name_index; }
duke@435 318 void set_name_index(int index) { _name_index = index; }
duke@435 319
duke@435 320 // signature
duke@435 321 int signature_index() const { return _signature_index; }
duke@435 322 void set_signature_index(int index) { _signature_index = index; }
duke@435 323
duke@435 324 // generics support
jiangli@4302 325 int generic_signature_index() const {
jiangli@4302 326 if (has_generic_signature()) {
jiangli@4302 327 return *generic_signature_index_addr();
jiangli@4302 328 } else {
jiangli@4302 329 return 0;
jiangli@4302 330 }
jiangli@4302 331 }
jiangli@4302 332 void set_generic_signature_index(u2 index) {
jiangli@4302 333 assert(has_generic_signature(), "");
jiangli@4302 334 u2* addr = generic_signature_index_addr();
jiangli@4302 335 *addr = index;
jiangli@4302 336 }
duke@435 337
duke@435 338 // Sizing
duke@435 339 static int header_size() {
coleenp@4037 340 return sizeof(ConstMethod)/HeapWordSize;
duke@435 341 }
duke@435 342
coleenp@4037 343 // Size needed
coleenp@4572 344 static int size(int code_size, InlineTableSizes* sizes);
duke@435 345
coleenp@4037 346 int size() const { return _constMethod_size;}
duke@435 347 void set_constMethod_size(int size) { _constMethod_size = size; }
acorn@4497 348 #if INCLUDE_SERVICES
acorn@4497 349 void collect_statistics(KlassSizeStats *sz) const;
acorn@4497 350 #endif
duke@435 351
duke@435 352 // code size
duke@435 353 int code_size() const { return _code_size; }
duke@435 354 void set_code_size(int size) {
duke@435 355 assert(max_method_code_size < (1 << 16),
duke@435 356 "u2 is too small to hold method code size in general");
duke@435 357 assert(0 <= size && size <= max_method_code_size, "invalid code size");
duke@435 358 _code_size = size;
duke@435 359 }
duke@435 360
duke@435 361 // linenumber table - note that length is unknown until decompression,
duke@435 362 // see class CompressedLineNumberReadStream.
duke@435 363 u_char* compressed_linenumber_table() const; // not preserved by gc
jiangli@4302 364 u2* generic_signature_index_addr() const;
duke@435 365 u2* checked_exceptions_length_addr() const;
duke@435 366 u2* localvariable_table_length_addr() const;
jiangli@3917 367 u2* exception_table_length_addr() const;
coleenp@4398 368 u2* method_parameters_length_addr() const;
duke@435 369
duke@435 370 // checked exceptions
duke@435 371 int checked_exceptions_length() const;
duke@435 372 CheckedExceptionElement* checked_exceptions_start() const;
duke@435 373
duke@435 374 // localvariable table
duke@435 375 int localvariable_table_length() const;
duke@435 376 LocalVariableTableElement* localvariable_table_start() const;
duke@435 377
jiangli@3917 378 // exception table
jiangli@3917 379 int exception_table_length() const;
jiangli@3917 380 ExceptionTableElement* exception_table_start() const;
jiangli@3917 381
coleenp@4398 382 // method parameters table
coleenp@4398 383 int method_parameters_length() const;
coleenp@4398 384 MethodParametersElement* method_parameters_start() const;
coleenp@4398 385
coleenp@4572 386 // method annotations
coleenp@4572 387 bool has_method_annotations() const
coleenp@4572 388 { return (_flags & _has_method_annotations) != 0; }
coleenp@4572 389
coleenp@4572 390 bool has_parameter_annotations() const
coleenp@4572 391 { return (_flags & _has_parameter_annotations) != 0; }
coleenp@4572 392
coleenp@4572 393 bool has_type_annotations() const
coleenp@4572 394 { return (_flags & _has_type_annotations) != 0; }
coleenp@4572 395
coleenp@4572 396 bool has_default_annotations() const
coleenp@4572 397 { return (_flags & _has_default_annotations) != 0; }
coleenp@4572 398
coleenp@4572 399
coleenp@4572 400 AnnotationArray** method_annotations_addr() const;
coleenp@4572 401 AnnotationArray* method_annotations() const {
coleenp@4572 402 return has_method_annotations() ? *(method_annotations_addr()) : NULL;
coleenp@4572 403 }
coleenp@4572 404 void set_method_annotations(AnnotationArray* anno) {
coleenp@4572 405 *(method_annotations_addr()) = anno;
coleenp@4572 406 }
coleenp@4572 407
coleenp@4572 408 AnnotationArray** parameter_annotations_addr() const;
coleenp@4572 409 AnnotationArray* parameter_annotations() const {
coleenp@4572 410 return has_parameter_annotations() ? *(parameter_annotations_addr()) : NULL;
coleenp@4572 411 }
coleenp@4572 412 void set_parameter_annotations(AnnotationArray* anno) {
coleenp@4572 413 *(parameter_annotations_addr()) = anno;
coleenp@4572 414 }
coleenp@4572 415
coleenp@4572 416 AnnotationArray** type_annotations_addr() const;
coleenp@4572 417 AnnotationArray* type_annotations() const {
coleenp@4572 418 return has_type_annotations() ? *(type_annotations_addr()) : NULL;
coleenp@4572 419 }
coleenp@4572 420 void set_type_annotations(AnnotationArray* anno) {
coleenp@4572 421 *(type_annotations_addr()) = anno;
coleenp@4572 422 }
coleenp@4572 423
coleenp@4572 424 AnnotationArray** default_annotations_addr() const;
coleenp@4572 425 AnnotationArray* default_annotations() const {
coleenp@4572 426 return has_default_annotations() ? *(default_annotations_addr()) : NULL;
coleenp@4572 427 }
coleenp@4572 428 void set_default_annotations(AnnotationArray* anno) {
coleenp@4572 429 *(default_annotations_addr()) = anno;
coleenp@4572 430 }
coleenp@4572 431
coleenp@4572 432 int method_annotations_length() const {
coleenp@4572 433 return has_method_annotations() ? method_annotations()->length() : 0;
coleenp@4572 434 }
coleenp@4572 435 int parameter_annotations_length() const {
coleenp@4572 436 return has_parameter_annotations() ? parameter_annotations()->length() : 0;
coleenp@4572 437 }
coleenp@4572 438 int type_annotations_length() const {
coleenp@4572 439 return has_type_annotations() ? type_annotations()->length() : 0;
coleenp@4572 440 }
coleenp@4572 441 int default_annotations_length() const {
coleenp@4572 442 return has_default_annotations() ? default_annotations()->length() : 0;
coleenp@4572 443 }
coleenp@4572 444
coleenp@4837 445 // Copy annotations from other ConstMethod
coleenp@4837 446 void copy_annotations_from(ConstMethod* cm);
coleenp@4837 447
duke@435 448 // byte codes
twisti@1573 449 void set_code(address code) {
twisti@1573 450 if (code_size() > 0) {
twisti@1573 451 memcpy(code_base(), code, code_size());
twisti@1573 452 }
twisti@1573 453 }
duke@435 454 address code_base() const { return (address) (this+1); }
duke@435 455 address code_end() const { return code_base() + code_size(); }
duke@435 456 bool contains(address bcp) const { return code_base() <= bcp
duke@435 457 && bcp < code_end(); }
duke@435 458 // Offset to bytecodes
duke@435 459 static ByteSize codes_offset()
coleenp@4037 460 { return in_ByteSize(sizeof(ConstMethod)); }
duke@435 461
jiangli@3826 462 static ByteSize constants_offset()
coleenp@4037 463 { return byte_offset_of(ConstMethod, _constants); }
duke@435 464
jiangli@4302 465 static ByteSize max_stack_offset()
jiangli@4302 466 { return byte_offset_of(ConstMethod, _max_stack); }
jiangli@4338 467 static ByteSize size_of_locals_offset()
jiangli@4338 468 { return byte_offset_of(ConstMethod, _max_locals); }
jiangli@4338 469 static ByteSize size_of_parameters_offset()
jiangli@4338 470 { return byte_offset_of(ConstMethod, _size_of_parameters); }
jiangli@4338 471
jiangli@4302 472
duke@435 473 // Unique id for the method
duke@435 474 static const u2 MAX_IDNUM;
duke@435 475 static const u2 UNSET_IDNUM;
duke@435 476 u2 method_idnum() const { return _method_idnum; }
duke@435 477 void set_method_idnum(u2 idnum) { _method_idnum = idnum; }
duke@435 478
sspitsyn@7636 479 u2 orig_method_idnum() const { return _orig_method_idnum; }
sspitsyn@7636 480 void set_orig_method_idnum(u2 idnum) { _orig_method_idnum = idnum; }
sspitsyn@7636 481
jiangli@4302 482 // max stack
jiangli@4302 483 int max_stack() const { return _max_stack; }
jiangli@4302 484 void set_max_stack(int size) { _max_stack = size; }
jiangli@4302 485
jiangli@4338 486 // max locals
jiangli@4338 487 int max_locals() const { return _max_locals; }
jiangli@4338 488 void set_max_locals(int size) { _max_locals = size; }
jiangli@4338 489
jiangli@4338 490 // size of parameters
jiangli@4338 491 int size_of_parameters() const { return _size_of_parameters; }
jiangli@4338 492 void set_size_of_parameters(int size) { _size_of_parameters = size; }
jiangli@4338 493
coleenp@4037 494 // Deallocation for RedefineClasses
coleenp@4037 495 void deallocate_contents(ClassLoaderData* loader_data);
coleenp@4037 496 bool is_klass() const { return false; }
coleenp@4037 497 DEBUG_ONLY(bool on_stack() { return false; })
coleenp@4037 498
duke@435 499 private:
duke@435 500 // Since the size of the compressed line number table is unknown, the
duke@435 501 // offsets of the other variable sized sections are computed backwards
coleenp@4037 502 // from the end of the ConstMethod*.
duke@435 503
coleenp@4037 504 // First byte after ConstMethod*
duke@435 505 address constMethod_end() const
coleenp@4572 506 { return (address)((intptr_t*)this + _constMethod_size); }
duke@435 507
coleenp@4037 508 // Last short in ConstMethod*
coleenp@4572 509 u2* last_u2_element() const;
coleenp@4037 510
coleenp@4037 511 public:
coleenp@4037 512 // Printing
coleenp@4037 513 void print_on (outputStream* st) const;
coleenp@4037 514 void print_value_on(outputStream* st) const;
coleenp@4037 515
coleenp@4037 516 const char* internal_name() const { return "{constMethod}"; }
coleenp@4037 517
coleenp@4037 518 // Verify
coleenp@4037 519 void verify_on(outputStream* st);
duke@435 520 };
stefank@2314 521
stefank@2314 522 #endif // SHARE_VM_OOPS_CONSTMETHODOOP_HPP

mercurial