singrdk/base/Imported/Bartok/runtime/shared/GCs/Collector.cs

77 lines
3.8 KiB
C#
Raw Permalink Normal View History

2008-11-17 18:29:00 -05:00
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
2008-03-05 09:52:00 -05:00
/*******************************************************************/
/* WARNING */
/* This file should be identical in the Bartok and Singularity */
/* depots. Master copy resides in Bartok Depot. Changes should be */
/* made to Bartok Depot and propagated to Singularity Depot. */
/*******************************************************************/
namespace System.GCs
{
using Microsoft.Bartok.Runtime;
using System.Runtime.CompilerServices;
using System.Threading;
[NoCCtor]
[RequiredByBartok]
internal abstract class Collector
{
// Helper methods for GC.cs
2008-11-17 18:29:00 -05:00
internal abstract void Collect(Thread currentThread, int generation);
internal abstract void CollectStoppable(int currentThreadIndex,
int generation);
2008-03-05 09:52:00 -05:00
internal abstract void CheckForNeededGCWork(Thread currentThread);
internal abstract int CollectionGeneration(int gen);
internal abstract int GetGeneration(Object obj);
internal abstract int MaxGeneration { get; }
internal abstract int MinGeneration { get; }
internal abstract long TotalMemory { get; }
// Creation and destruction of heaps
internal abstract void EnableHeap();
2008-11-17 18:29:00 -05:00
internal abstract void Shutdown();
2008-03-05 09:52:00 -05:00
internal abstract void DestructHeap();
// Verification of the heap
internal abstract void VerifyHeap(bool beforeCollection);
// Object visitation methods
internal abstract UIntPtr FindObjectAddr(UIntPtr interiorPtr);
internal abstract void VisitObjects(ObjectLayout.ObjectVisitor objectVisitor,
UIntPtr lowAddr,
UIntPtr highAddr);
// Transition methods
internal abstract void NewThreadNotification(Thread newThread,
bool initial);
internal abstract void DeadThreadNotification(Thread deadThread);
internal abstract void ThreadStartNotification(int currentThreadIndex);
internal abstract void ThreadEndNotification(Thread currentThread);
internal abstract void ThreadDormantGCNotification(int threadIndex);
internal abstract bool IsOnTheFlyCollector {get;}
// Profiling methods.
internal virtual void SetProfiler(GCProfiler profiler) { }
internal virtual void ProfileAllocation(Object obj) { }
// Allocation of objects
2008-11-17 18:29:00 -05:00
[AssertDevirtualize]
2008-03-05 09:52:00 -05:00
internal abstract UIntPtr AllocateObjectMemory(UIntPtr numBytes,
uint alignment,
Thread currentThread);
internal abstract Object AllocateObject(VTable vtable,
Thread currentThread);
2008-11-17 18:29:00 -05:00
internal abstract Object AllocateObject(VTable vtable,
UIntPtr numBytes,
uint baseAlignment,
Thread currentThread);
2008-03-05 09:52:00 -05:00
internal abstract Array AllocateVector(VTable vtable,
int numElements,
Thread currentThread);
internal abstract Array AllocateArray(VTable vtable,
int rank, int totalElements,
Thread currentThread);
internal abstract String AllocateString(int stringLength,
Thread currentThread);
}
}