You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
parent
ee1447783b
commit
94b2861243
@@ -65,6 +65,28 @@ namespace System {
|
||||
|
||||
public static class GC
|
||||
{
|
||||
#if MONO
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
extern static int GetCollectionCount (int generation);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
extern static int GetMaxGeneration ();
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
extern static void InternalCollect (int generation);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
extern static void RecordPressure (long bytesAllocated);
|
||||
|
||||
// TODO: Move following to ConditionalWeakTable
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
internal extern static void register_ephemeron_array (Ephemeron[] array);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
extern static object get_ephemeron_tombstone ();
|
||||
|
||||
internal static readonly object EPHEMERON_TOMBSTONE = get_ephemeron_tombstone ();
|
||||
#else
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
@@ -139,6 +161,7 @@ namespace System {
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
|
||||
private static extern void _RemoveMemoryPressure(UInt64 bytesAllocated);
|
||||
#endif
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated_required
|
||||
public static void AddMemoryPressure (long bytesAllocated) {
|
||||
@@ -153,7 +176,11 @@ namespace System {
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
#if MONO
|
||||
RecordPressure (bytesAllocated);
|
||||
#else
|
||||
_AddMemoryPressure((ulong)bytesAllocated);
|
||||
#endif
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated_required
|
||||
@@ -169,7 +196,11 @@ namespace System {
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
#if MONO
|
||||
RecordPressure (-bytesAllocated);
|
||||
#else
|
||||
_RemoveMemoryPressure((ulong) bytesAllocated);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -198,8 +229,12 @@ namespace System {
|
||||
//
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static void Collect() {
|
||||
#if MONO
|
||||
InternalCollect (MaxGeneration);
|
||||
#else
|
||||
//-1 says to GC all generations.
|
||||
_Collect(-1, (int)InternalGCCollectionMode.Blocking);
|
||||
#endif
|
||||
}
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
@@ -248,7 +283,11 @@ namespace System {
|
||||
iInternalModes |= (int)InternalGCCollectionMode.NonBlocking;
|
||||
}
|
||||
|
||||
#if MONO
|
||||
InternalCollect (generation);
|
||||
#else
|
||||
_Collect(generation, iInternalModes);
|
||||
#endif
|
||||
}
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
@@ -260,9 +299,15 @@ namespace System {
|
||||
throw new ArgumentOutOfRangeException("generation", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
#if MONO
|
||||
return GetCollectionCount(generation);
|
||||
#else
|
||||
return _CollectionCount(generation, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
// pass in true to get the BGC or FGC count.
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
@@ -275,6 +320,7 @@ namespace System {
|
||||
Contract.EndContractBlock();
|
||||
return _CollectionCount(generation, (getSpecialGCCount ? 1 : 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
// This method DOES NOT DO ANYTHING in and of itself. It's used to
|
||||
// prevent a finalizable object from losing any outstanding references
|
||||
@@ -318,9 +364,16 @@ namespace System {
|
||||
//
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static int GetGeneration(WeakReference wo) {
|
||||
#if MONO
|
||||
object obj = wo.Target;
|
||||
if (obj == null)
|
||||
throw new ArgumentException ();
|
||||
return GetGeneration (obj);
|
||||
#else
|
||||
int result = GetGenerationWR(wo.m_handle);
|
||||
KeepAlive(wo);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns the maximum GC generation. Currently assumes only 1 heap.
|
||||
@@ -330,17 +383,23 @@ namespace System {
|
||||
get { return GetMaxGeneration(); }
|
||||
}
|
||||
|
||||
#if MONO
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
public extern static void WaitForPendingFinalizers ();
|
||||
#else
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static extern void _WaitForPendingFinalizers();
|
||||
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static void WaitForPendingFinalizers() {
|
||||
// QCalls can not be exposed from mscorlib directly, need to wrap it.
|
||||
_WaitForPendingFinalizers();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Indicates that the system should not call the Finalize() method on
|
||||
// an object that would normally require this call.
|
||||
@@ -380,6 +439,31 @@ namespace System {
|
||||
// the GC heap. This does not return the total size of the GC heap, but
|
||||
// only the live objects in the GC heap.
|
||||
//
|
||||
#if MONO
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
public extern static long GetTotalMemory (bool forceFullCollection);
|
||||
|
||||
static bool _RegisterForFullGCNotification(int maxGenerationPercentage, int largeObjectHeapPercentage)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
static bool _CancelFullGCNotification ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
static int _WaitForFullGCApproach (int millisecondsTimeout)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
static int _WaitForFullGCComplete (int millisecondsTimeout)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static long GetTotalMemory(bool forceFullCollection) {
|
||||
long size = GetTotalMemory();
|
||||
@@ -416,6 +500,7 @@ namespace System {
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern int _WaitForFullGCComplete(int millisecondsTimeout);
|
||||
#endif
|
||||
|
||||
[SecurityCritical]
|
||||
public static void RegisterForFullGCNotification(int maxGenerationThreshold, int largeObjectHeapThreshold)
|
||||
@@ -503,6 +588,9 @@ namespace System {
|
||||
[SecurityCritical]
|
||||
static bool StartNoGCRegionWorker(long totalSize, bool hasLohSize, long lohSize, bool disallowFullBlockingGC)
|
||||
{
|
||||
#if MONO
|
||||
throw new NotImplementedException ();
|
||||
#else
|
||||
StartNoGCRegionStatus status = (StartNoGCRegionStatus)_StartNoGCRegion(totalSize, hasLohSize, lohSize, disallowFullBlockingGC);
|
||||
if (status == StartNoGCRegionStatus.AmountTooLarge)
|
||||
throw new ArgumentOutOfRangeException("totalSize",
|
||||
@@ -512,6 +600,7 @@ namespace System {
|
||||
else if (status == StartNoGCRegionStatus.NotEnoughMemory)
|
||||
return false;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
@@ -541,6 +630,9 @@ namespace System {
|
||||
[SecurityCritical]
|
||||
static EndNoGCRegionStatus EndNoGCRegionWorker()
|
||||
{
|
||||
#if MONO
|
||||
throw new NotImplementedException ();
|
||||
#else
|
||||
EndNoGCRegionStatus status = (EndNoGCRegionStatus)_EndNoGCRegion();
|
||||
if (status == EndNoGCRegionStatus.NotInProgress)
|
||||
throw new InvalidOperationException("NoGCRegion mode must be set");
|
||||
@@ -550,6 +642,7 @@ namespace System {
|
||||
throw new InvalidOperationException("Allocated memory exceeds specified memory for NoGCRegion mode");
|
||||
|
||||
return EndNoGCRegionStatus.Succeeded;
|
||||
#endif
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
|
||||
Reference in New Issue
Block a user