mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-18 03:43:15 +00:00
8270794: Avoid loading Klass* twice in TypeArrayKlass::oop_size()
Reviewed-by: shade, coleenp
This commit is contained in:
parent
fc80a6b493
commit
ea49691f1d
@ -230,7 +230,7 @@ Klass* TypeArrayKlass::array_klass_or_null() {
|
||||
int TypeArrayKlass::oop_size(oop obj) const {
|
||||
assert(obj->is_typeArray(),"must be a type array");
|
||||
typeArrayOop t = typeArrayOop(obj);
|
||||
return t->object_size();
|
||||
return t->object_size(this);
|
||||
}
|
||||
|
||||
void TypeArrayKlass::initialize(TRAPS) {
|
||||
|
||||
@ -131,7 +131,7 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
inline int object_size();
|
||||
inline int object_size(const TypeArrayKlass* tk) const;
|
||||
};
|
||||
|
||||
#endif // SHARE_OOPS_TYPEARRAYOOP_HPP
|
||||
|
||||
@ -31,8 +31,7 @@
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/arrayOop.hpp"
|
||||
|
||||
int typeArrayOopDesc::object_size() {
|
||||
TypeArrayKlass* tk = TypeArrayKlass::cast(klass());
|
||||
int typeArrayOopDesc::object_size(const TypeArrayKlass* tk) const {
|
||||
return object_size(tk->layout_helper(), length());
|
||||
}
|
||||
|
||||
|
||||
@ -302,7 +302,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(Klass* array_type, int len
|
||||
if ((len > 0) && (result != NULL) &&
|
||||
is_deoptimized_caller_frame(current)) {
|
||||
// Zero array here if the caller is deoptimized.
|
||||
int size = ((typeArrayOop)result)->object_size();
|
||||
int size = TypeArrayKlass::cast(array_type)->oop_size(result);
|
||||
BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
|
||||
const size_t hs = arrayOopDesc::header_size(elem_type);
|
||||
// Align to next 8 bytes to avoid trashing arrays's length.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user