78 TypeArrayKlass::TypeArrayKlass(BasicType type, Symbol* name) : ArrayKlass(name, Kind) {
79 set_layout_helper(array_layout_helper(type));
80 assert(is_array_klass(), "sanity");
81 assert(is_typeArray_klass(), "sanity");
82
83 set_max_length(arrayOopDesc::max_array_length(type));
84 assert(size() >= TypeArrayKlass::header_size(), "bad size");
85
86 set_class_loader_data(ClassLoaderData::the_null_class_loader_data());
87 }
88
89 typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) {
90 assert(log2_element_size() >= 0, "bad scale");
91 check_array_allocation_length(length, max_length(), CHECK_NULL);
92 size_t size = typeArrayOopDesc::object_size(layout_helper(), length);
93 return (typeArrayOop)Universe::heap()->array_allocate(this, size, length,
94 do_zero, CHECK_NULL);
95 }
96
97 oop TypeArrayKlass::multi_allocate(int rank, jint* last_size, TRAPS) {
98 // For typeArrays this is only called for the last dimension
99 assert(rank == 1, "just checking");
100 int length = *last_size;
101 return allocate(length, THREAD);
102 }
103
104
105 void TypeArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS) {
106 assert(s->is_typeArray(), "must be type array");
107
108 // Check destination type.
109 if (!d->is_typeArray()) {
110 ResourceMark rm(THREAD);
111 stringStream ss;
112 if (d->is_objArray()) {
113 ss.print("arraycopy: type mismatch: can not copy %s[] into object array[]",
114 type2name_tab[ArrayKlass::cast(s->klass())->element_type()]);
115 } else {
116 ss.print("arraycopy: destination type %s is not an array", d->klass()->external_name());
117 }
118 THROW_MSG(vmSymbols::java_lang_ArrayStoreException(), ss.as_string());
|
78 TypeArrayKlass::TypeArrayKlass(BasicType type, Symbol* name) : ArrayKlass(name, Kind) {
79 set_layout_helper(array_layout_helper(type));
80 assert(is_array_klass(), "sanity");
81 assert(is_typeArray_klass(), "sanity");
82
83 set_max_length(arrayOopDesc::max_array_length(type));
84 assert(size() >= TypeArrayKlass::header_size(), "bad size");
85
86 set_class_loader_data(ClassLoaderData::the_null_class_loader_data());
87 }
88
89 typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) {
90 assert(log2_element_size() >= 0, "bad scale");
91 check_array_allocation_length(length, max_length(), CHECK_NULL);
92 size_t size = typeArrayOopDesc::object_size(layout_helper(), length);
93 return (typeArrayOop)Universe::heap()->array_allocate(this, size, length,
94 do_zero, CHECK_NULL);
95 }
96
97 oop TypeArrayKlass::multi_allocate(int rank, jint* last_size, TRAPS) {
98 assert(rank == 1, "just checking");
99 int length = *last_size;
100 return allocate(length, THREAD);
101 }
102
103
104 void TypeArrayKlass::copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS) {
105 assert(s->is_typeArray(), "must be type array");
106
107 // Check destination type.
108 if (!d->is_typeArray()) {
109 ResourceMark rm(THREAD);
110 stringStream ss;
111 if (d->is_objArray()) {
112 ss.print("arraycopy: type mismatch: can not copy %s[] into object array[]",
113 type2name_tab[ArrayKlass::cast(s->klass())->element_type()]);
114 } else {
115 ss.print("arraycopy: destination type %s is not an array", d->klass()->external_name());
116 }
117 THROW_MSG(vmSymbols::java_lang_ArrayStoreException(), ss.as_string());
|