comparison src/share/vm/utilities/growableArray.hpp @ 1685:0e35fa8ebccd

6973963: SEGV in ciBlock::start_bci() with EA Summary: Added more checks into ResourceObj and growableArray to verify correctness of allocation type. Reviewed-by: never, coleenp, dholmes
author kvn
date Tue, 03 Aug 2010 15:55:03 -0700
parents c18cbe5936b8
children f95d63e2154a
comparison
equal deleted inserted replaced
1684:66c5dadb4d61 1685:0e35fa8ebccd
95 _len = initial_len; 95 _len = initial_len;
96 _max = initial_size; 96 _max = initial_size;
97 assert(_len >= 0 && _len <= _max, "initial_len too big"); 97 assert(_len >= 0 && _len <= _max, "initial_len too big");
98 _arena = (c_heap ? (Arena*)1 : NULL); 98 _arena = (c_heap ? (Arena*)1 : NULL);
99 set_nesting(); 99 set_nesting();
100 assert(!c_heap || allocated_on_C_heap(), "growable array must be on C heap if elements are"); 100 assert(!on_C_heap() || allocated_on_C_heap(), "growable array must be on C heap if elements are");
101 assert(!on_stack() ||
102 (allocated_on_res_area() || allocated_on_stack()),
103 "growable array must be on stack if elements are not on arena and not on C heap");
101 } 104 }
102 105
103 // This GA will use the given arena for storage. 106 // This GA will use the given arena for storage.
104 // Consider using new(arena) GrowableArray<T> to allocate the header. 107 // Consider using new(arena) GrowableArray<T> to allocate the header.
105 GenericGrowableArray(Arena* arena, int initial_size, int initial_len) { 108 GenericGrowableArray(Arena* arena, int initial_size, int initial_len) {
106 _len = initial_len; 109 _len = initial_len;
107 _max = initial_size; 110 _max = initial_size;
108 assert(_len >= 0 && _len <= _max, "initial_len too big"); 111 assert(_len >= 0 && _len <= _max, "initial_len too big");
109 _arena = arena; 112 _arena = arena;
110 assert(on_arena(), "arena has taken on reserved value 0 or 1"); 113 assert(on_arena(), "arena has taken on reserved value 0 or 1");
114 // Relax next assert to allow object allocation on resource area,
115 // on stack or embedded into an other object.
116 assert(allocated_on_arena() || allocated_on_stack(),
117 "growable array must be on arena or on stack if elements are on arena");
111 } 118 }
112 119
113 void* raw_allocate(int elementSize); 120 void* raw_allocate(int elementSize);
114 121
115 // some uses pass the Thread explicitly for speed (4990299 tuning) 122 // some uses pass the Thread explicitly for speed (4990299 tuning)