RFR: 8331549: Inline MemAllocator::mem_allocate_slow

Stefan Karlsson stefank at openjdk.org
Thu May 2 09:27:51 UTC 2024


On Thu, 2 May 2024 09:10:34 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Trivial inlining a method. (The diff looks larger than its real size.) The resulting logic is much cleaner, IMO -- try tlab-fast, then tlab-slow, finally outside of tlab.

Note that we also have this unused function that almost looks very similar to the first part of the `mem_allocate` function:

HeapWord* MemAllocator::mem_allocate_inside_tlab(Allocation& allocation) const {
  assert(UseTLAB, "should use UseTLAB");

  // Try allocating from an existing TLAB.
  HeapWord* mem = mem_allocate_inside_tlab_fast();
  if (mem != nullptr) {
    return mem;
  }

  // Try refilling the TLAB and allocating the object in it.
  return mem_allocate_inside_tlab_slow(allocation);
}


Maybe `mem_allocate_inside_tlab` could also be removed with this change?

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

PR Review: https://git.openjdk.org/jdk/pull/19051#pullrequestreview-2035254340


More information about the hotspot-gc-dev mailing list