< prev index next >

src/hotspot/share/ci/ciEnv.cpp

Print this page

        

@@ -31,10 +31,11 @@
 #include "ci/ciInstanceKlass.hpp"
 #include "ci/ciMethod.hpp"
 #include "ci/ciNullObject.hpp"
 #include "ci/ciReplay.hpp"
 #include "ci/ciUtilities.inline.hpp"
+#include "ci/ciValueKlass.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "code/codeCache.hpp"
 #include "code/scopeDesc.hpp"
 #include "compiler/compileBroker.hpp"

@@ -394,11 +395,11 @@
   ASSERT_IN_VM;
   EXCEPTION_CONTEXT;
 
   // Now we need to check the SystemDictionary
   Symbol* sym = name->get_symbol();
-  if (sym->char_at(0) == 'L' &&
+  if ((sym->char_at(0) == 'L' || sym->char_at(0) == 'Q') &&
     sym->char_at(sym->utf8_length()-1) == ';') {
     // This is a name from a signature.  Strip off the trimmings.
     // Call recursive to keep scope of strippedsym.
     TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
                     sym->utf8_length()-2,

@@ -449,11 +450,11 @@
   // In either case, if we can find the element type in the system dictionary,
   // we must build an array type around it.  The CI requires array klasses
   // to be loaded if their element klasses are loaded, except when memory
   // is exhausted.
   if (sym->char_at(0) == '[' &&
-      (sym->char_at(1) == '[' || sym->char_at(1) == 'L')) {
+      (sym->char_at(1) == '[' || sym->char_at(1) == 'L' || sym->char_at(1) == 'Q')) {
     // We have an unloaded array.
     // Build it on the fly if the element class exists.
     TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
                                                  sym->utf8_length()-1,
                                                  KILL_COMPILE_ON_FATAL_(fail_type));

@@ -464,13 +465,17 @@
                              cpool,
                              get_symbol(elem_sym),
                              require_local);
     if (elem_klass != NULL && elem_klass->is_loaded()) {
       // Now make an array for it
+      if (elem_klass->is_valuetype() && elem_klass->as_value_klass()->flatten_array()) {
+        return ciValueArrayKlass::make_impl(elem_klass);
+      } else {
       return ciObjArrayKlass::make_impl(elem_klass);
     }
   }
+  }
 
   if (found_klass == NULL && !cpool.is_null() && cpool->has_preresolution()) {
     // Look inside the constant pool for pre-resolved class entries.
     for (int i = cpool->length() - 1; i >= 1; i--) {
       if (cpool->tag_at(i).is_klass()) {

@@ -490,10 +495,25 @@
 
   if (require_local)  return NULL;
 
   // Not yet loaded into the VM, or not governed by loader constraints.
   // Make a CI representative for it.
+  int i = 0;
+  while (sym->char_at(i) == '[') {
+    i++;
+  }
+  if (i > 0 && sym->char_at(i) == 'Q') {
+    // An unloaded array class of value types is an ObjArrayKlass, an
+    // unloaded value type class is an InstanceKlass. For consistency,
+    // make the signature of the unloaded array of value type use L
+    // rather than Q.
+    char *new_name = CURRENT_THREAD_ENV->name_buffer(sym->utf8_length()+1);
+    strncpy(new_name, (char*)sym->base(), sym->utf8_length());
+    new_name[i] = 'L';
+    new_name[sym->utf8_length()] = '\0';
+    return get_unloaded_klass(accessing_klass, ciSymbol::make(new_name));
+  }
   return get_unloaded_klass(accessing_klass, name);
 }
 
 // ------------------------------------------------------------------
 // ciEnv::get_klass_by_name

@@ -573,10 +593,27 @@
                                    ciInstanceKlass* accessor) {
   GUARDED_VM_ENTRY(return get_klass_by_index_impl(cpool, index, is_accessible, accessor);)
 }
 
 // ------------------------------------------------------------------
+// ciEnv::is_klass_never_null_impl
+//
+// Implementation of is_klass_never_null.
+bool ciEnv::is_klass_never_null_impl(const constantPoolHandle& cpool, int index) {
+  Symbol* klass_name = cpool->klass_name_at(index);
+  return klass_name->is_Q_signature();
+}
+
+// ------------------------------------------------------------------
+// ciEnv::is_klass_never_null
+//
+// Get information about nullability from the constant pool.
+bool ciEnv::is_klass_never_null(const constantPoolHandle& cpool, int index) {
+  GUARDED_VM_ENTRY(return is_klass_never_null_impl(cpool, index);)
+}
+
+// ------------------------------------------------------------------
 // ciEnv::get_constant_by_index_impl
 //
 // Implementation of get_constant_by_index().
 ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
                                              int pool_index, int cache_index,
< prev index next >