equal
deleted
inserted
replaced
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 #include "precompiled.hpp" |
24 #include "precompiled.hpp" |
|
25 #include "gc/z/zAddress.inline.hpp" |
|
26 #include "gc/z/zBarrier.inline.hpp" |
25 #include "gc/z/zHeap.hpp" |
27 #include "gc/z/zHeap.hpp" |
26 #include "gc/z/zOopClosures.inline.hpp" |
28 #include "gc/z/zOopClosures.inline.hpp" |
27 #include "gc/z/zPage.hpp" |
29 #include "gc/z/zPage.hpp" |
28 #include "gc/z/zRelocate.hpp" |
30 #include "gc/z/zRelocate.hpp" |
29 #include "gc/z/zRelocationSet.inline.hpp" |
31 #include "gc/z/zRelocationSet.inline.hpp" |
33 |
35 |
34 ZRelocate::ZRelocate(ZWorkers* workers) : |
36 ZRelocate::ZRelocate(ZWorkers* workers) : |
35 _workers(workers) {} |
37 _workers(workers) {} |
36 |
38 |
37 class ZRelocateRootsIteratorClosure : public ZRootsIteratorClosure { |
39 class ZRelocateRootsIteratorClosure : public ZRootsIteratorClosure { |
|
40 private: |
|
41 static void remap_address(HeapWord** p) { |
|
42 *p = (HeapWord*)ZAddress::good_or_null((uintptr_t)*p); |
|
43 } |
|
44 |
38 public: |
45 public: |
39 virtual void do_thread(Thread* thread) { |
46 virtual void do_thread(Thread* thread) { |
40 ZRootsIteratorClosure::do_thread(thread); |
47 ZRootsIteratorClosure::do_thread(thread); |
41 |
48 |
42 // Update thread local address bad mask |
49 // Update thread local address bad mask |
43 ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask); |
50 ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask); |
|
51 |
|
52 // Remap TLAB |
|
53 if (UseTLAB && thread->is_Java_thread()) { |
|
54 thread->tlab().addresses_do(remap_address); |
|
55 } |
44 } |
56 } |
45 |
57 |
46 virtual void do_oop(oop* p) { |
58 virtual void do_oop(oop* p) { |
47 ZBarrier::relocate_barrier_on_root_oop_field(p); |
59 ZBarrier::relocate_barrier_on_root_oop_field(p); |
48 } |
60 } |
52 } |
64 } |
53 }; |
65 }; |
54 |
66 |
55 class ZRelocateRootsTask : public ZTask { |
67 class ZRelocateRootsTask : public ZTask { |
56 private: |
68 private: |
57 ZRootsIterator _roots; |
69 ZRootsIterator _roots; |
|
70 ZRelocateRootsIteratorClosure _cl; |
58 |
71 |
59 public: |
72 public: |
60 ZRelocateRootsTask() : |
73 ZRelocateRootsTask() : |
61 ZTask("ZRelocateRootsTask"), |
74 ZTask("ZRelocateRootsTask"), |
62 _roots() {} |
75 _roots() {} |
63 |
76 |
64 virtual void work() { |
77 virtual void work() { |
65 // During relocation we need to visit the JVMTI |
78 // During relocation we need to visit the JVMTI |
66 // export weak roots to rehash the JVMTI tag map |
79 // export weak roots to rehash the JVMTI tag map |
67 ZRelocateRootsIteratorClosure cl; |
80 _roots.oops_do(&_cl, true /* visit_jvmti_weak_export */); |
68 _roots.oops_do(&cl, true /* visit_jvmti_weak_export */); |
|
69 } |
81 } |
70 }; |
82 }; |
71 |
83 |
72 void ZRelocate::start() { |
84 void ZRelocate::start() { |
73 ZRelocateRootsTask task; |
85 ZRelocateRootsTask task; |