20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_MEMORY_ALLOCATION_HPP 26 #define SHARE_VM_MEMORY_ALLOCATION_HPP 27 28 #include "runtime/globals.hpp" 29 #include "utilities/globalDefinitions.hpp" 30 #include "utilities/macros.hpp" 31 #ifdef COMPILER1 32 #include "c1/c1_globals.hpp" 33 #endif 34 #ifdef COMPILER2 35 #include "opto/c2_globals.hpp" 36 #endif 37 38 #include <new> 39 40 #define ARENA_ALIGN_M1 (((size_t)(ARENA_AMALLOC_ALIGNMENT)) - 1) 41 #define ARENA_ALIGN_MASK (~((size_t)ARENA_ALIGN_M1)) 42 #define ARENA_ALIGN(x) ((((size_t)(x)) + ARENA_ALIGN_M1) & ARENA_ALIGN_MASK) 43 44 class AllocFailStrategy { 45 public: 46 enum AllocFailEnum { EXIT_OOM, RETURN_NULL }; 47 }; 48 typedef AllocFailStrategy::AllocFailEnum AllocFailType; 49 50 // All classes in the virtual machine must be subclassed 51 // by one of the following allocation classes: 52 // 53 // For objects allocated in the resource area (see resourceArea.hpp). 54 // - ResourceObj 55 // 56 // For objects allocated in the C-heap (managed by: free & malloc). 57 // - CHeapObj 58 // 59 // For objects allocated on the stack. | 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_MEMORY_ALLOCATION_HPP 26 #define SHARE_VM_MEMORY_ALLOCATION_HPP 27 28 #include "runtime/globals.hpp" 29 #include "utilities/globalDefinitions.hpp" 30 #include "utilities/macros.hpp" 31 #ifdef COMPILER1 32 #include "c1/c1_globals.hpp" 33 #endif 34 #ifdef COMPILER2 35 #include "opto/c2_globals.hpp" 36 #endif 37 38 #include <new> 39 40 // The byte alignment to be used by Arena::Amalloc. See bugid 4169348. 41 // Note: this value must be a power of 2 42 43 #define ARENA_AMALLOC_ALIGNMENT (2*BytesPerWord) 44 45 #define ARENA_ALIGN_M1 (((size_t)(ARENA_AMALLOC_ALIGNMENT)) - 1) 46 #define ARENA_ALIGN_MASK (~((size_t)ARENA_ALIGN_M1)) 47 #define ARENA_ALIGN(x) ((((size_t)(x)) + ARENA_ALIGN_M1) & ARENA_ALIGN_MASK) 48 49 class AllocFailStrategy { 50 public: 51 enum AllocFailEnum { EXIT_OOM, RETURN_NULL }; 52 }; 53 typedef AllocFailStrategy::AllocFailEnum AllocFailType; 54 55 // All classes in the virtual machine must be subclassed 56 // by one of the following allocation classes: 57 // 58 // For objects allocated in the resource area (see resourceArea.hpp). 59 // - ResourceObj 60 // 61 // For objects allocated in the C-heap (managed by: free & malloc). 62 // - CHeapObj 63 // 64 // For objects allocated on the stack. |