src/hotspot/share/gc/g1/g1BarrierSetRuntime.cpp
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 50375 bfbe7d8369bb
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50375
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
     1
/*
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
     4
 *
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
     8
 *
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    13
 * accompanied this code).
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    14
 *
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    18
 *
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    21
 * questions.
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    22
 *
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    23
 */
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    24
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    25
#include "precompiled.hpp"
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    26
#include "gc/g1/g1BarrierSet.inline.hpp"
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    27
#include "gc/g1/g1BarrierSetRuntime.hpp"
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    28
#include "gc/g1/g1ThreadLocalData.hpp"
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    29
#include "runtime/interfaceSupport.inline.hpp"
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    30
#include "utilities/macros.hpp"
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    31
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    32
void G1BarrierSetRuntime::write_ref_array_pre_oop_entry(oop* dst, size_t length) {
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    33
  G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    34
  bs->write_ref_array_pre(dst, length, false);
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    35
}
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    36
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    37
void G1BarrierSetRuntime::write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length) {
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    38
  G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    39
  bs->write_ref_array_pre(dst, length, false);
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    40
}
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    41
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    42
void G1BarrierSetRuntime::write_ref_array_post_entry(HeapWord* dst, size_t length) {
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    43
  G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    44
  bs->G1BarrierSet::write_ref_array(dst, length);
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    45
}
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    46
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    47
// G1 pre write barrier slowpath
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    48
JRT_LEAF(void, G1BarrierSetRuntime::write_ref_field_pre_entry(oopDesc* orig, JavaThread *thread))
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    49
  if (orig == NULL) {
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    50
    assert(false, "should be optimized out");
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    51
    return;
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    52
  }
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    53
  assert(oopDesc::is_oop(orig, true /* ignore mark word */), "Error");
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    54
  // store the original value that was in the field reference
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    55
  G1ThreadLocalData::satb_mark_queue(thread).enqueue(orig);
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    56
JRT_END
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    57
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    58
// G1 post write barrier slowpath
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    59
JRT_LEAF(void, G1BarrierSetRuntime::write_ref_field_post_entry(void* card_addr, JavaThread* thread))
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    60
  G1ThreadLocalData::dirty_card_queue(thread).enqueue(card_addr);
bfbe7d8369bb 8202547: Move G1 runtime calls used by generated code to G1BarrierSetRuntime
eosterlund
parents:
diff changeset
    61
JRT_END