6975078: assert(allocated_on_res_area() || allocated_on_C_heap() || allocated_on_arena()

Pass the check in ResourceObj() if _allocation value is already set and object is allocated on stack.

Reviewed-by: dholmes, johnc
This commit is contained in:
Vladimir Kozlov 2010-08-09 15:17:05 -07:00
parent 7895bef72f
commit 2e48a18645
6 changed files with 49 additions and 34 deletions

View file

@ -158,13 +158,18 @@ CollectionSetChooser::CollectionSetChooser() :
// The line below is the worst bit of C++ hackery I've ever written
// (Detlefs, 11/23). You should think of it as equivalent to
// "_regions(100, true)": initialize the growable array and inform it
// that it should allocate its elem array(s) on the C heap. The first
// argument, however, is actually a comma expression (new-expr, 100).
// The purpose of the new_expr is to inform the growable array that it
// is *already* allocated on the C heap: it uses the placement syntax to
// keep it from actually doing any allocation.
_markedRegions((ResourceObj::operator new (sizeof(GrowableArray<HeapRegion*>),
(void*)&_markedRegions,
// that it should allocate its elem array(s) on the C heap.
//
// The first argument, however, is actually a comma expression
// (set_allocation_type(this, C_HEAP), 100). The purpose of the
// set_allocation_type() call is to replace the default allocation
// type for embedded objects STACK_OR_EMBEDDED with C_HEAP. It will
// allow to pass the assert in GenericGrowableArray() which checks
// that a growable array object must be on C heap if elements are.
//
// Note: containing object is allocated on C heap since it is CHeapObj.
//
_markedRegions((ResourceObj::set_allocation_type((address)&_markedRegions,
ResourceObj::C_HEAP),
100),
true),