--- a/hotspot/src/share/vm/ci/ciObject.cpp Tue Sep 15 11:09:34 2009 -0700
+++ b/hotspot/src/share/vm/ci/ciObject.cpp Tue Sep 15 21:53:47 2009 -0700
@@ -55,6 +55,7 @@
}
_klass = NULL;
_ident = 0;
+ init_flags_from(o);
}
// ------------------------------------------------------------------
@@ -69,6 +70,7 @@
}
_klass = NULL;
_ident = 0;
+ init_flags_from(h());
}
// ------------------------------------------------------------------
@@ -158,7 +160,7 @@
}
// ------------------------------------------------------------------
-// ciObject::encoding
+// ciObject::constant_encoding
//
// The address which the compiler should embed into the
// generated code to represent this oop. This address
@@ -172,16 +174,24 @@
//
// This method should be changed to return an generified address
// to discourage use of the JNI handle.
-jobject ciObject::encoding() {
+jobject ciObject::constant_encoding() {
assert(is_null_object() || handle() != NULL, "cannot embed null pointer");
- assert(has_encoding(), "oop must be NULL or perm");
+ assert(can_be_constant(), "oop must be NULL or perm");
return handle();
}
// ------------------------------------------------------------------
-// ciObject::has_encoding
-bool ciObject::has_encoding() {
- return handle() == NULL || is_perm();
+// 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();
+}
+
+// ------------------------------------------------------------------
+// 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();
}
@@ -195,8 +205,9 @@
void ciObject::print(outputStream* st) {
st->print("<%s", type_string());
GUARDED_VM_ENTRY(print_impl(st);)
- st->print(" ident=%d %s address=0x%x>", ident(),
+ st->print(" ident=%d %s%s address=0x%x>", ident(),
is_perm() ? "PERM" : "",
+ is_scavengable() ? "SCAVENGABLE" : "",
(address)this);
}