src/hotspot/share/gc/g1/g1CodeBlobClosure.hpp
author tschatzl
Fri, 29 Nov 2019 10:20:17 +0100
changeset 59321 5775e4825e58
parent 58777 18c246ad2ff9
permissions -rw-r--r--
8233998: New young regions registered too early in collection set Reviewed-by: sangheki, sjohanss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
     2
 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
     4
 *
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
     8
 *
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    13
 * accompanied this code).
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    14
 *
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    18
 *
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    21
 * questions.
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    22
 *
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    23
 */
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    25
#ifndef SHARE_GC_G1_G1CODEBLOBCLOSURE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    26
#define SHARE_GC_G1_G1CODEBLOBCLOSURE_HPP
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
    27
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    28
#include "gc/g1/g1CollectedHeap.hpp"
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    29
#include "memory/iterator.hpp"
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    30
58777
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    31
class G1ConcurrentMark;
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    32
class nmethod;
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    33
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    34
class G1CodeBlobClosure : public CodeBlobClosure {
58777
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    35
  // Gather nmethod remembered set entries.
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    36
  class HeapRegionGatheringOopClosure : public OopClosure {
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    37
    G1CollectedHeap* _g1h;
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    38
    OopClosure* _work;
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    39
    nmethod* _nm;
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    40
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    41
    template <typename T>
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    42
    void do_oop_work(T* p);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    43
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    44
  public:
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    45
    HeapRegionGatheringOopClosure(OopClosure* oc) : _g1h(G1CollectedHeap::heap()), _work(oc), _nm(NULL) {}
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    46
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    47
    void do_oop(oop* o);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    48
    void do_oop(narrowOop* o);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    49
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    50
    void set_nm(nmethod* nm) {
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    51
      _nm = nm;
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    52
    }
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    53
  };
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    54
58777
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    55
  // Mark all oops below TAMS.
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    56
  class MarkingOopClosure : public OopClosure {
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    57
    G1ConcurrentMark* _cm;
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    58
    uint _worker_id;
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    59
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    60
    template <typename T>
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    61
    void do_oop_work(T* p);
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    62
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    63
  public:
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    64
    MarkingOopClosure(uint worker_id);
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    65
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    66
    void do_oop(oop* o);
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    67
    void do_oop(narrowOop* o);
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    68
  };
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    69
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    70
  HeapRegionGatheringOopClosure _oc;
58777
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    71
  MarkingOopClosure _marking_oc;
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    72
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    73
  bool _strong;
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    74
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    75
  void do_code_blob_weak(CodeBlob* cb);
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    76
  void do_code_blob_strong(CodeBlob* cb);
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    77
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    78
public:
58777
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    79
  G1CodeBlobClosure(uint worker_id, OopClosure* oc, bool strong) :
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    80
    _oc(oc), _marking_oc(worker_id), _strong(strong) { }
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    81
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    82
  void do_evacuation_and_fixup(nmethod* nm);
18c246ad2ff9 8230706: Waiting on completion of strong nmethod processing causes long pause times with G1
tschatzl
parents: 53244
diff changeset
    83
  void do_marking(nmethod* nm);
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    84
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    85
  void do_code_blob(CodeBlob* cb);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    86
};
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 32617
diff changeset
    87
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    88
#endif // SHARE_GC_G1_G1CODEBLOBCLOSURE_HPP