hotspot/src/share/vm/gc/g1/g1CodeBlobClosure.cpp
author kbarrett
Tue, 30 Aug 2016 23:48:16 -0400
changeset 40892 330a02d935ad
parent 33786 ac8da6513351
child 46282 a001553763bc
permissions -rw-r--r--
8156500: Move Reference pending list into VM to prevent deadlocks Summary: Move reference pending list and locking into VM Reviewed-by: coleenp, dholmes, dcubed, mchung, plevart Contributed-by: kim.barrett@oracle.com, per.liden@oracle.com
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
/*
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
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
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    25
#include "precompiled.hpp"
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    26
#include "code/nmethod.hpp"
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    27
#include "gc/g1/g1CodeBlobClosure.hpp"
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    28
#include "gc/g1/g1CollectedHeap.inline.hpp"
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    29
#include "gc/g1/heapRegion.hpp"
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    30
#include "gc/g1/heapRegionRemSet.hpp"
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    31
#include "oops/oop.inline.hpp"
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    32
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    33
template <typename T>
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    34
void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop_work(T* p) {
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    35
  _work->do_oop(p);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    36
  T oop_or_narrowoop = oopDesc::load_heap_oop(p);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    37
  if (!oopDesc::is_null(oop_or_narrowoop)) {
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    38
    oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);
33786
ac8da6513351 8139867: Change how startsHumongous and continuesHumongous regions work in G1.
david
parents: 32617
diff changeset
    39
    HeapRegion* hr = _g1h->heap_region_containing(o);
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    40
    assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in collection set then evacuation failed and nm must already be in the remset");
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    41
    hr->add_strong_code_root(_nm);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    42
  }
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
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    45
void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(oop* o) {
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    46
  do_oop_work(o);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    47
}
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    48
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    49
void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(narrowOop* o) {
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    50
  do_oop_work(o);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    51
}
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
void G1CodeBlobClosure::do_code_blob(CodeBlob* cb) {
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    54
  nmethod* nm = cb->as_nmethod_or_null();
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    55
  if (nm != NULL) {
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    56
    if (!nm->test_set_oops_do_mark()) {
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    57
      _oc.set_nm(nm);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    58
      nm->oops_do(&_oc);
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    59
      nm->fix_oop_relocations();
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    60
    }
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    61
  }
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    62
}
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
diff changeset
    63