mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8149038: SIGSEGV at frame::is_interpreted_frame_valid -> StubRoutines::SafeFetchN
Backout change for 8146984 but add an alignment check which may have caught original bug. Reviewed-by: mgronlun, dcubed
This commit is contained in:
parent
88711a6b2d
commit
546bba34d7
1 changed files with 9 additions and 15 deletions
|
@ -55,7 +55,6 @@
|
||||||
#include "runtime/relocator.hpp"
|
#include "runtime/relocator.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
#include "runtime/signature.hpp"
|
#include "runtime/signature.hpp"
|
||||||
#include "runtime/stubRoutines.hpp"
|
|
||||||
#include "utilities/quickSort.hpp"
|
#include "utilities/quickSort.hpp"
|
||||||
#include "utilities/xmlstream.hpp"
|
#include "utilities/xmlstream.hpp"
|
||||||
|
|
||||||
|
@ -2099,29 +2098,24 @@ void Method::clear_jmethod_ids(ClassLoaderData* loader_data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Method::has_method_vptr(const void* ptr) {
|
bool Method::has_method_vptr(const void* ptr) {
|
||||||
// Use SafeFetch to check if this is a valid pointer first
|
|
||||||
// This assumes that the vtbl pointer is the first word of a C++ object.
|
|
||||||
// This assumption is also in universe.cpp patch_klass_vtable
|
|
||||||
intptr_t this_vptr = SafeFetchN((intptr_t*)ptr, intptr_t(1));
|
|
||||||
if (this_vptr == 1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Method m;
|
Method m;
|
||||||
return (intptr_t)dereference_vptr(&m) == this_vptr;
|
// This assumes that the vtbl pointer is the first word of a C++ object.
|
||||||
|
// This assumption is also in universe.cpp patch_klass_vtble
|
||||||
|
return dereference_vptr(&m) == dereference_vptr(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that this pointer is valid by checking that the vtbl pointer matches
|
// Check that this pointer is valid by checking that the vtbl pointer matches
|
||||||
bool Method::is_valid_method() const {
|
bool Method::is_valid_method() const {
|
||||||
if (this == NULL) {
|
if (this == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if ((intptr_t(this) & (wordSize-1)) != 0) {
|
||||||
|
|
||||||
// Quick sanity check on pointer.
|
// Quick sanity check on pointer.
|
||||||
if ((intptr_t(this) & (wordSize-1)) != 0) {
|
|
||||||
return false;
|
return false;
|
||||||
|
} else if (!is_metaspace_object()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return has_method_vptr((const void*)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return has_method_vptr(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue