20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OOPS_ARRAY_INLINE_HPP
26 #define SHARE_OOPS_ARRAY_INLINE_HPP
27
28 #include "oops/array.hpp"
29
30 #include "memory/allocation.hpp"
31 #include "memory/metaspace.hpp"
32
33 template <typename T>
34 inline void* Array<T>::operator new(size_t size, ClassLoaderData* loader_data, int length, TRAPS) throw() {
35 size_t word_size = Array::size(length);
36 return (void*) Metaspace::allocate(loader_data, word_size,
37 MetaspaceObj::array_type(sizeof(T)), false, THREAD);
38 }
39
40 #endif // SHARE_OOPS_ARRAY_INLINE_HPP
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OOPS_ARRAY_INLINE_HPP
26 #define SHARE_OOPS_ARRAY_INLINE_HPP
27
28 #include "oops/array.hpp"
29
30 #include "memory/allocation.hpp"
31 #include "memory/metaspace.hpp"
32
33 template <typename T>
34 inline void* Array<T>::operator new(size_t size, ClassLoaderData* loader_data, int length, TRAPS) throw() {
35 size_t word_size = Array::size(length);
36 return (void*) Metaspace::allocate(loader_data, word_size,
37 MetaspaceObj::array_type(sizeof(T)), false, THREAD);
38 }
39
40 template <typename T>
41 inline void* Array<T>::operator new(size_t size, ClassLoaderData* loader_data, int length) throw() {
42 //assert(T is training data, "");
43 size_t word_size = Array::size(length);
44 return (void*) Metaspace::allocate(loader_data, word_size,
45 MetaspaceObj::array_type(sizeof(T)), false);
46 }
47
48 template <typename T>
49 inline void* Array<T>::operator new(size_t size, int length, MemTag flags) throw() {
50 size = Array::size(length) * BytesPerWord;
51 void* p = AllocateHeap(size * BytesPerWord, flags);
52 memset(p, 0, size);
53 return p;
54 }
55
56 #endif // SHARE_OOPS_ARRAY_INLINE_HPP
|