Esempio n. 1
0
 // This GA will use the resource stack for storage if c_heap==false,
 // Else it will use the C heap.  Use clear_and_deallocate to avoid leaks.
 GenericGrowableArray(int initial_size, int initial_len, bool c_heap) {
   _len = initial_len;
   _max = initial_size;
   assert(_len >= 0 && _len <= _max, "initial_len too big");
   _arena = (c_heap ? (Arena*)1 : NULL);
   set_nesting();
   assert(!on_C_heap() || allocated_on_C_heap(), "growable array must be on C heap if elements are");
   assert(!on_stack() ||
          (allocated_on_res_area() || allocated_on_stack()),
          "growable array must be on stack if elements are not on arena and not on C heap");
 }
Esempio n. 2
0
 // This GA will use the given arena for storage.
 // Consider using new(arena) GrowableArray<T> to allocate the header.
 GenericGrowableArray(Arena* arena, int initial_size, int initial_len) {
   _len = initial_len;
   _max = initial_size;
   assert(_len >= 0 && _len <= _max, "initial_len too big");
   _arena = arena;
   assert(on_arena(), "arena has taken on reserved value 0 or 1");
   // Relax next assert to allow object allocation on resource area,
   // on stack or embedded into an other object.
   assert(allocated_on_arena() || allocated_on_stack(),
          "growable array must be on arena or on stack if elements are on arena");
 }
Esempio n. 3
0
  // This GA will use the resource stack for storage if c_heap==false,
  // Else it will use the C heap.  Use clear_and_deallocate to avoid leaks.
  GenericGrowableArray(int initial_size, int initial_len, bool c_heap, MEMFLAGS flags = mtNone) {
    _len = initial_len;
    _max = initial_size;
    _memflags = flags;

    // memory type has to be specified for C heap allocation
    assert(!(c_heap && flags == mtNone), "memory type not specified for C heap object");

    assert(_len >= 0 && _len <= _max, "initial_len too big");
    _arena = (c_heap ? (Arena*)1 : NULL);
    set_nesting();
    assert(!on_C_heap() || allocated_on_C_heap(), "growable array must be on C heap if elements are");
    assert(!on_stack() ||
           (allocated_on_res_area() || allocated_on_stack()),
           "growable array must be on stack if elements are not on arena and not on C heap");
  }