src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp
author rkennke
Sun, 06 May 2018 00:42:59 +0200
changeset 50024 7238cb613dc5
parent 49929 f38329fe8055
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:
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
     1
/*
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
     4
 *
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
     8
 *
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    13
 * accompanied this code).
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    14
 *
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    18
 *
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    21
 * questions.
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    22
 *
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    23
 */
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    24
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    25
#include "precompiled.hpp"
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    26
#include "gc/shared/barrierSetAssembler.hpp"
49898
4745598b307f 8200235: Generalize jniFastGetField jobject/jweak resolve
eosterlund
parents: 49748
diff changeset
    27
#include "runtime/jniHandles.hpp"
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    28
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    29
#define __ masm->
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    30
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    31
void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    32
                                  Register dst, Address src, Register tmp1, Register tmp_thread) {
50024
7238cb613dc5 8202676: AArch64: Missing enter/leave around barrier leads to infinite loop
rkennke
parents: 49929
diff changeset
    33
7238cb613dc5 8202676: AArch64: Missing enter/leave around barrier leads to infinite loop
rkennke
parents: 49929
diff changeset
    34
  // LR is live.  It must be saved around calls.
7238cb613dc5 8202676: AArch64: Missing enter/leave around barrier leads to infinite loop
rkennke
parents: 49929
diff changeset
    35
49748
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    36
  bool on_heap = (decorators & IN_HEAP) != 0;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    37
  bool on_root = (decorators & IN_ROOT) != 0;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    38
  switch (type) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    39
  case T_OBJECT:
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    40
  case T_ARRAY: {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    41
    if (on_heap) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    42
      __ load_heap_oop(dst, src);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    43
    } else {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    44
      assert(on_root, "why else?");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    45
      __ ldr(dst, src);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    46
    }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    47
    break;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    48
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    49
  default: Unimplemented();
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    50
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    51
}
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    52
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    53
void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    54
                                   Address dst, Register val, Register tmp1, Register tmp2) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    55
  bool on_heap = (decorators & IN_HEAP) != 0;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    56
  bool on_root = (decorators & IN_ROOT) != 0;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    57
  switch (type) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    58
  case T_OBJECT:
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    59
  case T_ARRAY: {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    60
    if (on_heap) {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    61
      __ store_heap_oop(dst, val);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    62
    } else {
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    63
      assert(on_root, "why else?");
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    64
      __ str(val, dst);
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    65
    }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    66
    break;
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    67
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    68
  default: Unimplemented();
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    69
  }
6a880e576856 8199417: Modularize interpreter GC barriers
eosterlund
parents:
diff changeset
    70
}
49898
4745598b307f 8200235: Generalize jniFastGetField jobject/jweak resolve
eosterlund
parents: 49748
diff changeset
    71
49929
f38329fe8055 8202381: (Solaris) SIGBUS in # V [libjvm.so+0xcee494] jni_GetIntField+0x224
eosterlund
parents: 49898
diff changeset
    72
void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
f38329fe8055 8202381: (Solaris) SIGBUS in # V [libjvm.so+0xcee494] jni_GetIntField+0x224
eosterlund
parents: 49898
diff changeset
    73
                                                        Register obj, Register tmp, Label& slowpath) {
49898
4745598b307f 8200235: Generalize jniFastGetField jobject/jweak resolve
eosterlund
parents: 49748
diff changeset
    74
  // If mask changes we need to ensure that the inverse is still encodable as an immediate
4745598b307f 8200235: Generalize jniFastGetField jobject/jweak resolve
eosterlund
parents: 49748
diff changeset
    75
  STATIC_ASSERT(JNIHandles::weak_tag_mask == 1);
49929
f38329fe8055 8202381: (Solaris) SIGBUS in # V [libjvm.so+0xcee494] jni_GetIntField+0x224
eosterlund
parents: 49898
diff changeset
    76
  __ andr(obj, obj, ~JNIHandles::weak_tag_mask);
f38329fe8055 8202381: (Solaris) SIGBUS in # V [libjvm.so+0xcee494] jni_GetIntField+0x224
eosterlund
parents: 49898
diff changeset
    77
  __ ldr(obj, Address(obj, 0));             // *obj
49898
4745598b307f 8200235: Generalize jniFastGetField jobject/jweak resolve
eosterlund
parents: 49748
diff changeset
    78
}