1.1 --- a/src/share/vm/ci/ciObject.cpp Fri Sep 02 04:28:59 2011 -0700 1.2 +++ b/src/share/vm/ci/ciObject.cpp Fri Sep 02 20:58:21 2011 -0700 1.3 @@ -194,16 +194,26 @@ 1.4 // ciObject::should_be_constant() 1.5 bool ciObject::should_be_constant() { 1.6 if (ScavengeRootsInCode >= 2) return true; // force everybody to be a constant 1.7 - if (!JavaObjectsInPerm && !is_null_object()) { 1.8 + if (is_null_object()) return true; 1.9 + 1.10 + ciEnv* env = CURRENT_ENV; 1.11 + if (!JavaObjectsInPerm) { 1.12 // We want Strings and Classes to be embeddable by default since 1.13 // they used to be in the perm world. Not all Strings used to be 1.14 // embeddable but there's no easy way to distinguish the interned 1.15 // from the regulars ones so just treat them all that way. 1.16 - ciEnv* env = CURRENT_ENV; 1.17 if (klass() == env->String_klass() || klass() == env->Class_klass()) { 1.18 return true; 1.19 } 1.20 } 1.21 + if (EnableInvokeDynamic && 1.22 + (klass()->is_subclass_of(env->MethodHandle_klass()) || 1.23 + klass()->is_subclass_of(env->CallSite_klass()))) { 1.24 + assert(ScavengeRootsInCode >= 1, "must be"); 1.25 + // We want to treat these aggressively. 1.26 + return true; 1.27 + } 1.28 + 1.29 return handle() == NULL || is_perm(); 1.30 } 1.31