Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8290718

Remove ALLOCATION_SUPER_CLASS_SPEC

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • hotspot
    • b09

      The allocation classes like CHeapObj, ResourceObj, etc have this super class that defines virtual functions in non-product mode for printing. This breaks CDS if we try to save ModuleEntry or PackageEntry in non-product mode because they now have a vptr.
      Most classes have their own printing function and this printing is pretty useless. There are several ResourceObj objects that still need the default print function and there are some CompilationResourceObjs that need it as well. This change is to move the virtual printing functions there, until they can be cleaned up more, if desired.

      Preview:

      -// In non product mode we introduce a super class for all allocation classes
      -// that supports printing.
      -// We avoid the superclass in product mode to save space.
      -
      -#ifdef PRODUCT
      -#define ALLOCATION_SUPER_CLASS_SPEC
      -#else
      -#define ALLOCATION_SUPER_CLASS_SPEC : public AllocatedObj
      -class AllocatedObj {
      - public:
      - // Printing support
      - void print() const;
      - void print_value() const;
      -
      - virtual void print_on(outputStream* st) const;
      - virtual void print_value_on(outputStream* st) const;
      -};
      -#endif

      -void AllocatedObj::print() const { print_on(tty); }
      -void AllocatedObj::print_value() const { print_value_on(tty); }
      +void ResourceObj::print() const { print_on(tty); }
       
      -void AllocatedObj::print_on(outputStream* st) const {
      - st->print_cr("AllocatedObj(" INTPTR_FORMAT ")", p2i(this));
      -}
      -
      -void AllocatedObj::print_value_on(outputStream* st) const {
      - st->print("AllocatedObj(" INTPTR_FORMAT ")", p2i(this));
      +void ResourceObj::print_on(outputStream* st) const {
      + st->print_cr("ResourceObj(" INTPTR_FORMAT ")", p2i(this));
       }

            coleenp Coleen Phillimore
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: