src/hotspot/cpu/aarch64/gc/g1/g1BarrierSetAssembler_aarch64.cpp
author rkennke
Sun, 06 May 2018 00:42:59 +0200
changeset 50024 7238cb613dc5
parent 49906 4bb58f644e4e
child 50110 3d98842c8677
permissions -rw-r--r--
8202676: AArch64: Missing enter/leave around barrier leads to infinite loop Reviewed-by: aph, eosterlund
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49484
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
     1
/*
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
     4
 *
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
     8
 *
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    13
 * accompanied this code).
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    14
 *
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    18
 *
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    21
 * questions.
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    22
 *
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    23
 */
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    24
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    25
#include "precompiled.hpp"
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    26
#include "asm/macroAssembler.inline.hpp"
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
    27
#include "c1/c1_LIRAssembler.hpp"
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
    28
#include "c1/c1_MacroAssembler.hpp"
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
    29
#include "gc/g1/c1/g1BarrierSetC1.hpp"
49484
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    30
#include "gc/g1/g1BarrierSet.hpp"
49754
ee93c1087584 8201362: Remove CollectedHeap::barrier_set()
pliden
parents: 49753
diff changeset
    31
#include "gc/g1/g1BarrierSetAssembler.hpp"
49484
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    32
#include "gc/g1/g1CardTable.hpp"
49752
93d84f667d12 8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents: 49748
diff changeset
    33
#include "gc/g1/g1ThreadLocalData.hpp"
49484
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    34
#include "gc/g1/heapRegion.hpp"
49816
a3e79f97e86b 8200555: OopHandle should use Access API
coleenp
parents: 49754
diff changeset
    35
#include "gc/shared/collectedHeap.hpp"
a3e79f97e86b 8200555: OopHandle should use Access API
coleenp
parents: 49754
diff changeset
    36
#include "runtime/sharedRuntime.hpp"
a3e79f97e86b 8200555: OopHandle should use Access API
coleenp
parents: 49754
diff changeset
    37
#include "runtime/thread.hpp"
49484
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    38
#include "interpreter/interp_masm.hpp"
49753
46f2dc7c4c39 8201475: 8199417 breaks AIX and non-pch on s390 (and presumably aarch64)
stuefe
parents: 49752
diff changeset
    39
#include "runtime/sharedRuntime.hpp"
49484
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    40
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    41
#define __ masm->
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    42
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    43
void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    44
                                                            Register addr, Register count, RegSet saved_regs) {
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    45
  bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    46
  if (!dest_uninitialized) {
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    47
    __ push(saved_regs, sp);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    48
    if (count == c_rarg0) {
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    49
      if (addr == c_rarg1) {
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    50
        // exactly backwards!!
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    51
        __ mov(rscratch1, c_rarg0);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    52
        __ mov(c_rarg0, c_rarg1);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    53
        __ mov(c_rarg1, rscratch1);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    54
      } else {
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    55
        __ mov(c_rarg1, count);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    56
        __ mov(c_rarg0, addr);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    57
      }
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    58
    } else {
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    59
      __ mov(c_rarg0, addr);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    60
      __ mov(c_rarg1, count);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    61
    }
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    62
    if (UseCompressedOops) {
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    63
      __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry), 2);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    64
    } else {
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    65
      __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry), 2);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    66
    }
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    67
    __ pop(saved_regs, sp);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    68
  }
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    69
}
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    70
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    71
void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    72
                                                             Register start, Register end, Register scratch, RegSet saved_regs) {
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    73
  __ push(saved_regs, sp);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    74
  // must compute element count unless barrier set interface is changed (other platforms supply count)
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    75
  assert_different_registers(start, end, scratch);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    76
  __ lea(scratch, Address(end, BytesPerHeapOop));
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    77
  __ sub(scratch, scratch, start);               // subtract start to get #bytes
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    78
  __ lsr(scratch, scratch, LogBytesPerHeapOop);  // convert to element count
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    79
  __ mov(c_rarg0, start);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    80
  __ mov(c_rarg1, scratch);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    81
  __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry), 2);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    82
  __ pop(saved_regs, sp);
ee8fa73b90f9 8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff changeset
    83
}
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    84
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    85
void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    86
                                                 Register obj,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    87
                                                 Register pre_val,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    88
                                                 Register thread,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    89
                                                 Register tmp,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    90
                                                 bool tosca_live,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    91
                                                 bool expand_call) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    92
  // If expand_call is true then we expand the call_VM_leaf macro
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    93
  // directly to skip generating the check by
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    94
  // InterpreterMacroAssembler::call_VM_leaf_base that checks _last_sp.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    95
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    96
  assert(thread == rthread, "must be");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    97
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    98
  Label done;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
    99
  Label runtime;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   100
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   101
  assert_different_registers(obj, pre_val, tmp, rscratch1);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   102
  assert(pre_val != noreg &&  tmp != noreg, "expecting a register");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   103
49752
93d84f667d12 8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents: 49748
diff changeset
   104
  Address in_progress(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()));
93d84f667d12 8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents: 49748
diff changeset
   105
  Address index(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_index_offset()));
93d84f667d12 8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents: 49748
diff changeset
   106
  Address buffer(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset()));
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   107
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   108
  // Is marking active?
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   109
  if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   110
    __ ldrw(tmp, in_progress);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   111
  } else {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   112
    assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   113
    __ ldrb(tmp, in_progress);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   114
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   115
  __ cbzw(tmp, done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   116
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   117
  // Do we need to load the previous value?
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   118
  if (obj != noreg) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   119
    __ load_heap_oop(pre_val, Address(obj, 0));
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   120
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   121
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   122
  // Is the previous value null?
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   123
  __ cbz(pre_val, done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   124
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   125
  // Can we store original value in the thread's buffer?
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   126
  // Is index == 0?
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   127
  // (The index field is typed as size_t.)
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   128
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   129
  __ ldr(tmp, index);                      // tmp := *index_adr
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   130
  __ cbz(tmp, runtime);                    // tmp == 0?
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   131
                                        // If yes, goto runtime
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   132
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   133
  __ sub(tmp, tmp, wordSize);              // tmp := tmp - wordSize
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   134
  __ str(tmp, index);                      // *index_adr := tmp
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   135
  __ ldr(rscratch1, buffer);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   136
  __ add(tmp, tmp, rscratch1);             // tmp := tmp + *buffer_adr
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   137
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   138
  // Record the previous value
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   139
  __ str(pre_val, Address(tmp, 0));
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   140
  __ b(done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   141
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   142
  __ bind(runtime);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   143
  // save the live input values
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   144
  RegSet saved = RegSet::of(pre_val);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   145
  if (tosca_live) saved += RegSet::of(r0);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   146
  if (obj != noreg) saved += RegSet::of(obj);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   147
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   148
  __ push(saved, sp);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   149
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   150
  // Calling the runtime using the regular call_VM_leaf mechanism generates
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   151
  // code (generated by InterpreterMacroAssember::call_VM_leaf_base)
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   152
  // that checks that the *(rfp+frame::interpreter_frame_last_sp) == NULL.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   153
  //
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   154
  // If we care generating the pre-barrier without a frame (e.g. in the
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   155
  // intrinsified Reference.get() routine) then ebp might be pointing to
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   156
  // the caller frame and so this check will most likely fail at runtime.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   157
  //
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   158
  // Expanding the call directly bypasses the generation of the check.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   159
  // So when we do not have have a full interpreter frame on the stack
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   160
  // expand_call should be passed true.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   161
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   162
  if (expand_call) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   163
    assert(pre_val != c_rarg1, "smashed arg");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   164
    __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   165
  } else {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   166
    __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   167
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   168
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   169
  __ pop(saved, sp);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   170
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   171
  __ bind(done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   172
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   173
}
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   174
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   175
void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   176
                                                  Register store_addr,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   177
                                                  Register new_val,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   178
                                                  Register thread,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   179
                                                  Register tmp,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   180
                                                  Register tmp2) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   181
  assert(thread == rthread, "must be");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   182
  assert_different_registers(store_addr, new_val, thread, tmp, tmp2,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   183
                             rscratch1);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   184
  assert(store_addr != noreg && new_val != noreg && tmp != noreg
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   185
         && tmp2 != noreg, "expecting a register");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   186
49752
93d84f667d12 8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents: 49748
diff changeset
   187
  Address queue_index(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset()));
93d84f667d12 8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents: 49748
diff changeset
   188
  Address buffer(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset()));
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   189
49754
ee93c1087584 8201362: Remove CollectedHeap::barrier_set()
pliden
parents: 49753
diff changeset
   190
  BarrierSet* bs = BarrierSet::barrier_set();
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   191
  CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   192
  CardTable* ct = ctbs->card_table();
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   193
  assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   194
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   195
  Label done;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   196
  Label runtime;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   197
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   198
  // Does store cross heap regions?
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   199
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   200
  __ eor(tmp, store_addr, new_val);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   201
  __ lsr(tmp, tmp, HeapRegion::LogOfHRGrainBytes);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   202
  __ cbz(tmp, done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   203
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   204
  // crosses regions, storing NULL?
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   205
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   206
  __ cbz(new_val, done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   207
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   208
  // storing region crossing non-NULL, is card already dirty?
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   209
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   210
  ExternalAddress cardtable((address) ct->byte_map_base());
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   211
  assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   212
  const Register card_addr = tmp;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   213
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   214
  __ lsr(card_addr, store_addr, CardTable::card_shift);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   215
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   216
  // get the address of the card
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   217
  __ load_byte_map_base(tmp2);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   218
  __ add(card_addr, card_addr, tmp2);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   219
  __ ldrb(tmp2, Address(card_addr));
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   220
  __ cmpw(tmp2, (int)G1CardTable::g1_young_card_val());
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   221
  __ br(Assembler::EQ, done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   222
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   223
  assert((int)CardTable::dirty_card_val() == 0, "must be 0");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   224
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   225
  __ membar(Assembler::StoreLoad);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   226
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   227
  __ ldrb(tmp2, Address(card_addr));
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   228
  __ cbzw(tmp2, done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   229
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   230
  // storing a region crossing, non-NULL oop, card is clean.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   231
  // dirty card and log.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   232
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   233
  __ strb(zr, Address(card_addr));
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   234
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   235
  __ ldr(rscratch1, queue_index);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   236
  __ cbz(rscratch1, runtime);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   237
  __ sub(rscratch1, rscratch1, wordSize);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   238
  __ str(rscratch1, queue_index);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   239
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   240
  __ ldr(tmp2, buffer);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   241
  __ str(card_addr, Address(tmp2, rscratch1));
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   242
  __ b(done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   243
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   244
  __ bind(runtime);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   245
  // save the live input values
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   246
  RegSet saved = RegSet::of(store_addr, new_val);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   247
  __ push(saved, sp);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   248
  __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   249
  __ pop(saved, sp);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   250
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   251
  __ bind(done);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   252
}
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   253
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   254
void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   255
                                    Register dst, Address src, Register tmp1, Register tmp_thread) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   256
  bool on_oop = type == T_OBJECT || type == T_ARRAY;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   257
  bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   258
  bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   259
  bool on_reference = on_weak || on_phantom;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   260
  ModRefBarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   261
  if (on_oop && on_reference) {
50024
7238cb613dc5 8202676: AArch64: Missing enter/leave around barrier leads to infinite loop
rkennke
parents: 49906
diff changeset
   262
    // LR is live.  It must be saved around calls.
7238cb613dc5 8202676: AArch64: Missing enter/leave around barrier leads to infinite loop
rkennke
parents: 49906
diff changeset
   263
    __ enter(); // barrier may call runtime
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   264
    // Generate the G1 pre-barrier code to log the value of
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   265
    // the referent field in an SATB buffer.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   266
    g1_write_barrier_pre(masm /* masm */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   267
                         noreg /* obj */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   268
                         dst /* pre_val */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   269
                         rthread /* thread */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   270
                         tmp1 /* tmp */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   271
                         true /* tosca_live */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   272
                         true /* expand_call */);
50024
7238cb613dc5 8202676: AArch64: Missing enter/leave around barrier leads to infinite loop
rkennke
parents: 49906
diff changeset
   273
    __ leave();
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   274
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   275
}
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   276
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   277
void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   278
                                         Address dst, Register val, Register tmp1, Register tmp2) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   279
  // flatten object address if needed
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   280
  if (dst.index() == noreg && dst.offset() == 0) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   281
    if (dst.base() != r3) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   282
      __ mov(r3, dst.base());
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   283
    }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   284
  } else {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   285
    __ lea(r3, dst);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   286
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   287
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   288
  g1_write_barrier_pre(masm,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   289
                       r3 /* obj */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   290
                       tmp2 /* pre_val */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   291
                       rthread /* thread */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   292
                       tmp1  /* tmp */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   293
                       val != noreg /* tosca_live */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   294
                       false /* expand_call */);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   295
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   296
  if (val == noreg) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   297
    __ store_heap_oop_null(Address(r3, 0));
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   298
  } else {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   299
    // G1 barrier needs uncompressed oop for region cross check.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   300
    Register new_val = val;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   301
    if (UseCompressedOops) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   302
      new_val = rscratch2;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   303
      __ mov(new_val, val);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   304
    }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   305
    __ store_heap_oop(Address(r3, 0), val);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   306
    g1_write_barrier_post(masm,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   307
                          r3 /* store_adr */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   308
                          new_val /* new_val */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   309
                          rthread /* thread */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   310
                          tmp1 /* tmp */,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   311
                          tmp2 /* tmp2 */);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   312
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   313
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   314
}
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   315
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   316
#ifdef COMPILER1
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   317
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents: 49484
diff changeset
   318
#undef __
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   319
#define __ ce->masm()->
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   320
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   321
void G1BarrierSetAssembler::gen_pre_barrier_stub(LIR_Assembler* ce, G1PreBarrierStub* stub) {
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   322
  G1BarrierSetC1* bs = (G1BarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   323
  // At this point we know that marking is in progress.
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   324
  // If do_load() is true then we have to emit the
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   325
  // load of the previous value; otherwise it has already
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   326
  // been loaded into _pre_val.
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   327
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   328
  __ bind(*stub->entry());
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   329
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   330
  assert(stub->pre_val()->is_register(), "Precondition.");
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   331
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   332
  Register pre_val_reg = stub->pre_val()->as_register();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   333
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   334
  if (stub->do_load()) {
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   335
    ce->mem2reg(stub->addr(), stub->pre_val(), T_OBJECT, stub->patch_code(), stub->info(), false /*wide*/, false /*unaligned*/);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   336
  }
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   337
  __ cbz(pre_val_reg, *stub->continuation());
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   338
  ce->store_parameter(stub->pre_val()->as_register(), 0);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   339
  __ far_call(RuntimeAddress(bs->pre_barrier_c1_runtime_code_blob()->code_begin()));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   340
  __ b(*stub->continuation());
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   341
}
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   342
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   343
void G1BarrierSetAssembler::gen_post_barrier_stub(LIR_Assembler* ce, G1PostBarrierStub* stub) {
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   344
  G1BarrierSetC1* bs = (G1BarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   345
  __ bind(*stub->entry());
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   346
  assert(stub->addr()->is_register(), "Precondition.");
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   347
  assert(stub->new_val()->is_register(), "Precondition.");
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   348
  Register new_val_reg = stub->new_val()->as_register();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   349
  __ cbz(new_val_reg, *stub->continuation());
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   350
  ce->store_parameter(stub->addr()->as_pointer_register(), 0);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   351
  __ far_call(RuntimeAddress(bs->post_barrier_c1_runtime_code_blob()->code_begin()));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   352
  __ b(*stub->continuation());
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   353
}
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   354
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   355
#undef __
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   356
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   357
#define __ sasm->
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   358
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   359
void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* sasm) {
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   360
  __ prologue("g1_pre_barrier", false);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   361
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   362
  // arg0 : previous value of memory
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   363
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   364
  BarrierSet* bs = BarrierSet::barrier_set();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   365
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   366
  const Register pre_val = r0;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   367
  const Register thread = rthread;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   368
  const Register tmp = rscratch1;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   369
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   370
  Address in_progress(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   371
  Address queue_index(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_index_offset()));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   372
  Address buffer(thread, in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset()));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   373
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   374
  Label done;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   375
  Label runtime;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   376
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   377
  // Is marking still active?
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   378
  if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   379
    __ ldrw(tmp, in_progress);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   380
  } else {
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   381
    assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   382
    __ ldrb(tmp, in_progress);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   383
  }
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   384
  __ cbzw(tmp, done);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   385
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   386
  // Can we store original value in the thread's buffer?
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   387
  __ ldr(tmp, queue_index);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   388
  __ cbz(tmp, runtime);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   389
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   390
  __ sub(tmp, tmp, wordSize);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   391
  __ str(tmp, queue_index);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   392
  __ ldr(rscratch2, buffer);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   393
  __ add(tmp, tmp, rscratch2);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   394
  __ load_parameter(0, rscratch2);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   395
  __ str(rscratch2, Address(tmp, 0));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   396
  __ b(done);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   397
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   398
  __ bind(runtime);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   399
  __ push_call_clobbered_registers();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   400
  __ load_parameter(0, pre_val);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   401
  __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   402
  __ pop_call_clobbered_registers();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   403
  __ bind(done);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   404
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   405
  __ epilogue();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   406
}
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   407
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   408
void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* sasm) {
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   409
  __ prologue("g1_post_barrier", false);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   410
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   411
  // arg0: store_address
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   412
  Address store_addr(rfp, 2*BytesPerWord);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   413
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   414
  BarrierSet* bs = BarrierSet::barrier_set();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   415
  CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   416
  CardTable* ct = ctbs->card_table();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   417
  assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   418
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   419
  Label done;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   420
  Label runtime;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   421
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   422
  // At this point we know new_value is non-NULL and the new_value crosses regions.
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   423
  // Must check to see if card is already dirty
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   424
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   425
  const Register thread = rthread;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   426
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   427
  Address queue_index(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset()));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   428
  Address buffer(thread, in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset()));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   429
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   430
  const Register card_offset = rscratch2;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   431
  // LR is free here, so we can use it to hold the byte_map_base.
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   432
  const Register byte_map_base = lr;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   433
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   434
  assert_different_registers(card_offset, byte_map_base, rscratch1);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   435
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   436
  __ load_parameter(0, card_offset);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   437
  __ lsr(card_offset, card_offset, CardTable::card_shift);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   438
  __ load_byte_map_base(byte_map_base);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   439
  __ ldrb(rscratch1, Address(byte_map_base, card_offset));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   440
  __ cmpw(rscratch1, (int)G1CardTable::g1_young_card_val());
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   441
  __ br(Assembler::EQ, done);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   442
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   443
  assert((int)CardTable::dirty_card_val() == 0, "must be 0");
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   444
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   445
  __ membar(Assembler::StoreLoad);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   446
  __ ldrb(rscratch1, Address(byte_map_base, card_offset));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   447
  __ cbzw(rscratch1, done);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   448
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   449
  // storing region crossing non-NULL, card is clean.
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   450
  // dirty card and log.
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   451
  __ strb(zr, Address(byte_map_base, card_offset));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   452
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   453
  // Convert card offset into an address in card_addr
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   454
  Register card_addr = card_offset;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   455
  __ add(card_addr, byte_map_base, card_addr);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   456
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   457
  __ ldr(rscratch1, queue_index);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   458
  __ cbz(rscratch1, runtime);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   459
  __ sub(rscratch1, rscratch1, wordSize);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   460
  __ str(rscratch1, queue_index);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   461
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   462
  // Reuse LR to hold buffer_addr
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   463
  const Register buffer_addr = lr;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   464
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   465
  __ ldr(buffer_addr, buffer);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   466
  __ str(card_addr, Address(buffer_addr, rscratch1));
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   467
  __ b(done);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   468
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   469
  __ bind(runtime);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   470
  __ push_call_clobbered_registers();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   471
  __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   472
  __ pop_call_clobbered_registers();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   473
  __ bind(done);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   474
  __ epilogue();
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   475
}
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   476
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   477
#undef __
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   478
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49816
diff changeset
   479
#endif // COMPILER1