8207924: serviceability/sa/TestUniverse.java#id0 intermittently fails with assert(get_instanceKlass()->is_loaded()) failed: must be at least loaded

InstanceKlass::implementors() needs the Compile_lock

Reviewed-by: thartmann, eosterlund
This commit is contained in:
Coleen Phillimore 2018-08-11 12:49:33 -04:00
parent 5a80204c23
commit d1aea148fe
4 changed files with 50 additions and 41 deletions

View file

@ -1014,36 +1014,9 @@ public:
#endif
// Access to the implementor of an interface.
Klass* implementor() const
{
Klass** k = adr_implementor();
if (k == NULL) {
return NULL;
} else {
return *k;
}
}
void set_implementor(Klass* k) {
assert(is_interface(), "not interface");
Klass** addr = adr_implementor();
assert(addr != NULL, "null addr");
if (addr != NULL) {
*addr = k;
}
}
int nof_implementors() const {
Klass* k = implementor();
if (k == NULL) {
return 0;
} else if (k != this) {
return 1;
} else {
return 2;
}
}
Klass* implementor() const;
void set_implementor(Klass* k);
int nof_implementors() const;
void add_implementor(Klass* k); // k is a new class that implements this interface
void init_implementor(); // initialize