internal static Object Allocate(VTable vtable, uint count) { UIntPtr numBytes = ObjectLayout.ArraySize(vtable, count); UIntPtr objectAddr = AllocateBlock(numBytes, vtable.baseAlignment); Array result = Magic.toArray(Magic.fromAddress(objectAddr)); #if REFERENCE_COUNTING_GC uint refState = vtable.isAcyclicRefType ? (ReferenceCountingCollector. acyclicFlagMask | 2) : 2; result.REF_STATE = refState & ~ReferenceCountingCollector.countingONFlagMask; #elif DEFERRED_REFERENCE_COUNTING_GC uint refState = vtable.isAcyclicRefType ? (DeferredReferenceCountingCollector. acyclicFlagMask | DeferredReferenceCountingCollector. markFlagMask) : DeferredReferenceCountingCollector. markFlagMask; result.REF_STATE = refState & ~DeferredReferenceCountingCollector.countingONFlagMask; #endif Barrier.BootstrapInitObject(result, vtable); result.InitializeVectorLength((int)count); return(result); }