mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8215206: VtableStubs::find_stub is not appropriately protected by VtableStubs_lock
Reviewed-by: thartmann, pliden
This commit is contained in:
parent
31fbc28af5
commit
b7bd4bccbf
1 changed files with 30 additions and 25 deletions
|
@ -51,6 +51,7 @@ VMReg VtableStub::_receiver_location = VMRegImpl::Bad();
|
||||||
|
|
||||||
|
|
||||||
void* VtableStub::operator new(size_t size, int code_size) throw() {
|
void* VtableStub::operator new(size_t size, int code_size) throw() {
|
||||||
|
assert_lock_strong(VtableStubs_lock);
|
||||||
assert(size == sizeof(VtableStub), "mismatched size");
|
assert(size == sizeof(VtableStub), "mismatched size");
|
||||||
// compute real VtableStub size (rounded to nearest word)
|
// compute real VtableStub size (rounded to nearest word)
|
||||||
const int real_size = align_up(code_size + (int)sizeof(VtableStub), wordSize);
|
const int real_size = align_up(code_size + (int)sizeof(VtableStub), wordSize);
|
||||||
|
@ -208,7 +209,10 @@ void VtableStubs::bookkeeping(MacroAssembler* masm, outputStream* out, VtableStu
|
||||||
address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) {
|
address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) {
|
||||||
assert(vtable_index >= 0, "must be positive");
|
assert(vtable_index >= 0, "must be positive");
|
||||||
|
|
||||||
VtableStub* s = ShareVtableStubs ? lookup(is_vtable_stub, vtable_index) : NULL;
|
VtableStub* s;
|
||||||
|
{
|
||||||
|
MutexLockerEx ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
|
||||||
|
s = ShareVtableStubs ? lookup(is_vtable_stub, vtable_index) : NULL;
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
if (is_vtable_stub) {
|
if (is_vtable_stub) {
|
||||||
s = create_vtable_stub(vtable_index);
|
s = create_vtable_stub(vtable_index);
|
||||||
|
@ -235,6 +239,7 @@ address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) {
|
||||||
s->code_begin(), s->code_end());
|
s->code_begin(), s->code_end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return s->entry_point();
|
return s->entry_point();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +252,7 @@ inline uint VtableStubs::hash(bool is_vtable_stub, int vtable_index){
|
||||||
|
|
||||||
|
|
||||||
VtableStub* VtableStubs::lookup(bool is_vtable_stub, int vtable_index) {
|
VtableStub* VtableStubs::lookup(bool is_vtable_stub, int vtable_index) {
|
||||||
MutexLockerEx ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
|
assert_lock_strong(VtableStubs_lock);
|
||||||
unsigned hash = VtableStubs::hash(is_vtable_stub, vtable_index);
|
unsigned hash = VtableStubs::hash(is_vtable_stub, vtable_index);
|
||||||
VtableStub* s = _table[hash];
|
VtableStub* s = _table[hash];
|
||||||
while( s && !s->matches(is_vtable_stub, vtable_index)) s = s->next();
|
while( s && !s->matches(is_vtable_stub, vtable_index)) s = s->next();
|
||||||
|
@ -256,7 +261,7 @@ VtableStub* VtableStubs::lookup(bool is_vtable_stub, int vtable_index) {
|
||||||
|
|
||||||
|
|
||||||
void VtableStubs::enter(bool is_vtable_stub, int vtable_index, VtableStub* s) {
|
void VtableStubs::enter(bool is_vtable_stub, int vtable_index, VtableStub* s) {
|
||||||
MutexLockerEx ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
|
assert_lock_strong(VtableStubs_lock);
|
||||||
assert(s->matches(is_vtable_stub, vtable_index), "bad vtable stub");
|
assert(s->matches(is_vtable_stub, vtable_index), "bad vtable stub");
|
||||||
unsigned int h = VtableStubs::hash(is_vtable_stub, vtable_index);
|
unsigned int h = VtableStubs::hash(is_vtable_stub, vtable_index);
|
||||||
// enter s at the beginning of the corresponding list
|
// enter s at the beginning of the corresponding list
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue