Mercurial > hg > truffle
comparison src/share/vm/memory/allocation.cpp @ 1721:413ad0331a0c
6977924: Changes for 6975078 produce build error with certain gcc versions
Summary: The changes introduced for 6975078 assign badHeapOopVal to the _allocation field in the ResourceObj class. In 32 bit linux builds with certain versions of gcc this assignment will be flagged as an error while compiling allocation.cpp. In 32 bit builds the constant value badHeapOopVal (which is cast to an intptr_t) is negative. The _allocation field is typed as an unsigned intptr_t and gcc catches this as an error.
Reviewed-by: jcoomes, ysr, phh
author | johnc |
---|---|
date | Wed, 18 Aug 2010 10:59:06 -0700 |
parents | f4f596978298 |
children | ebfb7c68865e |
comparison
equal
deleted
inserted
replaced
1719:b63010841f78 | 1721:413ad0331a0c |
---|---|
56 } | 56 } |
57 | 57 |
58 void ResourceObj::operator delete(void* p) { | 58 void ResourceObj::operator delete(void* p) { |
59 assert(((ResourceObj *)p)->allocated_on_C_heap(), | 59 assert(((ResourceObj *)p)->allocated_on_C_heap(), |
60 "delete only allowed for C_HEAP objects"); | 60 "delete only allowed for C_HEAP objects"); |
61 DEBUG_ONLY(((ResourceObj *)p)->_allocation = badHeapOopVal;) | 61 DEBUG_ONLY(((ResourceObj *)p)->_allocation = (uintptr_t) badHeapOopVal;) |
62 FreeHeap(p); | 62 FreeHeap(p); |
63 } | 63 } |
64 | 64 |
65 #ifdef ASSERT | 65 #ifdef ASSERT |
66 void ResourceObj::set_allocation_type(address res, allocation_type type) { | 66 void ResourceObj::set_allocation_type(address res, allocation_type type) { |
102 } | 102 } |
103 | 103 |
104 ResourceObj::~ResourceObj() { | 104 ResourceObj::~ResourceObj() { |
105 // allocated_on_C_heap() also checks that encoded (in _allocation) address == this. | 105 // allocated_on_C_heap() also checks that encoded (in _allocation) address == this. |
106 if (!allocated_on_C_heap()) { // ResourceObj::delete() zaps _allocation for C_heap. | 106 if (!allocated_on_C_heap()) { // ResourceObj::delete() zaps _allocation for C_heap. |
107 _allocation = badHeapOopVal; // zap type | 107 _allocation = (uintptr_t) badHeapOopVal; // zap type |
108 } | 108 } |
109 } | 109 } |
110 #endif // ASSERT | 110 #endif // ASSERT |
111 | 111 |
112 | 112 |