347 bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; }
348 bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; }
349 bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; }
350 bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; }
351 bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; }
352 bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; }
353 bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; }
354 bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; }
355 bool is_byte() const { return flag_state() == btos; }
356 bool is_char() const { return flag_state() == ctos; }
357 bool is_short() const { return flag_state() == stos; }
358 bool is_int() const { return flag_state() == itos; }
359 bool is_long() const { return flag_state() == ltos; }
360 bool is_float() const { return flag_state() == ftos; }
361 bool is_double() const { return flag_state() == dtos; }
362 bool is_object() const { return flag_state() == atos; }
363 TosState flag_state() const { assert((uint)number_of_states <= (uint)tos_state_mask+1, "");
364 return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
365
366 // Code generation support
367 static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); }
368 static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
369 static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
370 static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
371 static ByteSize f2_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
372 static ByteSize flags_offset() { return byte_offset_of(ConstantPoolCacheEntry, _flags); }
373
374 #if INCLUDE_JVMTI
375 // RedefineClasses() API support:
376 // If this ConstantPoolCacheEntry refers to old_method then update it
377 // to refer to new_method.
378 // trace_name_printed is set to true if the current call has
379 // printed the klass name so that other routines in the adjust_*
380 // group don't print the klass name.
381 bool adjust_method_entry(Method* old_method, Method* new_method,
382 bool* trace_name_printed);
383 bool check_no_old_or_obsolete_entries();
384 Method* get_interesting_method_entry(Klass* k);
385 #endif // INCLUDE_JVMTI
386
387 // Debugging & Printing
422 for (int i = 0; i < length; i++) {
423 assert(entry_at(i)->is_f1_null(), "Failed to clear?");
424 }
425 }
426
427 // Initialization
428 void initialize(const intArray& inverse_index_map,
429 const intArray& invokedynamic_inverse_index_map,
430 const intArray& invokedynamic_references_map);
431 public:
432 static ConstantPoolCache* allocate(ClassLoaderData* loader_data,
433 const intStack& cp_cache_map,
434 const intStack& invokedynamic_cp_cache_map,
435 const intStack& invokedynamic_references_map, TRAPS);
436 bool is_constantPoolCache() const { return true; }
437
438 int length() const { return _length; }
439 private:
440 void set_length(int length) { _length = length; }
441
442 static int header_size() { return sizeof(ConstantPoolCache) / HeapWordSize; }
443 static int size(int length) { return align_object_size(header_size() + length * in_words(ConstantPoolCacheEntry::size())); }
444 public:
445 int size() const { return size(length()); }
446 private:
447
448 // Helpers
449 ConstantPool** constant_pool_addr() { return &_constant_pool; }
450 ConstantPoolCacheEntry* base() const { return (ConstantPoolCacheEntry*)((address)this + in_bytes(base_offset())); }
451
452 friend class constantPoolCacheKlass;
453 friend class ConstantPoolCacheEntry;
454
455 public:
456 // Accessors
457 void set_constant_pool(ConstantPool* pool) { _constant_pool = pool; }
458 ConstantPool* constant_pool() const { return _constant_pool; }
459 // Fetches the entry at the given index.
460 // In either case the index must not be encoded or byte-swapped in any way.
461 ConstantPoolCacheEntry* entry_at(int i) const {
462 assert(0 <= i && i < length(), "index out of bounds");
463 return base() + i;
|
347 bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; }
348 bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; }
349 bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; }
350 bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; }
351 bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; }
352 bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; }
353 bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; }
354 bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; }
355 bool is_byte() const { return flag_state() == btos; }
356 bool is_char() const { return flag_state() == ctos; }
357 bool is_short() const { return flag_state() == stos; }
358 bool is_int() const { return flag_state() == itos; }
359 bool is_long() const { return flag_state() == ltos; }
360 bool is_float() const { return flag_state() == ftos; }
361 bool is_double() const { return flag_state() == dtos; }
362 bool is_object() const { return flag_state() == atos; }
363 TosState flag_state() const { assert((uint)number_of_states <= (uint)tos_state_mask+1, "");
364 return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
365
366 // Code generation support
367 static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / wordSize); }
368 static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
369 static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
370 static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
371 static ByteSize f2_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
372 static ByteSize flags_offset() { return byte_offset_of(ConstantPoolCacheEntry, _flags); }
373
374 #if INCLUDE_JVMTI
375 // RedefineClasses() API support:
376 // If this ConstantPoolCacheEntry refers to old_method then update it
377 // to refer to new_method.
378 // trace_name_printed is set to true if the current call has
379 // printed the klass name so that other routines in the adjust_*
380 // group don't print the klass name.
381 bool adjust_method_entry(Method* old_method, Method* new_method,
382 bool* trace_name_printed);
383 bool check_no_old_or_obsolete_entries();
384 Method* get_interesting_method_entry(Klass* k);
385 #endif // INCLUDE_JVMTI
386
387 // Debugging & Printing
422 for (int i = 0; i < length; i++) {
423 assert(entry_at(i)->is_f1_null(), "Failed to clear?");
424 }
425 }
426
427 // Initialization
428 void initialize(const intArray& inverse_index_map,
429 const intArray& invokedynamic_inverse_index_map,
430 const intArray& invokedynamic_references_map);
431 public:
432 static ConstantPoolCache* allocate(ClassLoaderData* loader_data,
433 const intStack& cp_cache_map,
434 const intStack& invokedynamic_cp_cache_map,
435 const intStack& invokedynamic_references_map, TRAPS);
436 bool is_constantPoolCache() const { return true; }
437
438 int length() const { return _length; }
439 private:
440 void set_length(int length) { _length = length; }
441
442 static int header_size() { return sizeof(ConstantPoolCache) / wordSize; }
443 static int size(int length) { return align_metadata_size(header_size() + length * in_words(ConstantPoolCacheEntry::size())); }
444 public:
445 int size() const { return size(length()); }
446 private:
447
448 // Helpers
449 ConstantPool** constant_pool_addr() { return &_constant_pool; }
450 ConstantPoolCacheEntry* base() const { return (ConstantPoolCacheEntry*)((address)this + in_bytes(base_offset())); }
451
452 friend class constantPoolCacheKlass;
453 friend class ConstantPoolCacheEntry;
454
455 public:
456 // Accessors
457 void set_constant_pool(ConstantPool* pool) { _constant_pool = pool; }
458 ConstantPool* constant_pool() const { return _constant_pool; }
459 // Fetches the entry at the given index.
460 // In either case the index must not be encoded or byte-swapped in any way.
461 ConstantPoolCacheEntry* entry_at(int i) const {
462 assert(0 <= i && i < length(), "index out of bounds");
463 return base() + i;
|