diff --git a/src/share/vm/ci/ciField.cpp b/src/share/vm/ci/ciField.cpp index 2729d32d2f5d17c88cea2cfc7ff3cc7940b9e9dc..9851d9e257661d5272c449af4f8fb543bb5c12f2 100644 --- a/src/share/vm/ci/ciField.cpp +++ b/src/share/vm/ci/ciField.cpp @@ -339,7 +339,7 @@ void ciField::print() { if (_type != NULL) _type->print_name(); else tty->print("(reference)"); tty->print(" is_constant=%s", bool_to_str(_is_constant)); - if (_is_constant) { + if (_is_constant && is_static()) { tty->print(" constant_value="); _constant_value.print(); } diff --git a/src/share/vm/opto/macro.cpp b/src/share/vm/opto/macro.cpp index 3431731674de5a5431d3810d2873ff3ccf4bc4b2..214c3150e40be1c3a61c9a2090b04f05af64c473 100644 --- a/src/share/vm/opto/macro.cpp +++ b/src/share/vm/opto/macro.cpp @@ -720,7 +720,7 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray is_loaded()) { field_type = TypeInstPtr::BOTTOM; - } else if (field != NULL && field->is_constant()) { + } else if (field != NULL && field->is_constant() && field->is_static()) { // This can happen if the constant oop is non-perm. ciObject* con = field->constant_value().as_object(); // Do not "join" in the previous type; it doesn't add value,