21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classLoaderData.hpp"
28 #include "classfile/javaClasses.inline.hpp"
29 #include "classfile/metadataOnStackMark.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/systemDictionary.hpp"
32 #include "classfile/vmSymbols.hpp"
33 #include "interpreter/linkResolver.hpp"
34 #include "memory/allocation.inline.hpp"
35 #include "memory/heapInspection.hpp"
36 #include "memory/metadataFactory.hpp"
37 #include "memory/metaspaceClosure.hpp"
38 #include "memory/metaspaceShared.hpp"
39 #include "memory/oopFactory.hpp"
40 #include "memory/resourceArea.hpp"
41 #include "oops/constantPool.hpp"
42 #include "oops/instanceKlass.hpp"
43 #include "oops/objArrayKlass.hpp"
44 #include "oops/objArrayOop.inline.hpp"
45 #include "oops/oop.inline.hpp"
46 #include "oops/typeArrayOop.inline.hpp"
47 #include "runtime/fieldType.hpp"
48 #include "runtime/init.hpp"
49 #include "runtime/javaCalls.hpp"
50 #include "runtime/signature.hpp"
51 #include "runtime/vframe.hpp"
52 #include "utilities/copy.hpp"
53
54 ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) {
55 Array<u1>* tags = MetadataFactory::new_array<u1>(loader_data, length, 0, CHECK_NULL);
56 int size = ConstantPool::size(length);
57 return new (loader_data, size, MetaspaceObj::ConstantPoolType, THREAD) ConstantPool(tags);
58 }
59
60 #ifdef ASSERT
61
62 // MetaspaceObj allocation invariant is calloc equivalent memory
63 // simple verification of this here (JVM_CONSTANT_Invalid == 0 )
64 static bool tag_array_is_zero_initialized(Array<u1>* tags) {
65 assert(tags != NULL, "invariant");
66 const int length = tags->length();
67 for (int index = 0; index < length; ++index) {
68 if (JVM_CONSTANT_Invalid != tags->at(index)) {
69 return false;
70 }
71 }
72 return true;
|
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classLoaderData.hpp"
28 #include "classfile/javaClasses.inline.hpp"
29 #include "classfile/metadataOnStackMark.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/systemDictionary.hpp"
32 #include "classfile/vmSymbols.hpp"
33 #include "interpreter/linkResolver.hpp"
34 #include "memory/allocation.inline.hpp"
35 #include "memory/heapInspection.hpp"
36 #include "memory/metadataFactory.hpp"
37 #include "memory/metaspaceClosure.hpp"
38 #include "memory/metaspaceShared.hpp"
39 #include "memory/oopFactory.hpp"
40 #include "memory/resourceArea.hpp"
41 #include "oops/array.inline.hpp"
42 #include "oops/constantPool.inline.hpp"
43 #include "oops/cpCache.inline.hpp"
44 #include "oops/instanceKlass.hpp"
45 #include "oops/objArrayKlass.hpp"
46 #include "oops/objArrayOop.inline.hpp"
47 #include "oops/oop.inline.hpp"
48 #include "oops/typeArrayOop.inline.hpp"
49 #include "runtime/fieldType.hpp"
50 #include "runtime/init.hpp"
51 #include "runtime/javaCalls.hpp"
52 #include "runtime/signature.hpp"
53 #include "runtime/vframe.hpp"
54 #include "utilities/copy.hpp"
55
56 constantTag ConstantPool::tag_at(int which) const { return (constantTag)tags()->at_acquire(which); }
57
58 void ConstantPool::release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); }
59
60 ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) {
61 Array<u1>* tags = MetadataFactory::new_array<u1>(loader_data, length, 0, CHECK_NULL);
62 int size = ConstantPool::size(length);
63 return new (loader_data, size, MetaspaceObj::ConstantPoolType, THREAD) ConstantPool(tags);
64 }
65
66 #ifdef ASSERT
67
68 // MetaspaceObj allocation invariant is calloc equivalent memory
69 // simple verification of this here (JVM_CONSTANT_Invalid == 0 )
70 static bool tag_array_is_zero_initialized(Array<u1>* tags) {
71 assert(tags != NULL, "invariant");
72 const int length = tags->length();
73 for (int index = 0; index < length; ++index) {
74 if (JVM_CONSTANT_Invalid != tags->at(index)) {
75 return false;
76 }
77 }
78 return true;
|