src/hotspot/share/gc/z/zRelocate.cpp
changeset 51803 a16777c0a6c5
parent 50525 767cdb97f103
child 51818 75e4ce0fa1ba
equal deleted inserted replaced
51802:15094d12a632 51803:a16777c0a6c5
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    32 #include "gc/z/zWorkers.hpp"
    32 #include "gc/z/zWorkers.hpp"
    33 
    33 
    34 ZRelocate::ZRelocate(ZWorkers* workers) :
    34 ZRelocate::ZRelocate(ZWorkers* workers) :
    35     _workers(workers) {}
    35     _workers(workers) {}
    36 
    36 
       
    37 class ZRelocateRootsIteratorClosure : public ZRootsIteratorClosure {
       
    38 public:
       
    39   virtual void do_thread(Thread* thread) {
       
    40     ZRootsIteratorClosure::do_thread(thread);
       
    41 
       
    42     // Update thread local address bad mask
       
    43     ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
       
    44   }
       
    45 
       
    46   virtual void do_oop(oop* p) {
       
    47     ZBarrier::relocate_barrier_on_root_oop_field(p);
       
    48   }
       
    49 
       
    50   virtual void do_oop(narrowOop* p) {
       
    51     ShouldNotReachHere();
       
    52   }
       
    53 };
       
    54 
    37 class ZRelocateRootsTask : public ZTask {
    55 class ZRelocateRootsTask : public ZTask {
    38 private:
    56 private:
    39   ZRootsIterator _roots;
    57   ZRootsIterator _roots;
    40 
    58 
    41 public:
    59 public:
    44       _roots() {}
    62       _roots() {}
    45 
    63 
    46   virtual void work() {
    64   virtual void work() {
    47     // During relocation we need to visit the JVMTI
    65     // During relocation we need to visit the JVMTI
    48     // export weak roots to rehash the JVMTI tag map
    66     // export weak roots to rehash the JVMTI tag map
    49     ZRelocateRootOopClosure cl;
    67     ZRelocateRootsIteratorClosure cl;
    50     _roots.oops_do(&cl, true /* visit_jvmti_weak_export */);
    68     _roots.oops_do(&cl, true /* visit_jvmti_weak_export */);
    51   }
    69   }
    52 };
    70 };
    53 
    71 
    54 void ZRelocate::start() {
    72 void ZRelocate::start() {