src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp
author shade
Wed, 02 May 2018 19:26:42 +0200
changeset 49950 7b916885654d
child 50599 ecc2af326b5f
permissions -rw-r--r--
8201786: Modularize interpreter GC barriers: leftovers for ARM32 Reviewed-by: enevill, eosterlund
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49950
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
     1
/*
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
     4
 *
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
     8
 *
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    13
 * accompanied this code).
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    14
 *
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    18
 *
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    21
 * questions.
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    22
 *
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    23
 */
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    24
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    25
#include "precompiled.hpp"
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    26
#include "gc/shared/barrierSetAssembler.hpp"
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    27
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    28
#define __ masm->
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    29
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    30
void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    31
                                  Register dst, Address src, Register tmp1, Register tmp2, Register tmp3) {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    32
  bool on_heap = (decorators & IN_HEAP) != 0;
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    33
  bool on_root = (decorators & IN_ROOT) != 0;
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    34
  switch (type) {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    35
  case T_OBJECT:
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    36
  case T_ARRAY: {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    37
    if (on_heap) {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    38
#ifdef AARCH64
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    39
      if (UseCompressedOops) {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    40
        __ ldr_w(dst, src);
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    41
        __ decode_heap_oop(dst);
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    42
      } else
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    43
#endif // AARCH64
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    44
      {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    45
        __ ldr(dst, src);
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    46
      }
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    47
    } else {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    48
      assert(on_root, "why else?");
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    49
      __ ldr(dst, src);
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    50
    }
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    51
    break;
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    52
  }
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    53
  default: Unimplemented();
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    54
  }
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    55
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    56
}
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    57
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    58
void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    59
                                   Address obj, Register val, Register tmp1, Register tmp2, Register tmp3, bool is_null) {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    60
  bool on_heap = (decorators & IN_HEAP) != 0;
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    61
  bool on_root = (decorators & IN_ROOT) != 0;
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    62
  switch (type) {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    63
  case T_OBJECT:
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    64
  case T_ARRAY: {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    65
    if (on_heap) {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    66
#ifdef AARCH64
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    67
      if (UseCompressedOops) {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    68
        assert(!dst.uses(src), "not enough registers");
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    69
        if (!is_null) {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    70
          __ encode_heap_oop(src);
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    71
        }
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    72
        __ str_w(val, obj);
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    73
      } else
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    74
#endif // AARCH64
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    75
      {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    76
        __ str(val, obj);
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    77
      }
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    78
    } else {
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    79
      assert(on_root, "why else?");
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    80
      __ str(val, obj);
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    81
    }
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    82
    break;
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    83
  }
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    84
  default: Unimplemented();
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    85
  }
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    86
}
7b916885654d 8201786: Modularize interpreter GC barriers: leftovers for ARM32
shade
parents:
diff changeset
    87