8173151: Code heap corruption due to incorrect inclusion test

Change inclusion test to use CodeBlob::code_begin() for AOT methods and start of CodeBlob otherwise. Added regression test.

Reviewed-by: thartmann, dlong, kvn
This commit is contained in:
Zoltan Majo 2017-02-10 08:16:49 +01:00
parent 7b93ee904b
commit ecee7fc84b
7 changed files with 113 additions and 6 deletions

View file

@ -417,7 +417,7 @@ void CodeCache::add_heap(ReservedSpace rs, const char* name, int code_blob_type)
CodeHeap* CodeCache::get_code_heap(const CodeBlob* cb) {
assert(cb != NULL, "CodeBlob is null");
FOR_ALL_HEAPS(heap) {
if ((*heap)->contains(cb->code_begin())) {
if ((*heap)->contains_blob(cb)) {
return *heap;
}
}