Class Heap

  • All Implemented Interfaces:
    IdeepCompilerConstants

    public class Heap
    extends Object
    implements IdeepCompilerConstants
    Heap manager with mark-sweep garbage collection.
    As soon as the remaining heap space is lower than a third of the total available heap space, a garbage collection is called.
    • Field Detail

      • runGC

        static boolean runGC
      • sysTabBaseAddr

        public static int sysTabBaseAddr
        Base address of the system table. Must be set by the boot method of the kernel.
    • Constructor Detail

      • Heap

        public Heap()
    • Method Detail

      • mark

        public static void mark()
        Starts mark phase of garbage collection. This method should be solely used for test purposes. Never use it in application code! A garbage collection is automatically done when available heap space is low.
      • sweep

        public static void sweep()
        Starts sweep phase of garbage collection. This method should be solely used for test purposes. Never use it in application code! A garbage collection is automatically done when available heap space is low.
      • getHeapSize

        public static int getHeapSize()
        Query total heap size.
        Returns:
        Total heap size in bytes.
      • getHeapBase

        public static int getHeapBase()
        Query base address of heap.
        Returns:
        Base address of heap.
      • getFreeHeap

        public static int getFreeHeap()
        Query free heap size.
        Returns:
        Free heap size in bytes.
      • getNofRoots

        public static int getNofRoots()
        Used for debugging purposes.
        Returns:
        Number of roots.
      • getRoots

        public static int[] getRoots()
        Used for debugging purposes.
        Returns:
        Array of roots.
      • getFreeBlocks

        public static int[] getFreeBlocks()
        Used for debugging purposes.
        Returns:
        Array of free blocks.
      • getNofFreeBlocks

        public static int[] getNofFreeBlocks()
        Used for debugging purposes.
        Returns:
        Array of number of free blocks.
      • getNofMarkedObjs

        public static int getNofMarkedObjs()
        Used for debugging purposes.
        Returns:
        Number of marked objects.
      • getNofMarkedRefArrays

        public static int getNofMarkedRefArrays()
        Used for debugging purposes.
        Returns:
        Array of number of marked reference arrays.
      • getNofMarkedPrimArrays

        public static int getNofMarkedPrimArrays()
        Used for debugging purposes.
        Returns:
        Array of number of marked primitives arrays.
      • getNofMarkedRegObjs

        public static int getNofMarkedRegObjs()
        Used for debugging purposes.
        Returns:
        Array of number of marked regular objects arrays.