Class TlsfAllocator

java.lang.Object
com.mojang.blaze3d.vertex.TlsfAllocator

public class TlsfAllocator extends Object
  • Field Details

    • SECOND_LEVEL_BIN_LOG2

      private static final int SECOND_LEVEL_BIN_LOG2
      See Also:
    • SECOND_LEVEL_BIN_COUNT

      private static final int SECOND_LEVEL_BIN_COUNT
      See Also:
    • FIRST_LEVEL_INDEX_SHIFT

      private static final int FIRST_LEVEL_INDEX_SHIFT
      See Also:
    • FIRST_LEVEL_BIN_COUNT

      private static final int FIRST_LEVEL_BIN_COUNT
      See Also:
    • SMALL_BLOCK_SIZE

      private static final int SMALL_BLOCK_SIZE
      See Also:
    • MAX_ALLOCATION_SIZE

      private static final long MAX_ALLOCATION_SIZE
      See Also:
    • ALIGN_SIZE

      private static final int ALIGN_SIZE
      See Also:
    • firstLevelBitmap

      private int firstLevelBitmap
    • secondLevelBitmap

      private final int[] secondLevelBitmap
    • freeLists

      private final @Nullable TlsfAllocator.Block[] freeLists
    • totalMemorySize

      private final long totalMemorySize
    • LOGGER

      private static final org.slf4j.Logger LOGGER
  • Constructor Details

  • Method Details

    • getBlockFromFreeList

      private @Nullable TlsfAllocator.Block getBlockFromFreeList(int firstLevelIndex, int secondLevelIndex)
    • setBlockFreeList

      private void setBlockFreeList(int firstLevelIndex, int secondLevelIndex, @Nullable TlsfAllocator.Block block)
    • alignUp

      private static long alignUp(long x, long align)
    • alignDown

      private static long alignDown(long x, long align)
    • findLastSignificantBit

      private static int findLastSignificantBit(long x)
    • findFirstSignificantBit

      private static int findFirstSignificantBit(int x)
    • getLevelIndex

      private TlsfAllocator.IndexPair getLevelIndex(long size)
    • mappingSearch

      private TlsfAllocator.IndexPair mappingSearch(long size)
    • insertFreeBlock

      private void insertFreeBlock(TlsfAllocator.Block block)
    • removeFreeBlock

      private void removeFreeBlock(TlsfAllocator.Block block, int firstLevel, int secondLevel)
    • trimBlock

      private void trimBlock(TlsfAllocator.Block block, long size)
    • allocate

      public @Nullable TlsfAllocator.Allocation allocate(long size, int align)
    • mergeBlockWithPrevious

      private void mergeBlockWithPrevious(TlsfAllocator.Block block)
    • mergeBlockWithNext

      private void mergeBlockWithNext(TlsfAllocator.Block block)
    • free

      public void free(TlsfAllocator.Allocation allocation)
    • isCompletelyFree

      public boolean isCompletelyFree()
    • printAllocatorStatistics

      public void printAllocatorStatistics(String name)