--- a/src/hotspot/cpu/x86/x86_32.ad Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/cpu/x86/x86_32.ad Thu Mar 14 09:08:17 2019 +0100
@@ -391,7 +391,7 @@
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);
--- a/src/hotspot/cpu/x86/x86_64.ad Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/cpu/x86/x86_64.ad Thu Mar 14 09:08:17 2019 +0100
@@ -547,7 +547,7 @@
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 @@
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);
--- a/src/hotspot/share/c1/c1_Runtime1.cpp Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/share/c1/c1_Runtime1.cpp Thu Mar 14 09:08:17 2019 +0100
@@ -1264,7 +1264,7 @@
// 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");
--- a/src/hotspot/share/ci/ciBaseObject.cpp Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/share/ci/ciBaseObject.cpp Thu Mar 14 09:08:17 2019 +0100
@@ -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 @@
//
// 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;
}
--- a/src/hotspot/share/ci/ciBaseObject.hpp Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/share/ci/ciBaseObject.hpp Thu Mar 14 09:08:17 2019 +0100
@@ -54,10 +54,6 @@
protected:
uint _ident;
- enum { FLAG_BITS = 1 };
- enum {
- SCAVENGABLE_FLAG = 1
- };
protected:
ciBaseObject(): _ident(0) {}
--- a/src/hotspot/share/ci/ciObject.cpp Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/share/ci/ciObject.cpp Thu Mar 14 09:08:17 2019 +0100
@@ -59,7 +59,7 @@
_handle = JNIHandles::make_global(obj);
}
_klass = NULL;
- init_flags_from(o);
+ assert(oopDesc::is_oop_or_null(o), "Checking");
}
// ------------------------------------------------------------------
@@ -73,7 +73,7 @@
_handle = JNIHandles::make_global(h);
}
_klass = NULL;
- init_flags_from(h());
+ assert(oopDesc::is_oop_or_null(h()), "Checking");
}
// ------------------------------------------------------------------
@@ -165,18 +165,10 @@
// 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() {
if (ScavengeRootsInCode >= 2) return true; // force everybody to be a constant
@@ -193,7 +185,6 @@
}
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;
}
@@ -202,18 +193,6 @@
}
// ------------------------------------------------------------------
-// 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
//
// Print debugging output about this ciObject.
@@ -223,9 +202,7 @@
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));
}
// ------------------------------------------------------------------
--- a/src/hotspot/share/ci/ciObject.hpp Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/share/ci/ciObject.hpp Thu Mar 14 09:08:17 2019 +0100
@@ -68,8 +68,6 @@
// 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 @@
// 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
--- a/src/hotspot/share/code/nmethod.cpp Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/share/code/nmethod.cpp Thu Mar 14 09:08:17 2019 +0100
@@ -611,10 +611,10 @@
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 @@
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);
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Thu Mar 14 09:08:17 2019 +0100
@@ -4835,9 +4835,7 @@
return;
}
- if (ScavengeRootsInCode) {
- _g1h->register_nmethod(nm);
- }
+ _g1h->register_nmethod(nm);
}
};
--- a/src/hotspot/share/opto/type.cpp Tue Mar 12 15:42:32 2019 +0100
+++ b/src/hotspot/share/opto/type.cpp Thu Mar 14 09:08:17 2019 +0100
@@ -244,10 +244,6 @@
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 @@
// 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 @@
// 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 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");