--- a/hotspot/src/share/vm/ci/ciObject.cpp Wed Apr 27 15:40:36 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciObject.cpp Thu Apr 28 14:00:13 2011 -0700
@@ -194,6 +194,16 @@
// ciObject::should_be_constant()
bool ciObject::should_be_constant() {
if (ScavengeRootsInCode >= 2) return true; // force everybody to be a constant
+ if (!JavaObjectsInPerm && !is_null_object()) {
+ // We want Strings and Classes to be embeddable by default since
+ // they used to be in the perm world. Not all Strings used to be
+ // embeddable but there's no easy way to distinguish the interned
+ // from the regulars ones so just treat them all that way.
+ ciEnv* env = CURRENT_ENV;
+ if (klass() == env->String_klass() || klass() == env->Class_klass()) {
+ return true;
+ }
+ }
return handle() == NULL || !is_scavengable();
}