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

remove ByteSize and WordSize classes

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P4
    • tbd
    • 9
    • hotspot
    • generic
    • generic

    Description

      This is placeholder to have some discussion about how we could remove ByteSize and WordSize.

      Here is a comment from sizes.hpp that explains what these classes are for:

      // The following two classes are used to represent 'sizes' and 'offsets' in the VM;
      // they serve as 'unit' types. ByteSize is used for sizes measured in bytes, while
      // WordSize is used for sizes measured in machine words (i.e., 32bit or 64bit words
      // depending on platform).

      One problem is that it introduces quite some verbosity to code like assembler code because in order to get a byte-sized offset you have to call in_bytes, e.g.:

        add(cache, cache, in_bytes(ConstantPoolCache::base_offset()));

      The other downsize is the fact that a number of methods have a "in_bytes" suffix, e.g.:

        static int pool_holder_offset_in_bytes() { return offset_of(ConstantPool, _pool_holder); }

      And ugly example of how word-sizes are used is:

        static int size(int length) { return align_object_size(header_size() + length * in_words(ConstantPoolCacheEntry::size())); }

      which is then called as:

          assert(in_words(ConstantPoolCacheEntry::size()) == 4, "adjust shift below");

      Too many in_words calls for my taste; it makes the code difficult to read.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              twisti Christian Thalinger
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: