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

Remove the incorrect usage of Metablock::overhead()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: hs25
    • Fix Version/s: hs25
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc
    • Resolved In Build:
      b51
    • Verification:
      Not verified

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: