src/share/vm/ci/ciObject.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7071307 Sdiff src/share/vm/ci

src/share/vm/ci/ciObject.cpp

Print this page




 177 //
 178 // This method should be changed to return an generified address
 179 // to discourage use of the JNI handle.
 180 jobject ciObject::constant_encoding() {
 181   assert(is_null_object() || handle() != NULL, "cannot embed null pointer");
 182   assert(can_be_constant(), "oop must be NULL or perm");
 183   return handle();
 184 }
 185 
 186 // ------------------------------------------------------------------
 187 // ciObject::can_be_constant
 188 bool ciObject::can_be_constant() {
 189   if (ScavengeRootsInCode >= 1)  return true;  // now everybody can encode as a constant
 190   return handle() == NULL || is_perm();
 191 }
 192 
 193 // ------------------------------------------------------------------
 194 // ciObject::should_be_constant()
 195 bool ciObject::should_be_constant() {
 196   if (ScavengeRootsInCode >= 2)  return true;  // force everybody to be a constant

 197   if (!JavaObjectsInPerm && !is_null_object()) {
 198     // 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
 200     // embeddable but there's no easy way to distinguish the interned
 201     // 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()) {
 204       return true;
 205     }
 206   }








 207   return handle() == NULL || is_perm();
 208 }
 209 
 210 
 211 // ------------------------------------------------------------------
 212 // ciObject::print
 213 //
 214 // Print debugging output about this ciObject.
 215 //
 216 // Implementation note: dispatch to the virtual print_impl behavior
 217 // for this ciObject.
 218 void ciObject::print(outputStream* st) {
 219   st->print("<%s", type_string());
 220   GUARDED_VM_ENTRY(print_impl(st);)
 221   st->print(" ident=%d %s%s address=0x%x>", ident(),
 222         is_perm() ? "PERM" : "",
 223         is_scavengable() ? "SCAVENGABLE" : "",
 224         (address)this);
 225 }
 226 


 177 //
 178 // This method should be changed to return an generified address
 179 // to discourage use of the JNI handle.
 180 jobject ciObject::constant_encoding() {
 181   assert(is_null_object() || handle() != NULL, "cannot embed null pointer");
 182   assert(can_be_constant(), "oop must be NULL or perm");
 183   return handle();
 184 }
 185 
 186 // ------------------------------------------------------------------
 187 // ciObject::can_be_constant
 188 bool ciObject::can_be_constant() {
 189   if (ScavengeRootsInCode >= 1)  return true;  // now everybody can encode as a constant
 190   return handle() == NULL || is_perm();
 191 }
 192 
 193 // ------------------------------------------------------------------
 194 // ciObject::should_be_constant()
 195 bool ciObject::should_be_constant() {
 196   if (ScavengeRootsInCode >= 2)  return true;  // force everybody to be a constant
 197   ciEnv* env = CURRENT_ENV;
 198   if (!JavaObjectsInPerm && !is_null_object()) {
 199     // We want Strings and Classes to be embeddable by default since
 200     // they used to be in the perm world.  Not all Strings used to be
 201     // embeddable but there's no easy way to distinguish the interned
 202     // from the regulars ones so just treat them all that way.

 203     if (klass() == env->String_klass() || klass() == env->Class_klass()) {
 204       return true;
 205     }
 206   }
 207   if (EnableInvokeDynamic &&
 208       (klass()->is_subclass_of(env->MethodHandle_klass()) ||
 209        klass()->is_subclass_of(env->CallSite_klass()))) {
 210     assert(ScavengeRootsInCode >= 1, "must be");
 211     // We want to treat these aggressively.
 212     return true;
 213   }
 214 
 215   return handle() == NULL || is_perm();
 216 }
 217 
 218 
 219 // ------------------------------------------------------------------
 220 // ciObject::print
 221 //
 222 // Print debugging output about this ciObject.
 223 //
 224 // Implementation note: dispatch to the virtual print_impl behavior
 225 // for this ciObject.
 226 void ciObject::print(outputStream* st) {
 227   st->print("<%s", type_string());
 228   GUARDED_VM_ENTRY(print_impl(st);)
 229   st->print(" ident=%d %s%s address=0x%x>", ident(),
 230         is_perm() ? "PERM" : "",
 231         is_scavengable() ? "SCAVENGABLE" : "",
 232         (address)this);
 233 }
 234 
src/share/vm/ci/ciObject.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File