hotspot/src/share/vm/ci/ciObject.cpp
changeset 10514 e229a19078cf
parent 9959 a6730101c2d0
child 13728 882756847a04
equal deleted inserted replaced
10511:22b3580bd8bb 10514:e229a19078cf
   192 
   192 
   193 // ------------------------------------------------------------------
   193 // ------------------------------------------------------------------
   194 // ciObject::should_be_constant()
   194 // ciObject::should_be_constant()
   195 bool ciObject::should_be_constant() {
   195 bool ciObject::should_be_constant() {
   196   if (ScavengeRootsInCode >= 2)  return true;  // force everybody to be a constant
   196   if (ScavengeRootsInCode >= 2)  return true;  // force everybody to be a constant
   197   if (!JavaObjectsInPerm && !is_null_object()) {
   197   if (is_null_object()) return true;
       
   198 
       
   199   ciEnv* env = CURRENT_ENV;
       
   200   if (!JavaObjectsInPerm) {
   198     // We want Strings and Classes to be embeddable by default since
   201     // We want Strings and Classes to be embeddable by default since
   199     // they used to be in the perm world.  Not all Strings used to be
   202     // they used to be in the perm world.  Not all Strings used to be
   200     // embeddable but there's no easy way to distinguish the interned
   203     // embeddable but there's no easy way to distinguish the interned
   201     // from the regulars ones so just treat them all that way.
   204     // from the regulars ones so just treat them all that way.
   202     ciEnv* env = CURRENT_ENV;
       
   203     if (klass() == env->String_klass() || klass() == env->Class_klass()) {
   205     if (klass() == env->String_klass() || klass() == env->Class_klass()) {
   204       return true;
   206       return true;
   205     }
   207     }
   206   }
   208   }
       
   209   if (EnableInvokeDynamic &&
       
   210       (klass()->is_subclass_of(env->MethodHandle_klass()) ||
       
   211        klass()->is_subclass_of(env->CallSite_klass()))) {
       
   212     assert(ScavengeRootsInCode >= 1, "must be");
       
   213     // We want to treat these aggressively.
       
   214     return true;
       
   215   }
       
   216 
   207   return handle() == NULL || is_perm();
   217   return handle() == NULL || is_perm();
   208 }
   218 }
   209 
   219 
   210 
   220 
   211 // ------------------------------------------------------------------
   221 // ------------------------------------------------------------------