Ejemplo n.º 1
0
        internal static void Initialize()
        {
            // The card table covers all the heap. Below is not accurate heap
            // size. It includes all the memory space, starting from address 0.
            // TODO: find more accurate heap size and start

            UIntPtr heapSize = PageTable.pageTableCount * PageTable.PageSize;

            VTable.Assert((heapSize >> CardBits) << CardBits == heapSize,
                          "Assumption: pageSize is expected to be multiple of CardSize");
            UIntPtr heapStart = (UIntPtr)0;

            totalCards  = heapSize >> CardBits;
            firstCardNo = heapStart >> CardBits;

            UIntPtr tablePtr = PageManager.AllocateNonheapMemory(null, totalCards);

            VTable.Assert(tablePtr != UIntPtr.Zero);
            cardTablePtr  = (byte *)tablePtr;
            cardTableBase = (byte *)(tablePtr - firstCardNo);

            CardTable.instance = (CardTable)
                                 BootstrapMemory.Allocate(typeof(CardTable));

            OffsetTable.Initialize(totalCards);

            for (UIntPtr c = firstCardNo; c < firstCardNo + totalCards; c++)
            {
                VTable.Assert(!CardIsDirty(c), "Card table initialization error");
            }
        }
Ejemplo n.º 2
0
        internal static void Initialize(int count, UIntPtr size)
        {
            writeBufferSize = ((int)size * count) / UIntPtr.Size;
            chunkSize       = (int)size;
            UIntPtr memorySize = (UIntPtr)UIntPtr.Size * (uint)writeBufferSize;

            writeBuffer = (UIntPtr *)
                          PageManager.AllocateNonheapMemory(null, memorySize);
            VTable.Assert(writeBuffer != null);
            AdjustChunkSize(1);
            SequentialStoreBuffer.instance = (SequentialStoreBuffer)
                                             BootstrapMemory.Allocate(typeof(SequentialStoreBuffer));
        }
Ejemplo n.º 3
0
        internal static void Initialize(UIntPtr totalCards)
        {
            UIntPtr offsetTablePtr = PageManager.AllocateNonheapMemory(null,
                                                                       ((UIntPtr)EntryBytes) * totalCards);

            VTable.Assert(offsetTablePtr != UIntPtr.Zero, "OffsetTable.Initialize: no memory");

            offsetTableBase = (byte *)(offsetTablePtr - CardTable.FirstCardNo);

            // The memory of offset table should have already been cleaned

            for (UIntPtr c = CardTable.FirstCardNo; c < CardTable.FirstCardNo + totalCards; c++)
            {
                VTable.Assert(NoObjectPtrToTheCard(c), "offset table initialization error");
            }
        }