Mercurial > hg > truffle
comparison src/share/vm/memory/allocation.hpp @ 7434:32164d89fe9c
8004845: Catch incorrect usage of new and delete during compile time for value objects and stack objects
Summary: Makes the "new" and "delete" operator of _ValueObj and StackObj private
Reviewed-by: dholmes, coleenp
Contributed-by: erik.helin@oracle.com
author | brutisso |
---|---|
date | Mon, 17 Dec 2012 15:25:26 +0100 |
parents | 59c790074993 |
children | 989155e2d07a 4102b59539ce |
comparison
equal
deleted
inserted
replaced
7433:730cc4ddd550 | 7434:32164d89fe9c |
---|---|
200 | 200 |
201 // Base class for objects allocated on the stack only. | 201 // Base class for objects allocated on the stack only. |
202 // Calling new or delete will result in fatal error. | 202 // Calling new or delete will result in fatal error. |
203 | 203 |
204 class StackObj ALLOCATION_SUPER_CLASS_SPEC { | 204 class StackObj ALLOCATION_SUPER_CLASS_SPEC { |
205 public: | 205 private: |
206 void* operator new(size_t size); | 206 void* operator new(size_t size); |
207 void operator delete(void* p); | 207 void operator delete(void* p); |
208 }; | 208 }; |
209 | 209 |
210 // Base class for objects used as value objects. | 210 // Base class for objects used as value objects. |
224 // | 224 // |
225 // With gcc and possible other compilers the VALUE_OBJ_CLASS_SPEC can | 225 // With gcc and possible other compilers the VALUE_OBJ_CLASS_SPEC can |
226 // be defined as a an empty string "". | 226 // be defined as a an empty string "". |
227 // | 227 // |
228 class _ValueObj { | 228 class _ValueObj { |
229 public: | 229 private: |
230 void* operator new(size_t size); | 230 void* operator new(size_t size); |
231 void operator delete(void* p); | 231 void operator delete(void* p); |
232 }; | 232 }; |
233 | 233 |
234 | 234 |