< prev index next > src/hotspot/share/oops/array.inline.hpp
Print this page
/*
! * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
/*
! * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
size_t word_size = Array::size(length);
return (void*) Metaspace::allocate(loader_data, word_size,
MetaspaceObj::array_type(sizeof(T)), THREAD);
}
+ template <typename T>
+ inline void* Array<T>::operator new(size_t size, ClassLoaderData* loader_data, int length) throw() {
+ //assert(T is training data, "");
+ size_t word_size = Array::size(length);
+ return (void*) Metaspace::allocate(loader_data, word_size,
+ MetaspaceObj::array_type(sizeof(T)));
+ }
+
+ template <typename T>
+ inline void* Array<T>::operator new(size_t size, int length, MEMFLAGS flags) throw() {
+ size = Array::size(length) * BytesPerWord;
+ void* p = AllocateHeap(size * BytesPerWord, flags);
+ memset(p, 0, size);
+ return p;
+ }
+
#endif // SHARE_OOPS_ARRAY_INLINE_HPP
< prev index next >