< prev index next > src/hotspot/share/ci/ciArrayKlass.cpp
Print this page
*
*/
#include "precompiled.hpp"
#include "ci/ciArrayKlass.hpp"
+ #include "ci/ciFlatArrayKlass.hpp"
+ #include "ci/ciInlineKlass.hpp"
#include "ci/ciObjArrayKlass.hpp"
#include "ci/ciTypeArrayKlass.hpp"
#include "ci/ciUtilities.inline.hpp"
+ #include "oops/inlineKlass.inline.hpp"
#include "memory/universe.hpp"
// ciArrayKlass
//
// This class represents a Klass* in the HotSpot virtual machine
// What type is obtained when this array is indexed once?
ciType* ciArrayKlass::element_type() {
if (is_type_array_klass()) {
return ciType::make(as_type_array_klass()->element_type());
} else {
! return as_obj_array_klass()->element_klass()->as_klass();
}
}
// ------------------------------------------------------------------
// What type is obtained when this array is indexed once?
ciType* ciArrayKlass::element_type() {
if (is_type_array_klass()) {
return ciType::make(as_type_array_klass()->element_type());
} else {
! return element_klass()->as_klass();
}
}
// ------------------------------------------------------------------
//
// What type is obtained when this array is indexed as many times as possible?
ciType* ciArrayKlass::base_element_type() {
if (is_type_array_klass()) {
return ciType::make(as_type_array_klass()->element_type());
! } else {
ciKlass* ek = as_obj_array_klass()->base_element_klass();
if (ek->is_type_array_klass()) {
return ciType::make(ek->as_type_array_klass()->element_type());
}
return ek;
}
}
// ------------------------------------------------------------------
//
// What type is obtained when this array is indexed as many times as possible?
ciType* ciArrayKlass::base_element_type() {
if (is_type_array_klass()) {
return ciType::make(as_type_array_klass()->element_type());
! } else if (is_obj_array_klass()) {
ciKlass* ek = as_obj_array_klass()->base_element_klass();
if (ek->is_type_array_klass()) {
return ciType::make(ek->as_type_array_klass()->element_type());
}
return ek;
+ } else {
+ return as_flat_array_klass()->base_element_klass();
}
}
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ciArrayKlass::make
//
// Make an array klass of the specified element type.
! ciArrayKlass* ciArrayKlass::make(ciType* element_type) {
if (element_type->is_primitive_type()) {
return ciTypeArrayKlass::make(element_type->basic_type());
- } else {
- return ciObjArrayKlass::make(element_type->as_klass());
}
}
// ------------------------------------------------------------------
// ciArrayKlass::make
//
// Make an array klass of the specified element type.
! ciArrayKlass* ciArrayKlass::make(ciType* element_type, bool null_free) {
if (element_type->is_primitive_type()) {
return ciTypeArrayKlass::make(element_type->basic_type());
}
+
+ ciKlass* klass = element_type->as_klass();
+ assert(!null_free || !klass->is_loaded() || klass->is_inlinetype() || klass->is_abstract() ||
+ klass->is_java_lang_Object(), "only value classes are null free");
+ if (null_free && klass->is_loaded() && klass->is_inlinetype()) {
+ GUARDED_VM_ENTRY(
+ EXCEPTION_CONTEXT;
+ Klass* ak = InlineKlass::cast(klass->get_Klass())->value_array_klass(THREAD);
+ if (HAS_PENDING_EXCEPTION) {
+ CLEAR_PENDING_EXCEPTION;
+ } else if (ak->is_flatArray_klass()) {
+ return CURRENT_THREAD_ENV->get_flat_array_klass(ak);
+ } else if (ak->is_objArray_klass()) {
+ return CURRENT_THREAD_ENV->get_obj_array_klass(ak);
+ }
+ )
+ }
+ return ciObjArrayKlass::make(klass);
+ }
+
+ int ciArrayKlass::array_header_in_bytes() {
+ return get_ArrayKlass()->array_header_in_bytes();
+ }
+
+ ciInstance* ciArrayKlass::component_mirror_instance() const {
+ GUARDED_VM_ENTRY(
+ oop component_mirror = ArrayKlass::cast(get_Klass())->component_mirror();
+ return CURRENT_ENV->get_instance(component_mirror);
+ )
}
< prev index next >