< prev index next >

src/hotspot/share/ci/ciField.cpp

Print this page
@@ -27,10 +27,11 @@
  #include "ci/ciInstanceKlass.hpp"
  #include "ci/ciSymbols.hpp"
  #include "ci/ciUtilities.inline.hpp"
  #include "classfile/javaClasses.hpp"
  #include "classfile/vmClasses.hpp"
+ #include "code/SCCache.hpp"
  #include "gc/shared/collectedHeap.inline.hpp"
  #include "interpreter/linkResolver.hpp"
  #include "oops/klass.inline.hpp"
  #include "oops/oop.inline.hpp"
  #include "runtime/fieldDescriptor.inline.hpp"

@@ -315,10 +316,13 @@
      _constant_value = mirror->field_value_impl(type()->basic_type(), offset_in_bytes());
    }
    if (FoldStableValues && is_stable() && _constant_value.is_null_or_zero()) {
      return ciConstant();
    }
+   if (!SCCache::allow_const_field(_constant_value)) {
+     return ciConstant();
+   }
    return _constant_value;
  }
  
  // ------------------------------------------------------------------
  // ciField::constant_value_of

@@ -328,10 +332,13 @@
    assert(object->is_instance(), "must be instance");
    ciConstant field_value = object->as_instance()->field_value(this);
    if (FoldStableValues && is_stable() && field_value.is_null_or_zero()) {
      return ciConstant();
    }
+   if (!SCCache::allow_const_field(field_value)) {
+     return ciConstant();
+   }
    return field_value;
  }
  
  // ------------------------------------------------------------------
  // ciField::compute_type
< prev index next >