src/share/vm/c1/c1_Canonicalizer.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/c1/c1_Canonicalizer.cpp

src/share/vm/c1/c1_Canonicalizer.cpp

Print this page

        

*** 255,265 **** } } } } ! void Canonicalizer::do_LoadIndexed (LoadIndexed* x) {} void Canonicalizer::do_StoreIndexed (StoreIndexed* x) { // If a value is going to be stored into a field or array some of // the conversions emitted by javac are unneeded because the fields // are packed to their natural size. Convert* conv = x->value()->as_Convert(); --- 255,296 ---- } } } } ! void Canonicalizer::do_LoadIndexed (LoadIndexed* x) { ! StableArrayConstant* array = x->array()->type()->as_StableArrayConstant(); ! IntConstant* index = x->index()->type()->as_IntConstant(); ! ! assert(array == NULL || FoldStableValues, "not enabled"); ! ! // Constant fold loads from stable arrays. ! if (array != NULL && index != NULL) { ! jint idx = index->value(); ! if (idx < 0 || idx >= array->value()->length()) { ! // Leave the load as is. The range check will handle it. ! return; ! } ! ! ciConstant field_val = array->value()->element_value(idx); ! if (!field_val.is_null_or_zero()) { ! jint dimension = array->dimension(); ! assert(dimension <= array->value()->array_type()->dimension(), "inconsistent info"); ! ValueType* value = NULL; ! if (dimension > 1) { ! // Preserve information about the dimension for the element. ! assert(field_val.as_object()->is_array(), "not an array"); ! value = new StableArrayConstant(field_val.as_object()->as_array(), dimension - 1); ! } else { ! assert(dimension == 1, "sanity"); ! value = as_ValueType(field_val); ! } ! set_canonical(new Constant(value)); ! } ! } ! } ! void Canonicalizer::do_StoreIndexed (StoreIndexed* x) { // If a value is going to be stored into a field or array some of // the conversions emitted by javac are unneeded because the fields // are packed to their natural size. Convert* conv = x->value()->as_Convert();
src/share/vm/c1/c1_Canonicalizer.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File