Mercurial > hg > truffle
diff src/share/vm/memory/allocation.hpp @ 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 | 0e35fa8ebccd |
children | f4f596978298 |
line wrap: on
line diff
--- a/src/share/vm/memory/allocation.hpp Fri Aug 06 11:53:28 2010 -0700 +++ b/src/share/vm/memory/allocation.hpp Mon Aug 09 15:17:05 2010 -0700 @@ -317,6 +317,7 @@ class ResourceObj ALLOCATION_SUPER_CLASS_SPEC { public: enum allocation_type { STACK_OR_EMBEDDED = 0, RESOURCE_AREA, C_HEAP, ARENA, allocation_mask = 0x3 }; + static void set_allocation_type(address res, allocation_type type) NOT_DEBUG_RETURN; #ifdef ASSERT private: // When this object is allocated on stack the new() operator is not @@ -324,12 +325,11 @@ // Store negated 'this' pointer when new() is called to distinguish cases. uintptr_t _allocation; public: - static void set_allocation_type(address res, allocation_type type); - allocation_type get_allocation_type(); - bool allocated_on_stack() { return get_allocation_type() == STACK_OR_EMBEDDED; } - bool allocated_on_res_area() { return get_allocation_type() == RESOURCE_AREA; } - bool allocated_on_C_heap() { return get_allocation_type() == C_HEAP; } - bool allocated_on_arena() { return get_allocation_type() == ARENA; } + allocation_type get_allocation_type() const; + bool allocated_on_stack() const { return get_allocation_type() == STACK_OR_EMBEDDED; } + bool allocated_on_res_area() const { return get_allocation_type() == RESOURCE_AREA; } + bool allocated_on_C_heap() const { return get_allocation_type() == C_HEAP; } + bool allocated_on_arena() const { return get_allocation_type() == ARENA; } ResourceObj(); // default construtor ResourceObj(const ResourceObj& r); // default copy construtor ResourceObj& operator=(const ResourceObj& r); // default copy assignment @@ -348,11 +348,6 @@ DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);) return res; } - void* operator new(size_t size, void* where, allocation_type type) { - address res = (address)where; - DEBUG_ONLY(set_allocation_type(res, type);) - return res; - } void operator delete(void* p); };