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 bool is_interesting_method_entry(Klass* k);
385 #endif // INCLUDE_JVMTI
386
387 // Debugging & Printing
388 void print (outputStream* st, int index) const;
389 void verify(outputStream* st) const;
390
391 static void verify_tos_state_shift() {
392 // When shifting flags as a 32-bit int, make sure we don't need an extra mask for tos_state:
393 assert((((u4)-1 >> tos_state_shift) & ~tos_state_mask) == 0, "no need for tos_state mask");
394 }
395 };
396
397
398 // A constant pool cache is a runtime data structure set aside to a constant pool. The cache
399 // holds interpreter runtime information for all field access and invoke bytecodes. The cache
400 // is created and initialized before a class is actively used (i.e., initialized), the indivi-
401 // dual cache entries are filled at resolution (i.e., "link") time (see also: rewriter.*).
402
403 class ConstantPoolCache: public MetaspaceObj {
404 friend class VMStructs;
462 assert(0 <= i && i < length(), "index out of bounds");
463 return base() + i;
464 }
465
466 // Code generation
467 static ByteSize base_offset() { return in_ByteSize(sizeof(ConstantPoolCache)); }
468 static ByteSize entry_offset(int raw_index) {
469 int index = raw_index;
470 return (base_offset() + ConstantPoolCacheEntry::size_in_bytes() * index);
471 }
472
473 #if INCLUDE_JVMTI
474 // RedefineClasses() API support:
475 // If any entry of this ConstantPoolCache points to any of
476 // old_methods, replace it with the corresponding new_method.
477 // trace_name_printed is set to true if the current call has
478 // printed the klass name so that other routines in the adjust_*
479 // group don't print the klass name.
480 void adjust_method_entries(Method** old_methods, Method** new_methods,
481 int methods_length, bool * trace_name_printed);
482 bool check_no_old_or_obsolete_entries();
483 void dump_cache();
484 #endif // INCLUDE_JVMTI
485
486 // Deallocate - no fields to deallocate
487 DEBUG_ONLY(bool on_stack() { return false; })
488 void deallocate_contents(ClassLoaderData* data) {}
489 bool is_klass() const { return false; }
490
491 // Printing
492 void print_on(outputStream* st) const;
493 void print_value_on(outputStream* st) const;
494
495 const char* internal_name() const { return "{constant pool cache}"; }
496
497 // Verify
498 void verify_on(outputStream* st);
499 };
500
501 #endif // SHARE_VM_OOPS_CPCACHEOOP_HPP
|
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 bool is_interesting_method_entry(Klass* k);
385 Method* get_interesting_method_entry(Klass* k);
386 #endif // INCLUDE_JVMTI
387
388 // Debugging & Printing
389 void print (outputStream* st, int index) const;
390 void verify(outputStream* st) const;
391
392 static void verify_tos_state_shift() {
393 // When shifting flags as a 32-bit int, make sure we don't need an extra mask for tos_state:
394 assert((((u4)-1 >> tos_state_shift) & ~tos_state_mask) == 0, "no need for tos_state mask");
395 }
396 };
397
398
399 // A constant pool cache is a runtime data structure set aside to a constant pool. The cache
400 // holds interpreter runtime information for all field access and invoke bytecodes. The cache
401 // is created and initialized before a class is actively used (i.e., initialized), the indivi-
402 // dual cache entries are filled at resolution (i.e., "link") time (see also: rewriter.*).
403
404 class ConstantPoolCache: public MetaspaceObj {
405 friend class VMStructs;
463 assert(0 <= i && i < length(), "index out of bounds");
464 return base() + i;
465 }
466
467 // Code generation
468 static ByteSize base_offset() { return in_ByteSize(sizeof(ConstantPoolCache)); }
469 static ByteSize entry_offset(int raw_index) {
470 int index = raw_index;
471 return (base_offset() + ConstantPoolCacheEntry::size_in_bytes() * index);
472 }
473
474 #if INCLUDE_JVMTI
475 // RedefineClasses() API support:
476 // If any entry of this ConstantPoolCache points to any of
477 // old_methods, replace it with the corresponding new_method.
478 // trace_name_printed is set to true if the current call has
479 // printed the klass name so that other routines in the adjust_*
480 // group don't print the klass name.
481 void adjust_method_entries(Method** old_methods, Method** new_methods,
482 int methods_length, bool * trace_name_printed);
483 void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
484 bool check_no_old_or_obsolete_entries();
485 void dump_cache();
486 #endif // INCLUDE_JVMTI
487
488 // Deallocate - no fields to deallocate
489 DEBUG_ONLY(bool on_stack() { return false; })
490 void deallocate_contents(ClassLoaderData* data) {}
491 bool is_klass() const { return false; }
492
493 // Printing
494 void print_on(outputStream* st) const;
495 void print_value_on(outputStream* st) const;
496
497 const char* internal_name() const { return "{constant pool cache}"; }
498
499 // Verify
500 void verify_on(outputStream* st);
501 };
502
503 #endif // SHARE_VM_OOPS_CPCACHEOOP_HPP
|