< prev index next >
src/share/vm/gc_implementation/shenandoah/shenandoahCodeRoots.cpp
Print this page
rev 10682 : [backport] Code root iterators should not be instantiated in worker threads
rev 10683 : [backport] Record location when asserting the code root correctness
rev 10714 : [backport] Rehash and cleanup usages of ShenandoahHeap::heap()
rev 10715 : [backport] Cleanup up superfluous newlines
rev 10740 : [backport] Protect more internal code from false sharing
rev 10761 : [backport] Make ResourceMark use consistent in ShenandoahCodeRoots
rev 10772 : [backport] Update copyrights
*** 1,7 ****
/*
! * Copyright (c) 2017, 2018, Red Hat, Inc. and/or its affiliates.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
--- 1,7 ----
/*
! * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
*** 19,39 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
-
#include "precompiled.hpp"
#include "code/codeCache.hpp"
#include "code/nmethod.hpp"
#include "gc_implementation/shenandoah/shenandoahHeap.hpp"
#include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp"
#include "gc_implementation/shenandoah/shenandoahCodeRoots.hpp"
ShenandoahParallelCodeCacheIterator::ShenandoahParallelCodeCacheIterator() :
_claimed_idx(0), _finished(false) {
! };
void ShenandoahParallelCodeCacheIterator::parallel_blobs_do(CodeBlobClosure* f) {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
/*
--- 19,39 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "code/codeCache.hpp"
#include "code/nmethod.hpp"
#include "gc_implementation/shenandoah/shenandoahHeap.hpp"
#include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp"
#include "gc_implementation/shenandoah/shenandoahCodeRoots.hpp"
+ #include "memory/resourceArea.hpp"
ShenandoahParallelCodeCacheIterator::ShenandoahParallelCodeCacheIterator() :
_claimed_idx(0), _finished(false) {
! }
void ShenandoahParallelCodeCacheIterator::parallel_blobs_do(CodeBlobClosure* f) {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
/*
*** 78,92 ****
_finished = true;
}
class ShenandoahNMethodOopDetector : public OopClosure {
private:
! ShenandoahHeap* _heap;
GrowableArray<oop*> _oops;
public:
! ShenandoahNMethodOopDetector() : _heap(ShenandoahHeap::heap()), _oops(10) {};
void do_oop(oop* o) {
_oops.append(o);
}
--- 78,92 ----
_finished = true;
}
class ShenandoahNMethodOopDetector : public OopClosure {
private:
! ResourceMark rm; // For growable array allocation below.
GrowableArray<oop*> _oops;
public:
! ShenandoahNMethodOopDetector() : _oops(10) {};
void do_oop(oop* o) {
_oops.append(o);
}
*** 128,142 ****
void do_oop(narrowOop* o) {
do_oop_work(o);
}
};
! volatile jint ShenandoahCodeRoots::_recorded_nms_lock;
GrowableArray<ShenandoahNMethod*>* ShenandoahCodeRoots::_recorded_nms;
void ShenandoahCodeRoots::initialize() {
! _recorded_nms_lock = 0;
_recorded_nms = new (ResourceObj::C_HEAP, mtGC) GrowableArray<ShenandoahNMethod*>(100, true, mtGC);
}
void ShenandoahCodeRoots::add_nmethod(nmethod* nm) {
switch (ShenandoahCodeRootsStyle) {
--- 128,142 ----
void do_oop(narrowOop* o) {
do_oop_work(o);
}
};
! ShenandoahCodeRoots::PaddedLock ShenandoahCodeRoots::_recorded_nms_lock;
GrowableArray<ShenandoahNMethod*>* ShenandoahCodeRoots::_recorded_nms;
void ShenandoahCodeRoots::initialize() {
! _recorded_nms_lock._lock = 0;
_recorded_nms = new (ResourceObj::C_HEAP, mtGC) GrowableArray<ShenandoahNMethod*>(100, true, mtGC);
}
void ShenandoahCodeRoots::add_nmethod(nmethod* nm) {
switch (ShenandoahCodeRootsStyle) {
*** 206,215 ****
--- 206,216 ----
ShenandoahCodeRootsIterator::ShenandoahCodeRootsIterator() :
_heap(ShenandoahHeap::heap()),
_claimed(0) {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
+ assert(!Thread::current()->is_Worker_thread(), "Should not be acquired by workers");
switch (ShenandoahCodeRootsStyle) {
case 0:
case 1:
break;
case 2:
*** 331,343 ****
void ShenandoahNMethod::assert_alive_and_correct() {
assert(_nm->is_alive(), "only alive nmethods here");
assert(_oops_count > 0, "should have filtered nmethods without oops before");
ShenandoahHeap* heap = ShenandoahHeap::heap();
for (int c = 0; c < _oops_count; c++) {
! oop o = oopDesc::load_heap_oop(_oops[c]);
! shenandoah_assert_correct_except(NULL, o, o == NULL || heap->is_full_gc_move_in_progress());
! assert(_nm->code_contains((address)_oops[c]) || _nm->oops_contains(_oops[c]), "nmethod should contain the oop*");
}
}
void ShenandoahNMethod::assert_same_oops(GrowableArray<oop*>* oops) {
assert(_oops_count == oops->length(), "should have the same number of oop*");
--- 332,345 ----
void ShenandoahNMethod::assert_alive_and_correct() {
assert(_nm->is_alive(), "only alive nmethods here");
assert(_oops_count > 0, "should have filtered nmethods without oops before");
ShenandoahHeap* heap = ShenandoahHeap::heap();
for (int c = 0; c < _oops_count; c++) {
! oop *loc = _oops[c];
! assert(_nm->code_contains((address)loc) || _nm->oops_contains(loc), "nmethod should contain the oop*");
! oop o = oopDesc::load_heap_oop(loc);
! shenandoah_assert_correct_except(loc, o, o == NULL || heap->is_full_gc_move_in_progress());
}
}
void ShenandoahNMethod::assert_same_oops(GrowableArray<oop*>* oops) {
assert(_oops_count == oops->length(), "should have the same number of oop*");
< prev index next >