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

Remove the incorrect usage of Metablock::overhead()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • hs25
    • hs25
    • hotspot
    • gc
    • b51
    • Not verified

        In the following code we add byte_size with the Metablock::overhead(), which returns words and not bytes.

        size_t get_raw_word_size(size_t word_size) {
            // If only the dictionary is going to be used (i.e., no
            // indexed free list), then there is a minimum size requirement.
            // MinChunkSize is a placeholder for the real minimum size JJJ
            size_t byte_size = word_size * BytesPerWord;

            size_t byte_size_with_overhead = byte_size + Metablock::overhead();

            size_t raw_bytes_size = MAX2(byte_size_with_overhead,
                                         Metablock::min_block_byte_size());
            raw_bytes_size = ARENA_ALIGN(raw_bytes_size);
            size_t raw_word_size = raw_bytes_size / BytesPerWord;
            assert(raw_word_size * BytesPerWord == raw_bytes_size, "Size problem");

            return raw_word_size;
          }

        The code has changed since it was first written, and currently we overwrite the entire Metablock without leaving a header. Because of this we don't have any overhead any more.

        Metablock::overhead() is zero in product builds and non-zero in debug builds.

              stefank Stefan Karlsson
              stefank Stefan Karlsson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: