1.1 --- a/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp Fri Aug 06 11:53:28 2010 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp Mon Aug 09 15:17:05 2010 -0700 1.3 @@ -42,14 +42,19 @@ 1.4 // The line below is the worst bit of C++ hackery I've ever written 1.5 // (Detlefs, 11/23). You should think of it as equivalent to 1.6 // "_regions(100, true)": initialize the growable array and inform it 1.7 - // that it should allocate its elem array(s) on the C heap. The first 1.8 - // argument, however, is actually a comma expression (new-expr, 100). 1.9 - // The purpose of the new_expr is to inform the growable array that it 1.10 - // is *already* allocated on the C heap: it uses the placement syntax to 1.11 - // keep it from actually doing any allocation. 1.12 - _regions((ResourceObj::operator new (sizeof(GrowableArray<HeapRegion*>), 1.13 - (void*)&_regions, 1.14 - ResourceObj::C_HEAP), 1.15 + // that it should allocate its elem array(s) on the C heap. 1.16 + // 1.17 + // The first argument, however, is actually a comma expression 1.18 + // (set_allocation_type(this, C_HEAP), 100). The purpose of the 1.19 + // set_allocation_type() call is to replace the default allocation 1.20 + // type for embedded objects STACK_OR_EMBEDDED with C_HEAP. It will 1.21 + // allow to pass the assert in GenericGrowableArray() which checks 1.22 + // that a growable array object must be on C heap if elements are. 1.23 + // 1.24 + // Note: containing object is allocated on C heap since it is CHeapObj. 1.25 + // 1.26 + _regions((ResourceObj::set_allocation_type((address)&_regions, 1.27 + ResourceObj::C_HEAP), 1.28 (int)max_size), 1.29 true), 1.30 _next_rr_candidate(0),