Skip to content

Commit f4f1d28

Browse files
committed
Stefan's suggestion openjdk#1.
1 parent e1680b1 commit f4f1d28

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

src/hotspot/share/memory/oopFactory.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ typeArrayOop oopFactory::new_typeArray_nozero(BasicType type, int length, TRAPS)
105105
}
106106

107107
objArrayOop oopFactory::new_objArray(Klass* klass, int length, TRAPS) {
108+
ArrayKlass* ak;
108109
if (klass->is_array_klass()) {
109-
return ArrayKlass::cast(klass)->allocate_arrayArray(1, length, THREAD);
110+
ak = ArrayKlass::cast(klass)->array_klass(CHECK_NULL);
110111
} else {
111-
ArrayKlass* ak = InstanceKlass::cast(klass)->array_klass(CHECK_NULL);
112-
return ObjArrayKlass::cast(ak)->allocate_instance(length, THREAD);
112+
ak = InstanceKlass::cast(klass)->array_klass(CHECK_NULL);
113113
}
114+
return ObjArrayKlass::cast(ak)->allocate_instance(length, THREAD);
114115
}
115116

116117
objArrayHandle oopFactory::new_objArray_handle(Klass* klass, int length, TRAPS) {

src/hotspot/share/oops/arrayKlass.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,6 @@ GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots,
187187
return nullptr;
188188
}
189189

190-
objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
191-
check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_NULL);
192-
size_t size = objArrayOopDesc::object_size(length);
193-
ArrayKlass* ak = array_klass(n + dimension(), CHECK_NULL);
194-
objArrayOop o = (objArrayOop)Universe::heap()->array_allocate(ak, size, length,
195-
/* do_zero */ true, CHECK_NULL);
196-
// initialization to null not necessary, area already cleared
197-
return o;
198-
}
199-
200190
// JVMTI support
201191

202192
jint ArrayKlass::jvmti_class_status() const {

src/hotspot/share/oops/arrayKlass.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,6 @@ class ArrayKlass: public Klass {
8787
// Sizes points to the first dimension of the array, subsequent dimensions
8888
// are always in higher memory. The callers of these set that up.
8989
virtual oop multi_allocate(int rank, jint* sizes, TRAPS);
90-
objArrayOop allocate_arrayArray(int n, int length, TRAPS);
9190

9291
// find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
9392
Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;

0 commit comments

Comments
 (0)