8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_ADLC_ARENA_HPP
26 #define SHARE_VM_ADLC_ARENA_HPP
27
28 // All classes in adlc may be derived
29 // from one of the following allocation classes:
30 //
31 // For objects allocated in the C-heap (managed by: malloc & free).
32 // - CHeapObj
33 //
34 // For classes used as name spaces.
35 // - AllStatic
36 //
37
38 class CHeapObj {
39 public:
40 void* operator new(size_t size) throw();
41 void operator delete(void* p);
42 void* new_array(size_t size);
43 };
44
45
46 // Base class for classes that constitute name spaces.
47
48 class AllStatic {
49 public:
50 void* operator new(size_t size) throw();
51 void operator delete(void* p);
52 };
53
54
55 //------------------------------Chunk------------------------------------------
56 // Linked list of raw memory chunks
57 class Chunk: public CHeapObj {
58 private:
59 // This ordinary operator delete is needed even though not used, so the
60 // below two-argument operator delete will be treated as a placement
61 // delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
62 void operator delete(void* p);
63 public:
64 void* operator new(size_t size, size_t length) throw();
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_ADLC_ARENA_HPP
26 #define SHARE_VM_ADLC_ARENA_HPP
27
28 class AllocFailStrategy {
29 public:
30 enum AllocFailEnum { EXIT_OOM, RETURN_NULL };
31 };
32 typedef AllocFailStrategy::AllocFailEnum AllocFailType;
33
34 void* AllocateHeap(size_t size, AllocFailType alloc_fail_mode = AllocFailStrategy::EXIT_OOM);
35
36 // All classes in adlc may be derived
37 // from one of the following allocation classes:
38 //
39 // For objects allocated in the C-heap (managed by: malloc & free).
40 // - CHeapObj
41 //
42 // For classes used as name spaces.
43 // - AllStatic
44 //
45
46 class CHeapObj {
47 public:
48 void* operator new(size_t size) throw();
49 void operator delete(void* p);
50 void* new_array(size_t size);
51 };
52
53 // Base class for classes that constitute name spaces.
54
55 class AllStatic {
56 public:
57 void* operator new(size_t size) throw();
58 void operator delete(void* p);
59 };
60
61
62 //------------------------------Chunk------------------------------------------
63 // Linked list of raw memory chunks
64 class Chunk: public CHeapObj {
65 private:
66 // This ordinary operator delete is needed even though not used, so the
67 // below two-argument operator delete will be treated as a placement
68 // delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
69 void operator delete(void* p);
70 public:
71 void* operator new(size_t size, size_t length) throw();
|