< 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
  //

*** 51,10 ***
--- 52,11 ---
      _element_klass = NULL;
    }
    if (!ciObjectFactory::is_initialized()) {
      assert(_element_klass->is_java_lang_Object(), "only arrays of object are shared");
    }
+   _null_free = k->name()->is_Q_array_signature() && k->name()->char_at(1) == JVM_SIGNATURE_INLINE_TYPE;
  }
  
  // ------------------------------------------------------------------
  // ciObjArrayKlass::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 = NULL;
!     }
  }
  
  // ------------------------------------------------------------------
  // ciObjArrayKlass::element_klass
  //
--- 64,20 ---
  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 = NULL;
+   }
+   _null_free = array_name->is_Q_array_signature() && array_name->char_at(1) == JVM_SIGNATURE_INLINE_TYPE;
  }
  
  // ------------------------------------------------------------------
  // 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 {
--- 118,11 ---
    int pos = 0;
    for ( ; pos < dimension; pos++) {
      name[pos] = JVM_SIGNATURE_ARRAY;
    }
    Symbol* base_name_sym = element_name->get_symbol();
!   assert(base_name_sym->char_at(0) != JVM_SIGNATURE_INLINE_TYPE, "unloaded array klass element should not have Q-type");
    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 {

*** 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) {
--- 137,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
--- 149,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

*** 166,10 ***
--- 168,14 ---
  ciObjArrayKlass* ciObjArrayKlass::make(ciKlass* element_klass) {
    GUARDED_VM_ENTRY(return make_impl(element_klass);)
  }
  
  ciKlass* ciObjArrayKlass::exact_klass() {
+   // Even if MyValue is exact, [LMyValue is not exact due to [QMyValue <: [LMyValue.
+   if (!is_elem_null_free() && (!is_loaded() || element_klass()->is_inlinetype())) {
+     return NULL;
+   }
    ciType* base = base_element_type();
    if (base->is_instance_klass()) {
      ciInstanceKlass* ik = base->as_instance_klass();
      if (ik->exact_klass() != NULL) {
        return this;
< prev index next >