Mercurial > hg > truffle
comparison src/share/vm/memory/allocation.hpp @ 3302:2a3da7eaf4a6
7036747: 7017009 reappeared, problem with ElfStringTable
Summary: Created new "new" operator for CHeapObj that allows malloc to fail without causing fatal error. Also replaced "HeapAllocate" with "os::malloc" in decoder code to allow decoder to handle low memory scenario.
Reviewed-by: coleenp, dholmes
author | zgu |
---|---|
date | Wed, 27 Apr 2011 09:09:57 -0400 |
parents | 4a9604cd7c5f |
children | f6f3bb0ee072 |
comparison
equal
deleted
inserted
replaced
2477:3449f5e02cc4 | 3302:2a3da7eaf4a6 |
---|---|
32 #endif | 32 #endif |
33 #ifdef COMPILER2 | 33 #ifdef COMPILER2 |
34 #include "opto/c2_globals.hpp" | 34 #include "opto/c2_globals.hpp" |
35 #endif | 35 #endif |
36 | 36 |
37 #include <new> | |
38 | |
37 #define ARENA_ALIGN_M1 (((size_t)(ARENA_AMALLOC_ALIGNMENT)) - 1) | 39 #define ARENA_ALIGN_M1 (((size_t)(ARENA_AMALLOC_ALIGNMENT)) - 1) |
38 #define ARENA_ALIGN_MASK (~((size_t)ARENA_ALIGN_M1)) | 40 #define ARENA_ALIGN_MASK (~((size_t)ARENA_ALIGN_M1)) |
39 #define ARENA_ALIGN(x) ((((size_t)(x)) + ARENA_ALIGN_M1) & ARENA_ALIGN_MASK) | 41 #define ARENA_ALIGN(x) ((((size_t)(x)) + ARENA_ALIGN_M1) & ARENA_ALIGN_MASK) |
40 | 42 |
41 // All classes in the virtual machine must be subclassed | 43 // All classes in the virtual machine must be subclassed |
97 #endif | 99 #endif |
98 | 100 |
99 class CHeapObj ALLOCATION_SUPER_CLASS_SPEC { | 101 class CHeapObj ALLOCATION_SUPER_CLASS_SPEC { |
100 public: | 102 public: |
101 void* operator new(size_t size); | 103 void* operator new(size_t size); |
104 void* operator new (size_t size, const std::nothrow_t& nothrow_constant); | |
102 void operator delete(void* p); | 105 void operator delete(void* p); |
103 void* new_array(size_t size); | 106 void* new_array(size_t size); |
104 }; | 107 }; |
105 | 108 |
106 // Base class for objects allocated on the stack only. | 109 // Base class for objects allocated on the stack only. |