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 #include "precompiled.hpp"
26 #include "classfile/classLoaderData.hpp"
27 #include "memory/heapInspection.hpp"
28 #include "memory/metadataFactory.hpp"
29 #include "memory/oopFactory.hpp"
30 #include "oops/annotations.hpp"
31 #include "oops/instanceKlass.hpp"
32 #include "utilities/ostream.hpp"
33
34 // Allocate annotations in metadata area
35 Annotations* Annotations::allocate(ClassLoaderData* loader_data, TRAPS) {
36 return new (loader_data, size(), true, MetaspaceObj::AnnotationType, THREAD) Annotations();
37 }
38
39 // helper
40 void Annotations::free_contents(ClassLoaderData* loader_data, Array<AnnotationArray*>* p) {
41 if (p != NULL) {
42 for (int i = 0; i < p->length(); i++) {
43 MetadataFactory::free_array<u1>(loader_data, p->at(i));
44 }
45 MetadataFactory::free_array<AnnotationArray*>(loader_data, p);
46 }
47 }
48
49 void Annotations::deallocate_contents(ClassLoaderData* loader_data) {
50 if (class_annotations() != NULL) {
51 MetadataFactory::free_array<u1>(loader_data, class_annotations());
|
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 #include "precompiled.hpp"
26 #include "classfile/classLoaderData.hpp"
27 #include "memory/heapInspection.hpp"
28 #include "memory/metadataFactory.hpp"
29 #include "memory/oopFactory.hpp"
30 #include "oops/annotations.hpp"
31 #include "oops/instanceKlass.hpp"
32 #include "oops/typeArrayOop.inline.hpp"
33 #include "utilities/ostream.hpp"
34
35 // Allocate annotations in metadata area
36 Annotations* Annotations::allocate(ClassLoaderData* loader_data, TRAPS) {
37 return new (loader_data, size(), true, MetaspaceObj::AnnotationType, THREAD) Annotations();
38 }
39
40 // helper
41 void Annotations::free_contents(ClassLoaderData* loader_data, Array<AnnotationArray*>* p) {
42 if (p != NULL) {
43 for (int i = 0; i < p->length(); i++) {
44 MetadataFactory::free_array<u1>(loader_data, p->at(i));
45 }
46 MetadataFactory::free_array<AnnotationArray*>(loader_data, p);
47 }
48 }
49
50 void Annotations::deallocate_contents(ClassLoaderData* loader_data) {
51 if (class_annotations() != NULL) {
52 MetadataFactory::free_array<u1>(loader_data, class_annotations());
|