< prev index next > src/hotspot/share/ci/ciInstance.cpp
Print this page
// This class represents an instanceOop in the HotSpot virtual
// machine.
// ------------------------------------------------------------------
// ciObject::java_mirror_type
! ciType* ciInstance::java_mirror_type() {
VM_ENTRY_MARK;
oop m = get_oop();
// Return null if it is not java.lang.Class.
if (m == nullptr || m->klass() != vmClasses::Class_klass()) {
return nullptr;
// This class represents an instanceOop in the HotSpot virtual
// machine.
// ------------------------------------------------------------------
// ciObject::java_mirror_type
! ciType* ciInstance::java_mirror_type(bool* is_null_free_array) {
VM_ENTRY_MARK;
oop m = get_oop();
// Return null if it is not java.lang.Class.
if (m == nullptr || m->klass() != vmClasses::Class_klass()) {
return nullptr;
if (java_lang_Class::is_primitive(m)) {
return ciType::make(java_lang_Class::primitive_type(m));
} else {
Klass* k = java_lang_Class::as_Klass(m);
assert(k != nullptr, "");
+ if (is_null_free_array != nullptr && (k->is_flatArray_klass() || (k->is_objArray_klass() && k->is_null_free_array_klass()))) {
+ *is_null_free_array = true;
+ }
return CURRENT_THREAD_ENV->get_klass(k);
}
}
// ------------------------------------------------------------------
//
// Constant value of a field.
ciConstant ciInstance::field_value(ciField* field) {
assert(is_loaded(), "invalid access - must be loaded");
assert(field->holder()->is_loaded(), "invalid access - holder must be loaded");
! assert(field->is_static() || klass()->is_subclass_of(field->holder()), "invalid access - must be subclass");
return field_value_impl(field->type()->basic_type(), field->offset_in_bytes());
}
// ------------------------------------------------------------------
// ciInstance::field_value_by_offset
//
// Constant value of a field.
ciConstant ciInstance::field_value(ciField* field) {
assert(is_loaded(), "invalid access - must be loaded");
assert(field->holder()->is_loaded(), "invalid access - holder must be loaded");
! assert(field->is_static() || field->holder()->is_inlinetype() || klass()->is_subclass_of(field->holder()),
+ "invalid access - must be subclass");
+
return field_value_impl(field->type()->basic_type(), field->offset_in_bytes());
}
// ------------------------------------------------------------------
// ciInstance::field_value_by_offset
< prev index next >