8220411: Remove ScavengeRootsInCode=0 code
Reviewed-by: thartmann, coleenp
This commit is contained in:
parent
3ec1137c1f
commit
b9cf9e7ca4
@ -391,7 +391,7 @@ void emit_d32_reloc(CodeBuffer &cbuf, int d32, RelocationHolder const& rspec,
|
||||
int format) {
|
||||
#ifdef ASSERT
|
||||
if (rspec.reloc()->type() == relocInfo::oop_type && d32 != 0 && d32 != (int)Universe::non_oop_word()) {
|
||||
assert(oopDesc::is_oop(cast_to_oop(d32)) && (ScavengeRootsInCode || !Universe::heap()->is_scavengable(cast_to_oop(d32))), "cannot embed scavengable oops in code");
|
||||
assert(oopDesc::is_oop(cast_to_oop(d32)), "cannot embed broken oops in code");
|
||||
}
|
||||
#endif
|
||||
cbuf.relocate(cbuf.insts_mark(), rspec, format);
|
||||
|
@ -547,7 +547,7 @@ void emit_d32_reloc(CodeBuffer& cbuf, int d32, RelocationHolder const& rspec, in
|
||||
if (rspec.reloc()->type() == relocInfo::oop_type &&
|
||||
d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) {
|
||||
assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop");
|
||||
assert(oopDesc::is_oop(cast_to_oop((intptr_t)d32)) && (ScavengeRootsInCode || !Universe::heap()->is_scavengable(cast_to_oop((intptr_t)d32))), "cannot embed scavengable oops in code");
|
||||
assert(oopDesc::is_oop(cast_to_oop((intptr_t)d32)), "cannot embed broken oops in code");
|
||||
}
|
||||
#endif
|
||||
cbuf.relocate(cbuf.insts_mark(), rspec, format);
|
||||
@ -574,8 +574,7 @@ void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, RelocationHolder const& rspec
|
||||
if (rspec.reloc()->type() == relocInfo::oop_type &&
|
||||
d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) {
|
||||
assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop");
|
||||
assert(oopDesc::is_oop(cast_to_oop(d64)) && (ScavengeRootsInCode || !Universe::heap()->is_scavengable(cast_to_oop(d64))),
|
||||
"cannot embed scavengable oops in code");
|
||||
assert(oopDesc::is_oop(cast_to_oop(d64)), "cannot embed broken oops in code");
|
||||
}
|
||||
#endif
|
||||
cbuf.relocate(cbuf.insts_mark(), rspec, format);
|
||||
|
@ -1264,7 +1264,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
|
||||
|
||||
// If we are patching in a non-perm oop, make sure the nmethod
|
||||
// is on the right list.
|
||||
if (ScavengeRootsInCode) {
|
||||
{
|
||||
MutexLockerEx ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
|
||||
guarantee(nm != NULL, "only nmethods can contain non-perm oops");
|
||||
|
@ -32,9 +32,8 @@
|
||||
//
|
||||
// Set the unique identity number of a ciBaseObject.
|
||||
void ciBaseObject::set_ident(uint id) {
|
||||
assert((_ident >> FLAG_BITS) == 0, "must only initialize once");
|
||||
assert( id < ((uint)1 << (BitsPerInt-FLAG_BITS)), "id too big");
|
||||
_ident = _ident + (id << FLAG_BITS);
|
||||
assert(_ident == 0, "must only initialize once");
|
||||
_ident = id;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@ -42,7 +41,6 @@ void ciBaseObject::set_ident(uint id) {
|
||||
//
|
||||
// Report the unique identity number of a ciBaseObject.
|
||||
uint ciBaseObject::ident() {
|
||||
uint id = _ident >> FLAG_BITS;
|
||||
assert(id != 0, "must be initialized");
|
||||
return id;
|
||||
assert(_ident != 0, "must be initialized");
|
||||
return _ident;
|
||||
}
|
||||
|
@ -54,10 +54,6 @@ class ciBaseObject : public ResourceObj {
|
||||
protected:
|
||||
uint _ident;
|
||||
|
||||
enum { FLAG_BITS = 1 };
|
||||
enum {
|
||||
SCAVENGABLE_FLAG = 1
|
||||
};
|
||||
protected:
|
||||
ciBaseObject(): _ident(0) {}
|
||||
|
||||
|
@ -59,7 +59,7 @@ ciObject::ciObject(oop o) {
|
||||
_handle = JNIHandles::make_global(obj);
|
||||
}
|
||||
_klass = NULL;
|
||||
init_flags_from(o);
|
||||
assert(oopDesc::is_oop_or_null(o), "Checking");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@ -73,7 +73,7 @@ ciObject::ciObject(Handle h) {
|
||||
_handle = JNIHandles::make_global(h);
|
||||
}
|
||||
_klass = NULL;
|
||||
init_flags_from(h());
|
||||
assert(oopDesc::is_oop_or_null(h()), "Checking");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@ -165,17 +165,9 @@ int ciObject::hash() {
|
||||
// to discourage use of the JNI handle.
|
||||
jobject ciObject::constant_encoding() {
|
||||
assert(is_null_object() || handle() != NULL, "cannot embed null pointer");
|
||||
assert(can_be_constant(), "oop must be NULL or perm");
|
||||
return handle();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciObject::can_be_constant
|
||||
bool ciObject::can_be_constant() {
|
||||
if (ScavengeRootsInCode >= 1) return true; // now everybody can encode as a constant
|
||||
return handle() == NULL;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciObject::should_be_constant()
|
||||
bool ciObject::should_be_constant() {
|
||||
@ -193,7 +185,6 @@ bool ciObject::should_be_constant() {
|
||||
}
|
||||
if (klass()->is_subclass_of(env->MethodHandle_klass()) ||
|
||||
klass()->is_subclass_of(env->CallSite_klass())) {
|
||||
assert(ScavengeRootsInCode >= 1, "must be");
|
||||
// We want to treat these aggressively.
|
||||
return true;
|
||||
}
|
||||
@ -201,18 +192,6 @@ bool ciObject::should_be_constant() {
|
||||
return handle() == NULL;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciObject::should_be_constant()
|
||||
void ciObject::init_flags_from(oop x) {
|
||||
int flags = 0;
|
||||
if (x != NULL) {
|
||||
assert(Universe::heap()->is_in_reserved(x), "must be");
|
||||
if (Universe::heap()->is_scavengable(x))
|
||||
flags |= SCAVENGABLE_FLAG;
|
||||
}
|
||||
_ident |= flags;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciObject::print
|
||||
//
|
||||
@ -223,9 +202,7 @@ void ciObject::init_flags_from(oop x) {
|
||||
void ciObject::print(outputStream* st) {
|
||||
st->print("<%s", type_string());
|
||||
GUARDED_VM_ENTRY(print_impl(st);)
|
||||
st->print(" ident=%d %s address=" INTPTR_FORMAT ">", ident(),
|
||||
is_scavengable() ? "SCAVENGABLE" : "",
|
||||
p2i((address)this));
|
||||
st->print(" ident=%d address=" INTPTR_FORMAT ">", ident(), p2i(this));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@ -68,8 +68,6 @@ protected:
|
||||
// Get the VM oop that this object holds.
|
||||
oop get_oop() const;
|
||||
|
||||
void init_flags_from(oop x);
|
||||
|
||||
// Virtual behavior of the print() method.
|
||||
virtual void print_impl(outputStream* st) {}
|
||||
|
||||
@ -85,22 +83,9 @@ public:
|
||||
// A hash value for the convenience of compilers.
|
||||
int hash();
|
||||
|
||||
// Tells if this oop has an encoding as a constant.
|
||||
// True if is_perm is true.
|
||||
// Also true if ScavengeRootsInCode is non-zero.
|
||||
// If it does not have an encoding, the compiler is responsible for
|
||||
// making other arrangements for dealing with the oop.
|
||||
// See ciEnv::make_array
|
||||
bool can_be_constant();
|
||||
|
||||
// Tells if this oop should be made a constant.
|
||||
// True if is_perm is true or ScavengeRootsInCode > 1.
|
||||
bool should_be_constant();
|
||||
|
||||
// Might this object possibly move during a scavenge operation?
|
||||
// If the answer is true and ScavengeRootsInCode==0, the oop cannot be embedded in code.
|
||||
bool is_scavengable() { return (_ident & SCAVENGABLE_FLAG) != 0; }
|
||||
|
||||
// The address which the compiler should embed into the
|
||||
// generated code to represent this oop. This address
|
||||
// is not the true address of the oop -- it will get patched
|
||||
|
@ -611,10 +611,10 @@ nmethod::nmethod(
|
||||
code_buffer->copy_values_to(this);
|
||||
|
||||
clear_unloading_state();
|
||||
if (ScavengeRootsInCode) {
|
||||
Universe::heap()->register_nmethod(this);
|
||||
}
|
||||
|
||||
Universe::heap()->register_nmethod(this);
|
||||
debug_only(Universe::heap()->verify_nmethod(this));
|
||||
|
||||
CodeCache::commit(this);
|
||||
}
|
||||
|
||||
@ -771,9 +771,8 @@ nmethod::nmethod(
|
||||
debug_info->copy_to(this);
|
||||
dependencies->copy_to(this);
|
||||
clear_unloading_state();
|
||||
if (ScavengeRootsInCode) {
|
||||
Universe::heap()->register_nmethod(this);
|
||||
}
|
||||
|
||||
Universe::heap()->register_nmethod(this);
|
||||
debug_only(Universe::heap()->verify_nmethod(this));
|
||||
|
||||
CodeCache::commit(this);
|
||||
|
@ -4835,9 +4835,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (ScavengeRootsInCode) {
|
||||
_g1h->register_nmethod(nm);
|
||||
}
|
||||
_g1h->register_nmethod(nm);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -244,10 +244,6 @@ const Type* Type::make_from_constant(ciConstant constant, bool require_constant,
|
||||
case T_DOUBLE: return TypeD::make(constant.as_double());
|
||||
case T_ARRAY:
|
||||
case T_OBJECT: {
|
||||
// cases:
|
||||
// can_be_constant = (oop not scavengable || ScavengeRootsInCode != 0)
|
||||
// should_be_constant = (oop not scavengable || ScavengeRootsInCode >= 2)
|
||||
// An oop is not scavengable if it is in the perm gen.
|
||||
const Type* con_type = NULL;
|
||||
ciObject* oop_constant = constant.as_object();
|
||||
if (oop_constant->is_null_object()) {
|
||||
@ -3228,15 +3224,17 @@ const TypeOopPtr* TypeOopPtr::make_from_klass_common(ciKlass *klass, bool klass_
|
||||
// Make a java pointer from an oop constant
|
||||
const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_constant) {
|
||||
assert(!o->is_null_object(), "null object not yet handled here.");
|
||||
|
||||
const bool make_constant = require_constant || o->should_be_constant();
|
||||
|
||||
ciKlass* klass = o->klass();
|
||||
if (klass->is_instance_klass()) {
|
||||
// Element is an instance
|
||||
if (require_constant) {
|
||||
if (!o->can_be_constant()) return NULL;
|
||||
} else if (!o->should_be_constant()) {
|
||||
if (make_constant) {
|
||||
return TypeInstPtr::make(o);
|
||||
} else {
|
||||
return TypeInstPtr::make(TypePtr::NotNull, klass, true, NULL, 0);
|
||||
}
|
||||
return TypeInstPtr::make(o);
|
||||
} else if (klass->is_obj_array_klass()) {
|
||||
// Element is an object array. Recursively call ourself.
|
||||
const TypeOopPtr *etype =
|
||||
@ -3245,13 +3243,11 @@ const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_const
|
||||
// We used to pass NotNull in here, asserting that the sub-arrays
|
||||
// are all not-null. This is not true in generally, as code can
|
||||
// slam NULLs down in the subarrays.
|
||||
if (require_constant) {
|
||||
if (!o->can_be_constant()) return NULL;
|
||||
} else if (!o->should_be_constant()) {
|
||||
if (make_constant) {
|
||||
return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0);
|
||||
} else {
|
||||
return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0);
|
||||
}
|
||||
const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0);
|
||||
return arr;
|
||||
} else if (klass->is_type_array_klass()) {
|
||||
// Element is an typeArray
|
||||
const Type* etype =
|
||||
@ -3259,13 +3255,11 @@ const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_const
|
||||
const TypeAry* arr0 = TypeAry::make(etype, TypeInt::make(o->as_array()->length()));
|
||||
// We used to pass NotNull in here, asserting that the array pointer
|
||||
// is not-null. That was not true in general.
|
||||
if (require_constant) {
|
||||
if (!o->can_be_constant()) return NULL;
|
||||
} else if (!o->should_be_constant()) {
|
||||
if (make_constant) {
|
||||
return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0);
|
||||
} else {
|
||||
return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0);
|
||||
}
|
||||
const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0);
|
||||
return arr;
|
||||
}
|
||||
|
||||
fatal("unhandled object type");
|
||||
|
Loading…
x
Reference in New Issue
Block a user