diff src/share/vm/ci/ciObject.cpp @ 3464:be4ca325525a

Merge.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 27 Jul 2011 17:32:44 -0700
parents 75a99b4f1c98 28a9fe9534ea
children 47edfca346ab
line wrap: on
line diff
--- a/src/share/vm/ci/ciObject.cpp	Wed Jul 27 17:24:11 2011 -0700
+++ b/src/share/vm/ci/ciObject.cpp	Wed Jul 27 17:32:44 2011 -0700
@@ -201,14 +201,24 @@
 // ciObject::can_be_constant
 bool ciObject::can_be_constant() {
   if (ScavengeRootsInCode >= 1)  return true;  // now everybody can encode as a constant
-  return handle() == NULL || !is_scavengable();
+  return handle() == NULL || is_perm();
 }
 
 // ------------------------------------------------------------------
 // ciObject::should_be_constant()
 bool ciObject::should_be_constant() {
   if (ScavengeRootsInCode >= 2)  return true;  // force everybody to be a constant
-  return handle() == NULL || !is_scavengable();
+  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_perm();
 }