--- a/src/hotspot/share/gc/z/zRelocate.cpp Thu Sep 20 14:04:43 2018 +0200
+++ b/src/hotspot/share/gc/z/zRelocate.cpp Thu Sep 20 14:04:44 2018 +0200
@@ -22,6 +22,8 @@
*/
#include "precompiled.hpp"
+#include "gc/z/zAddress.inline.hpp"
+#include "gc/z/zBarrier.inline.hpp"
#include "gc/z/zHeap.hpp"
#include "gc/z/zOopClosures.inline.hpp"
#include "gc/z/zPage.hpp"
@@ -35,12 +37,22 @@
_workers(workers) {}
class ZRelocateRootsIteratorClosure : public ZRootsIteratorClosure {
+private:
+ static void remap_address(HeapWord** p) {
+ *p = (HeapWord*)ZAddress::good_or_null((uintptr_t)*p);
+ }
+
public:
virtual void do_thread(Thread* thread) {
ZRootsIteratorClosure::do_thread(thread);
// Update thread local address bad mask
ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
+
+ // Remap TLAB
+ if (UseTLAB && thread->is_Java_thread()) {
+ thread->tlab().addresses_do(remap_address);
+ }
}
virtual void do_oop(oop* p) {
@@ -54,7 +66,8 @@
class ZRelocateRootsTask : public ZTask {
private:
- ZRootsIterator _roots;
+ ZRootsIterator _roots;
+ ZRelocateRootsIteratorClosure _cl;
public:
ZRelocateRootsTask() :
@@ -64,8 +77,7 @@
virtual void work() {
// During relocation we need to visit the JVMTI
// export weak roots to rehash the JVMTI tag map
- ZRelocateRootsIteratorClosure cl;
- _roots.oops_do(&cl, true /* visit_jvmti_weak_export */);
+ _roots.oops_do(&_cl, true /* visit_jvmti_weak_export */);
}
};