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

src/share/vm/ci/ciObject.cpp

Print this page




 170 // is not the true address of the oop -- it will get patched
 171 // during nmethod creation.
 172 //
 173 //
 174 //
 175 // Implementation note: we use the handle as the encoding.  The
 176 // nmethod constructor resolves the handle and patches in the oop.
 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_scavengable();
 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_scavengable();
 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 
 227 // ------------------------------------------------------------------


 170 // is not the true address of the oop -- it will get patched
 171 // during nmethod creation.
 172 //
 173 //
 174 //
 175 // Implementation note: we use the handle as the encoding.  The
 176 // nmethod constructor resolves the handle and patches in the oop.
 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 
 227 // ------------------------------------------------------------------
src/share/vm/ci/ciObject.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File