예제 #1
0
void
GCInit_Help(double defaultMinRatio, double defaultMaxRatio, 
	int defaultMinRatioSize, int defaultMaxRatioSize)
{
	MinHeapByte = Min(MinHeapByte, MaxHeapByte);
	init_double(&MinRatio, defaultMinRatio);
	init_double(&MaxRatio, defaultMaxRatio);
	init_int(&MinRatioSize, defaultMinRatioSize);
	init_int(&MaxRatioSize, defaultMaxRatioSize);
	fromSpace = Heap_Alloc(MinHeapByte, MaxHeapByte);
	toSpace = Heap_Alloc(MinHeapByte, MaxHeapByte);
	Heap_Resize(fromSpace, (MinHeapByte + MaxHeapByte) / 2, 1);
	Heap_Resize(toSpace, (MinHeapByte + MaxHeapByte) / 2, 1);
}
예제 #2
0
void *scalanative_alloc(void *info, size_t size) {
    size = MathUtils_RoundToNextMultiple(size, WORD_SIZE);

    void **alloc = (void **)Heap_Alloc(heap, size);
    *alloc = info;
    return (void *)alloc;
}
예제 #3
0
void
gc_large_init(void)
{
	largeSpace = Heap_Alloc(LargeHeapByte, LargeHeapByte);
	allocMap = CreateBitmap(LargeHeapByte / largebitmapsize);
	markMap = CreateBitmap(LargeHeapByte / largebitmapsize);
}
예제 #4
0
INLINE void *scalanative_alloc(void *info, size_t size) {
    size = MathUtils_RoundToNextMultiple(size, ALLOCATION_ALIGNMENT);

    void **alloc = (void **)Heap_Alloc(&heap, size);
    *alloc = info;
    return (void *)alloc;
}
예제 #5
0
static const char *Heap_Alloc_test_NoHeap()
{
    Heap *heap = Heap_Construct(heapNone);
    void *mem = Heap_Alloc((Heap *)"someOtherPtr", 10);
    mu_assert(mem == NULL, "this probably crashed");
    mu_assert_failure();
    return NULL;
}
예제 #6
0
HEAP_PTR SystemArray_NewVector(tMD_TypeDef *pArrayTypeDef, U32 length) {
	U32 heapSize;
	tSystemArray *pArray;

	heapSize = sizeof(tSystemArray) + length * pArrayTypeDef->pArrayElementType->arrayElementSize;
	pArray = (tSystemArray*)Heap_Alloc(pArrayTypeDef, heapSize);
	pArray->length = length;
	return (HEAP_PTR)pArray;
}
예제 #7
0
static const char *Heap_Alloc_test()
{
    Heap *heap = Heap_Construct(heapNone);
    void *mem = Heap_Alloc(heap, 10);
    Heap_Free(heap, mem);

    mu_assert(mem != NULL, "no mem");
    mu_assert_success();
    return NULL;
}
예제 #8
0
void GCInit_GenConc(void)
{
  int cache_size = GetBcacheSize();
  double nurseryFraction = 1.2 * NumProc;

  if (ordering == DefaultOrder)
    ordering = StackOrder;
  if (ordering == HybridOrder)
    grayAsReplica = 1;

  GCInit_Help(0.2, 0.8, 512, 50 * 1024);   
  if (relaxed) {
    reducedTenuredSize = Heap_GetSize(fromSpace);
    expandedTenuredSize = reducedToExpanded(reducedTenuredSize, CollectionRate, doAgressive ? 2 : 1);
  }
  else {
    expandedTenuredSize = Heap_GetSize(fromSpace);
    reducedTenuredSize = expandedToReduced(expandedTenuredSize, CollectionRate, doAgressive ? 2 : 1);
    Heap_Resize(fromSpace, reducedTenuredSize, 0);
    Heap_Resize(toSpace, reducedTenuredSize, 0);
  }
  init_int(&NurseryByte, (int)(nurseryFraction * cache_size));
  assert(MinHeapByte >= 1.2*NurseryByte);
  reducedNurserySize = NurseryByte;
  expandedNurserySize = reducedToExpanded(reducedNurserySize, CollectionRate, doAgressive ? 2 : 1);
  maximumNurserySize = 2 * expandedNurserySize; 
  nursery = Heap_Alloc(maximumNurserySize, maximumNurserySize);
  Heap_Resize(nursery, reducedNurserySize, 0);

  gc_large_init();
  workStack = SharedStack_Alloc(1, 100, 16 * 1024, 12 * 1024, 96 * 1024, 16 * 1024, 2048, 256 * 1024);
  barriers = createBarriers(NumProc, 14);
  arraySegmentSize = 2 * 1024;
  mirrorGlobal = 1;
  mirrorArray = 1;
  pauseWarningThreshold = 10.0;
  addOldStackletOnUnderflow = 1;
}
예제 #9
0
파일: Thread.c 프로젝트: obiwanjacobi/Zalt
/// Allocates from the current thread heap.
// ptr_t Thread_Alloc(uint16_t length)
ptr_t FastCall(Thread_Alloc__fast(uint16_t length))
{
    if (length == 0) return NULL;
    return Heap_Alloc(CurrentThread.Heap, length);
}