< prev index next >

src/hotspot/share/memory/allocation.cpp

Print this page
rev 52794 : imported patch assign_assert


 208              "not embedded or stack, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")",
 209              p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]);
 210     } else {
 211       // Operator new() was not called.
 212       // Assume that it is embedded or stack object.
 213       set_allocation_type((address)this, STACK_OR_EMBEDDED);
 214     }
 215     _allocation_t[1] = 0; // Zap verification value
 216 }
 217 
 218 ResourceObj::ResourceObj() {
 219     initialize_allocation_info();
 220 }
 221 
 222 ResourceObj::ResourceObj(const ResourceObj&) {
 223     // Initialize _allocation_t as a new object, ignoring object being copied.
 224     initialize_allocation_info();
 225 }
 226 
 227 ResourceObj& ResourceObj::operator=(const ResourceObj& r) {



 228     // Keep current _allocation_t value;
 229     return *this;
 230 }
 231 
 232 ResourceObj::~ResourceObj() {
 233     // allocated_on_C_heap() also checks that encoded (in _allocation) address == this.
 234     if (!allocated_on_C_heap()) { // ResourceObj::delete() will zap _allocation for C_heap.
 235       _allocation_t[0] = (uintptr_t)badHeapOopVal; // zap type
 236     }
 237 }
 238 #endif // ASSERT
 239 
 240 //--------------------------------------------------------------------------------------
 241 // Non-product code
 242 
 243 #ifndef PRODUCT
 244 void AllocatedObj::print() const       { print_on(tty); }
 245 void AllocatedObj::print_value() const { print_value_on(tty); }
 246 
 247 void AllocatedObj::print_on(outputStream* st) const {




 208              "not embedded or stack, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")",
 209              p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]);
 210     } else {
 211       // Operator new() was not called.
 212       // Assume that it is embedded or stack object.
 213       set_allocation_type((address)this, STACK_OR_EMBEDDED);
 214     }
 215     _allocation_t[1] = 0; // Zap verification value
 216 }
 217 
 218 ResourceObj::ResourceObj() {
 219     initialize_allocation_info();
 220 }
 221 
 222 ResourceObj::ResourceObj(const ResourceObj&) {
 223     // Initialize _allocation_t as a new object, ignoring object being copied.
 224     initialize_allocation_info();
 225 }
 226 
 227 ResourceObj& ResourceObj::operator=(const ResourceObj& r) {
 228     assert(allocated_on_stack(),
 229            "copy only into local, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")",
 230            p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]);
 231     // Keep current _allocation_t value;
 232     return *this;
 233 }
 234 
 235 ResourceObj::~ResourceObj() {
 236     // allocated_on_C_heap() also checks that encoded (in _allocation) address == this.
 237     if (!allocated_on_C_heap()) { // ResourceObj::delete() will zap _allocation for C_heap.
 238       _allocation_t[0] = (uintptr_t)badHeapOopVal; // zap type
 239     }
 240 }
 241 #endif // ASSERT
 242 
 243 //--------------------------------------------------------------------------------------
 244 // Non-product code
 245 
 246 #ifndef PRODUCT
 247 void AllocatedObj::print() const       { print_on(tty); }
 248 void AllocatedObj::print_value() const { print_value_on(tty); }
 249 
 250 void AllocatedObj::print_on(outputStream* st) const {


< prev index next >