Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/heapRegionSeq.cpp @ 1688:2dfd013a7465
6975078: assert(allocated_on_res_area() || allocated_on_C_heap() || allocated_on_arena()
Summary: Pass the check in ResourceObj() if _allocation value is already set and object is allocated on stack.
Reviewed-by: dholmes, johnc
author | kvn |
---|---|
date | Mon, 09 Aug 2010 15:17:05 -0700 |
parents | c18cbe5936b8 |
children | 72a161e62cc4 |
comparison
equal
deleted
inserted
replaced
1687:fb8abd207dbe | 1688:2dfd013a7465 |
---|---|
40 HeapRegionSeq::HeapRegionSeq(const size_t max_size) : | 40 HeapRegionSeq::HeapRegionSeq(const size_t max_size) : |
41 _alloc_search_start(0), | 41 _alloc_search_start(0), |
42 // The line below is the worst bit of C++ hackery I've ever written | 42 // The line below is the worst bit of C++ hackery I've ever written |
43 // (Detlefs, 11/23). You should think of it as equivalent to | 43 // (Detlefs, 11/23). You should think of it as equivalent to |
44 // "_regions(100, true)": initialize the growable array and inform it | 44 // "_regions(100, true)": initialize the growable array and inform it |
45 // that it should allocate its elem array(s) on the C heap. The first | 45 // that it should allocate its elem array(s) on the C heap. |
46 // argument, however, is actually a comma expression (new-expr, 100). | 46 // |
47 // The purpose of the new_expr is to inform the growable array that it | 47 // The first argument, however, is actually a comma expression |
48 // is *already* allocated on the C heap: it uses the placement syntax to | 48 // (set_allocation_type(this, C_HEAP), 100). The purpose of the |
49 // keep it from actually doing any allocation. | 49 // set_allocation_type() call is to replace the default allocation |
50 _regions((ResourceObj::operator new (sizeof(GrowableArray<HeapRegion*>), | 50 // type for embedded objects STACK_OR_EMBEDDED with C_HEAP. It will |
51 (void*)&_regions, | 51 // allow to pass the assert in GenericGrowableArray() which checks |
52 ResourceObj::C_HEAP), | 52 // that a growable array object must be on C heap if elements are. |
53 // | |
54 // Note: containing object is allocated on C heap since it is CHeapObj. | |
55 // | |
56 _regions((ResourceObj::set_allocation_type((address)&_regions, | |
57 ResourceObj::C_HEAP), | |
53 (int)max_size), | 58 (int)max_size), |
54 true), | 59 true), |
55 _next_rr_candidate(0), | 60 _next_rr_candidate(0), |
56 _seq_bottom(NULL) | 61 _seq_bottom(NULL) |
57 {} | 62 {} |