--- old/src/hotspot/share/ci/ciEnv.cpp 2019-03-11 14:25:19.674355798 +0100 +++ new/src/hotspot/share/ci/ciEnv.cpp 2019-03-11 14:25:19.458355801 +0100 @@ -33,6 +33,7 @@ #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" @@ -396,8 +397,8 @@ // Now we need to check the SystemDictionary Symbol* sym = name->get_symbol(); - if (sym->char_at(0) == 'L' && - sym->char_at(sym->utf8_length()-1) == ';') { + 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, @@ -451,7 +452,7 @@ // 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, @@ -466,7 +467,11 @@ require_local); if (elem_klass != NULL && elem_klass->is_loaded()) { // Now make an array for it - return ciObjArrayKlass::make_impl(elem_klass); + 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); + } } } @@ -492,6 +497,21 @@ // 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); } @@ -522,7 +542,7 @@ klass_name = cpool->symbol_at(index); } else { // Check if it's resolved if it's not a symbol constant pool entry. - klass = ConstantPool::klass_at_if_loaded(cpool, index); + klass = ConstantPool::klass_at_if_loaded(cpool, index); // Try to look it up by name. if (klass == NULL) { klass_name = cpool->klass_name_at(index); @@ -575,6 +595,23 @@ } // ------------------------------------------------------------------ +// 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().