< prev index next >

src/hotspot/share/ci/ciObjArrayKlass.cpp

Print this page
*** 25,10 ***
--- 25,11 ---
  #include "precompiled.hpp"
  #include "ci/ciInstanceKlass.hpp"
  #include "ci/ciObjArrayKlass.hpp"
  #include "ci/ciSymbol.hpp"
  #include "ci/ciUtilities.inline.hpp"
+ #include "oops/inlineKlass.inline.hpp"
  #include "oops/objArrayKlass.hpp"
  #include "runtime/signature.hpp"
  
  // ciObjArrayKlass
  //

*** 62,18 ***
  ciObjArrayKlass::ciObjArrayKlass(ciSymbol* array_name,
                                   ciKlass* base_element_klass,
                                   int dimension)
    : ciArrayKlass(array_name,
                   dimension, T_OBJECT) {
!     _base_element_klass = base_element_klass;
!     assert(_base_element_klass->is_instance_klass() ||
!            _base_element_klass->is_type_array_klass(), "bad base klass");
!     if (dimension == 1) {
!       _element_klass = base_element_klass;
!     } else {
!       _element_klass = nullptr;
!     }
  }
  
  // ------------------------------------------------------------------
  // ciObjArrayKlass::element_klass
  //
--- 63,19 ---
  ciObjArrayKlass::ciObjArrayKlass(ciSymbol* array_name,
                                   ciKlass* base_element_klass,
                                   int dimension)
    : ciArrayKlass(array_name,
                   dimension, T_OBJECT) {
!   _base_element_klass = base_element_klass;
!   assert(_base_element_klass->is_instance_klass() ||
!          _base_element_klass->is_type_array_klass() ||
!          _base_element_klass->is_flat_array_klass(), "bad base klass");
!   if (dimension == 1) {
!     _element_klass = base_element_klass;
!   } else {
!     _element_klass = nullptr;
+   }
  }
  
  // ------------------------------------------------------------------
  // ciObjArrayKlass::element_klass
  //

*** 114,11 ***
    int pos = 0;
    for ( ; pos < dimension; pos++) {
      name[pos] = JVM_SIGNATURE_ARRAY;
    }
    Symbol* base_name_sym = element_name->get_symbol();
- 
    if (Signature::is_array(base_name_sym) ||
        Signature::has_envelope(base_name_sym)) {
      strncpy(&name[pos], (char*)element_name->base(), element_len);
      name[pos + element_len] = '\0';
    } else {
--- 116,10 ---

*** 133,11 ***
  // ------------------------------------------------------------------
  // ciObjArrayKlass::make_impl
  //
  // Implementation of make.
  ciObjArrayKlass* ciObjArrayKlass::make_impl(ciKlass* element_klass) {
- 
    if (element_klass->is_loaded()) {
      EXCEPTION_CONTEXT;
      // The element klass is loaded
      Klass* array = element_klass->get_Klass()->array_klass(THREAD);
      if (HAS_PENDING_EXCEPTION) {
--- 134,10 ---

*** 146,12 ***
        return ciEnv::unloaded_ciobjarrayklass();
      }
      return CURRENT_THREAD_ENV->get_obj_array_klass(array);
    }
  
!   // The array klass was unable to be made or the element klass was
-   // not loaded.
    ciSymbol* array_name = construct_array_name(element_klass->name(), 1);
    if (array_name == ciEnv::unloaded_cisymbol()) {
      return ciEnv::unloaded_ciobjarrayklass();
    }
    return
--- 146,11 ---
        return ciEnv::unloaded_ciobjarrayklass();
      }
      return CURRENT_THREAD_ENV->get_obj_array_klass(array);
    }
  
!   // The array klass was unable to be made or the element klass was not loaded.
    ciSymbol* array_name = construct_array_name(element_klass->name(), 1);
    if (array_name == ciEnv::unloaded_cisymbol()) {
      return ciEnv::unloaded_ciobjarrayklass();
    }
    return

*** 174,16 ***
--- 173,28 ---
    }
    return klass->as_obj_array_klass();
  }
  
  ciKlass* ciObjArrayKlass::exact_klass() {
+   if (!is_loaded()) {
+     return nullptr;
+   }
    ciType* base = base_element_type();
    if (base->is_instance_klass()) {
      ciInstanceKlass* ik = base->as_instance_klass();
+     // Even though MyValue is final, [LMyValue is only exact if the array
+     // is null-free due to null-free [LMyValue <: null-able [LMyValue.
+     if (ik->is_inlinetype() && !is_elem_null_free()) {
+       return nullptr;
+     }
      if (ik->exact_klass() != nullptr) {
        return this;
      }
    } else if (base->is_primitive_type()) {
      return this;
    }
    return nullptr;
  }
+ 
+ bool ciObjArrayKlass::is_elem_null_free() const {
+   GUARDED_VM_ENTRY(return get_Klass()->is_null_free_array_klass();)
+ }
< prev index next >