hotspot/src/share/vm/ci/ciInstance.cpp
changeset 38030 93f24e7b3c43
parent 22234 da823d78ad65
child 46271 979ebd346ecf
--- a/hotspot/src/share/vm/ci/ciInstance.cpp	Mon Apr 11 21:42:31 2016 +0300
+++ b/hotspot/src/share/vm/ci/ciInstance.cpp	Mon Apr 11 21:42:55 2016 +0300
@@ -56,49 +56,21 @@
 }
 
 // ------------------------------------------------------------------
-// ciInstance::field_value
-//
-// Constant value of a field.
-ciConstant ciInstance::field_value(ciField* field) {
-  assert(is_loaded(), "invalid access - must be loaded");
-  assert(field->holder()->is_loaded(), "invalid access - holder must be loaded");
-  assert(klass()->is_subclass_of(field->holder()), "invalid access - must be subclass");
-
-  VM_ENTRY_MARK;
-  ciConstant result;
+// ciInstance::field_value_impl
+ciConstant ciInstance::field_value_impl(BasicType field_btype, int offset) {
   Handle obj = get_oop();
   assert(!obj.is_null(), "bad oop");
-  BasicType field_btype = field->type()->basic_type();
-  int offset = field->offset();
-
   switch(field_btype) {
-  case T_BYTE:
-    return ciConstant(field_btype, obj->byte_field(offset));
-    break;
-  case T_CHAR:
-    return ciConstant(field_btype, obj->char_field(offset));
-    break;
-  case T_SHORT:
-    return ciConstant(field_btype, obj->short_field(offset));
-    break;
-  case T_BOOLEAN:
-    return ciConstant(field_btype, obj->bool_field(offset));
-    break;
-  case T_INT:
-    return ciConstant(field_btype, obj->int_field(offset));
-    break;
-  case T_FLOAT:
-    return ciConstant(obj->float_field(offset));
-    break;
-  case T_DOUBLE:
-    return ciConstant(obj->double_field(offset));
-    break;
-  case T_LONG:
-    return ciConstant(obj->long_field(offset));
-    break;
-  case T_OBJECT:
-  case T_ARRAY:
-    {
+    case T_BYTE:    return ciConstant(field_btype, obj->byte_field(offset));
+    case T_CHAR:    return ciConstant(field_btype, obj->char_field(offset));
+    case T_SHORT:   return ciConstant(field_btype, obj->short_field(offset));
+    case T_BOOLEAN: return ciConstant(field_btype, obj->bool_field(offset));
+    case T_INT:     return ciConstant(field_btype, obj->int_field(offset));
+    case T_FLOAT:   return ciConstant(obj->float_field(offset));
+    case T_DOUBLE:  return ciConstant(obj->double_field(offset));
+    case T_LONG:    return ciConstant(obj->long_field(offset));
+    case T_OBJECT:  // fall through
+    case T_ARRAY: {
       oop o = obj->obj_field(offset);
 
       // A field will be "constant" if it is known always to be
@@ -115,12 +87,23 @@
       }
     }
   }
-  ShouldNotReachHere();
-  // to shut up the compiler
+  fatal("no field value: %s", type2name(field_btype));
   return ciConstant();
 }
 
 // ------------------------------------------------------------------
+// ciInstance::field_value
+//
+// Constant value of a field.
+ciConstant ciInstance::field_value(ciField* field) {
+  assert(is_loaded(), "invalid access - must be loaded");
+  assert(field->holder()->is_loaded(), "invalid access - holder must be loaded");
+  assert(field->is_static() || klass()->is_subclass_of(field->holder()), "invalid access - must be subclass");
+
+  GUARDED_VM_ENTRY(return field_value_impl(field->type()->basic_type(), field->offset());)
+}
+
+// ------------------------------------------------------------------
 // ciInstance::field_value_by_offset
 //
 // Constant value of a field at the specified offset.