93 } else {
94 // The element type is already Object. Object[] has direct super of Object.
95 super_klass = SystemDictionary::Object_klass();
96 }
97 }
98
99 // Create type name for klass.
100 Symbol* name = NULL;
101 if (!element_klass->is_instance_klass() ||
102 (name = InstanceKlass::cast(element_klass)->array_name()) == NULL) {
103
104 ResourceMark rm(THREAD);
105 char *name_str = element_klass->name()->as_C_string();
106 int len = element_klass->name()->utf8_length();
107 char *new_str = NEW_RESOURCE_ARRAY(char, len + 4);
108 int idx = 0;
109 new_str[idx++] = JVM_SIGNATURE_ARRAY;
110 if (element_klass->is_instance_klass()) { // it could be an array or simple type
111 new_str[idx++] = JVM_SIGNATURE_CLASS;
112 }
113 memcpy(&new_str[idx], name_str, len * sizeof(char));
114 idx += len;
115 if (element_klass->is_instance_klass()) {
116 new_str[idx++] = JVM_SIGNATURE_ENDCLASS;
117 }
118 new_str[idx++] = '\0';
119 name = SymbolTable::new_permanent_symbol(new_str);
120 if (element_klass->is_instance_klass()) {
121 InstanceKlass* ik = InstanceKlass::cast(element_klass);
122 ik->set_array_name(name);
123 }
124 }
125
126 // Initialize instance variables
127 ObjArrayKlass* oak = ObjArrayKlass::allocate(loader_data, n, element_klass, name, CHECK_NULL);
128
129 ModuleEntry* module = oak->module();
130 assert(module != NULL, "No module entry for array");
131
132 // Call complete_create_array_klass after all instance variables has been initialized.
133 ArrayKlass::complete_create_array_klass(oak, super_klass, module, CHECK_NULL);
134
135 // Add all classes to our internal class loader list here,
136 // including classes in the bootstrap (NULL) class loader.
137 // Do this step after creating the mirror so that if the
|
93 } else {
94 // The element type is already Object. Object[] has direct super of Object.
95 super_klass = SystemDictionary::Object_klass();
96 }
97 }
98
99 // Create type name for klass.
100 Symbol* name = NULL;
101 if (!element_klass->is_instance_klass() ||
102 (name = InstanceKlass::cast(element_klass)->array_name()) == NULL) {
103
104 ResourceMark rm(THREAD);
105 char *name_str = element_klass->name()->as_C_string();
106 int len = element_klass->name()->utf8_length();
107 char *new_str = NEW_RESOURCE_ARRAY(char, len + 4);
108 int idx = 0;
109 new_str[idx++] = JVM_SIGNATURE_ARRAY;
110 if (element_klass->is_instance_klass()) { // it could be an array or simple type
111 new_str[idx++] = JVM_SIGNATURE_CLASS;
112 }
113
114 memcpy(&new_str[idx], name_str, len * sizeof(char));
115 idx += len;
116
117 if (element_klass->is_instance_klass()) {
118 if (element_klass->is_hidden()) {
119 // the name of an array of hidden class is of the form "[L<N>;/<S>"
120 // <N> is the binary name of the original class file in internal form
121 // <S> is the suffix
122 int end_class = -1;
123 for (int j = idx-1; j > 0; j--) {
124 new_str[j+1] = new_str[j];
125 if (new_str[j] == '+') {
126 end_class = j;
127 break;
128 }
129 }
130 // Insert ';' before '+' character
131 assert(end_class > 0 && end_class < idx, "invalid hidden class name");
132 new_str[end_class] = JVM_SIGNATURE_ENDCLASS;
133 } else {
134 new_str[idx++] = JVM_SIGNATURE_ENDCLASS;
135 }
136 }
137
138 new_str[idx++] = '\0';
139 name = SymbolTable::new_permanent_symbol(new_str);
140 if (element_klass->is_instance_klass()) {
141 InstanceKlass* ik = InstanceKlass::cast(element_klass);
142 ik->set_array_name(name);
143 }
144 }
145
146 // Initialize instance variables
147 ObjArrayKlass* oak = ObjArrayKlass::allocate(loader_data, n, element_klass, name, CHECK_NULL);
148
149 ModuleEntry* module = oak->module();
150 assert(module != NULL, "No module entry for array");
151
152 // Call complete_create_array_klass after all instance variables has been initialized.
153 ArrayKlass::complete_create_array_klass(oak, super_klass, module, CHECK_NULL);
154
155 // Add all classes to our internal class loader list here,
156 // including classes in the bootstrap (NULL) class loader.
157 // Do this step after creating the mirror so that if the
|