RFR: 8294460: CodeSection::alignment checks for CodeBuffer::SECT_STUBS incorrectly

Boris Ulasevich bulasevich at openjdk.org
Thu Oct 20 07:16:50 UTC 2022


This is a fix for an apparent code bug:


inline int CodeSection::alignment(int section) {
  if (section == CodeBuffer::SECT_CONSTS) {
    return (int) sizeof(jdouble);
  }
  if (section == CodeBuffer::SECT_INSTS) {
    return (int) CodeEntryAlignment;
  }
  if (CodeBuffer::SECT_STUBS) {   <--- here must be (section == CodeBuffer::SECT_STUBS) condition!
    // CodeBuffer installer expects sections to be HeapWordSize aligned
    return HeapWordSize;
  }
  ShouldNotReachHere();
  return 0;
}


Also, the section size initializer code is moved to initialize_misc() to fix the code path that works with uninitialized data.

-------------

Commit messages:
 - 8294460: CodeSection::alignment checks for CodeBuffer::SECT_STUBS incorrectly

Changes: https://git.openjdk.org/jdk/pull/10699/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10699&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294460
  Stats: 8 lines in 1 file changed: 4 ins; 3 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/10699.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10699/head:pull/10699

PR: https://git.openjdk.org/jdk/pull/10699


More information about the hotspot-compiler-dev mailing list