mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8207779: Method::is_valid_method() compares 'this' with NULL
Add Method* parameter and make method static to avoid 'thi's comparison with NULL Reviewed-by: lfoltan, coleenp
This commit is contained in:
parent
d86f3a8cb2
commit
c277f9ed8e
9 changed files with 22 additions and 22 deletions
|
@ -1095,7 +1095,7 @@ address Method::make_adapters(const methodHandle& mh, TRAPS) {
|
|||
}
|
||||
|
||||
void Method::restore_unshareable_info(TRAPS) {
|
||||
assert(is_method() && is_valid_method(), "ensure C++ vtable is restored");
|
||||
assert(is_method() && is_valid_method(this), "ensure C++ vtable is restored");
|
||||
|
||||
// Since restore_unshareable_info can be called more than once for a method, don't
|
||||
// redo any work.
|
||||
|
@ -2166,16 +2166,16 @@ bool Method::has_method_vptr(const void* ptr) {
|
|||
}
|
||||
|
||||
// Check that this pointer is valid by checking that the vtbl pointer matches
|
||||
bool Method::is_valid_method() const {
|
||||
if (this == NULL) {
|
||||
bool Method::is_valid_method(const Method* m) {
|
||||
if (m == NULL) {
|
||||
return false;
|
||||
} else if ((intptr_t(this) & (wordSize-1)) != 0) {
|
||||
} else if ((intptr_t(m) & (wordSize-1)) != 0) {
|
||||
// Quick sanity check on pointer.
|
||||
return false;
|
||||
} else if (is_shared()) {
|
||||
return MetaspaceShared::is_valid_shared_method(this);
|
||||
} else if (Metaspace::contains_non_shared(this)) {
|
||||
return has_method_vptr((const void*)this);
|
||||
} else if (m->is_shared()) {
|
||||
return MetaspaceShared::is_valid_shared_method(m);
|
||||
} else if (Metaspace::contains_non_shared(m)) {
|
||||
return has_method_vptr((const void*)m);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue