src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 51383 2f58537e1bc0
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:
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     1
/*
49347
edb65305d3ac 8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents: 47216
diff changeset
     2
 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     3
 * Copyright (c) 2014, Red Hat Inc. All rights reserved.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     5
 *
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     8
 * published by the Free Software Foundation.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
     9
 *
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    14
 * accompanied this code).
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    15
 *
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    19
 *
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    22
 * questions.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    23
 *
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    24
 */
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    25
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    26
#include "precompiled.hpp"
50380
bec342339138 8204195: Clean up macroAssembler.inline.hpp and other inline.hpp files included in .hpp files
coleenp
parents: 50094
diff changeset
    27
#include "asm/macroAssembler.inline.hpp"
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    28
#include "c1/c1_CodeStubs.hpp"
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    29
#include "c1/c1_FrameMap.hpp"
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    30
#include "c1/c1_LIRAssembler.hpp"
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    31
#include "c1/c1_MacroAssembler.hpp"
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    32
#include "c1/c1_Runtime1.hpp"
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    33
#include "nativeInst_aarch64.hpp"
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    34
#include "runtime/sharedRuntime.hpp"
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    35
#include "vmreg_aarch64.inline.hpp"
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    36
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    37
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    38
#define __ ce->masm()->
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    39
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    40
void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    41
  __ bind(_entry);
34200
0a24709c3861 8138892: C1: Improve counter overflow checking
mdoerr
parents: 32086
diff changeset
    42
  Metadata *m = _method->as_constant_ptr()->as_metadata();
0a24709c3861 8138892: C1: Improve counter overflow checking
mdoerr
parents: 32086
diff changeset
    43
  __ mov_metadata(rscratch1, m);
0a24709c3861 8138892: C1: Improve counter overflow checking
mdoerr
parents: 32086
diff changeset
    44
  ce->store_parameter(rscratch1, 1);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    45
  ce->store_parameter(_bci, 0);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    46
  __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::counter_overflow_id)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    47
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    48
  ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    49
  __ b(_continuation);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    50
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    51
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
    52
RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array)
51383
2f58537e1bc0 8209193: Fix aarch64-linux compilation after -Wreorder changes
tschatzl
parents: 50519
diff changeset
    53
  : _index(index), _array(array), _throw_index_out_of_bounds_exception(false) {
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
    54
  assert(info != NULL, "must have info");
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
    55
  _info = new CodeEmitInfo(info);
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
    56
}
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
    57
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
    58
RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index)
51383
2f58537e1bc0 8209193: Fix aarch64-linux compilation after -Wreorder changes
tschatzl
parents: 50519
diff changeset
    59
  : _index(index), _array(NULL), _throw_index_out_of_bounds_exception(true) {
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    60
  assert(info != NULL, "must have info");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    61
  _info = new CodeEmitInfo(info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    62
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    63
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    64
void RangeCheckStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    65
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    66
  if (_info->deoptimize_on_exception()) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    67
    address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    68
    __ far_call(RuntimeAddress(a));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    69
    ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    70
    ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    71
    debug_only(__ should_not_reach_here());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    72
    return;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    73
  }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    74
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    75
  if (_index->is_cpu_register()) {
50519
17bde7f98889 8204606: [Aarch64] SIGSEGVs caused by C1 because of improper register usage
aph
parents: 50380
diff changeset
    76
    __ mov(rscratch1, _index->as_register());
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    77
  } else {
50519
17bde7f98889 8204606: [Aarch64] SIGSEGVs caused by C1 because of improper register usage
aph
parents: 50380
diff changeset
    78
    __ mov(rscratch1, _index->as_jint());
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    79
  }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    80
  Runtime1::StubID stub_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    81
  if (_throw_index_out_of_bounds_exception) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    82
    stub_id = Runtime1::throw_index_exception_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    83
  } else {
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
    84
    assert(_array != NULL, "sanity");
50519
17bde7f98889 8204606: [Aarch64] SIGSEGVs caused by C1 because of improper register usage
aph
parents: 50380
diff changeset
    85
    __ mov(rscratch2, _array->as_pointer_register());
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    86
    stub_id = Runtime1::throw_range_check_failed_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    87
  }
50519
17bde7f98889 8204606: [Aarch64] SIGSEGVs caused by C1 because of improper register usage
aph
parents: 50380
diff changeset
    88
  __ lea(lr, RuntimeAddress(Runtime1::entry_for(stub_id)));
17bde7f98889 8204606: [Aarch64] SIGSEGVs caused by C1 because of improper register usage
aph
parents: 50380
diff changeset
    89
  __ blr(lr);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    90
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    91
  ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    92
  debug_only(__ should_not_reach_here());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    93
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    94
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    95
PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    96
  _info = new CodeEmitInfo(info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    97
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    98
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
    99
void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   100
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   101
  address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   102
  __ far_call(RuntimeAddress(a));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   103
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   104
  ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   105
  debug_only(__ should_not_reach_here());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   106
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   107
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   108
void DivByZeroStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   109
  if (_offset != -1) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   110
    ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   111
  }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   112
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   113
  __ far_call(Address(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   114
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   115
  ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   116
#ifdef ASSERT
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   117
  __ should_not_reach_here();
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   118
#endif
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   119
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   120
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   121
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   122
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   123
// Implementation of NewInstanceStub
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   124
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   125
NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   126
  _result = result;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   127
  _klass = klass;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   128
  _klass_reg = klass_reg;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   129
  _info = new CodeEmitInfo(info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   130
  assert(stub_id == Runtime1::new_instance_id                 ||
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   131
         stub_id == Runtime1::fast_new_instance_id            ||
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   132
         stub_id == Runtime1::fast_new_instance_init_check_id,
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   133
         "need new_instance id");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   134
  _stub_id   = stub_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   135
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   136
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   137
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   138
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   139
void NewInstanceStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   140
  assert(__ rsp_offset() == 0, "frame size should be fixed");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   141
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   142
  __ mov(r3, _klass_reg->as_register());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   143
  __ far_call(RuntimeAddress(Runtime1::entry_for(_stub_id)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   144
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   145
  ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   146
  assert(_result->as_register() == r0, "result must in r0,");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   147
  __ b(_continuation);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   148
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   149
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   150
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   151
// Implementation of NewTypeArrayStub
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   152
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   153
// Implementation of NewTypeArrayStub
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   154
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   155
NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   156
  _klass_reg = klass_reg;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   157
  _length = length;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   158
  _result = result;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   159
  _info = new CodeEmitInfo(info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   160
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   161
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   162
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   163
void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   164
  assert(__ rsp_offset() == 0, "frame size should be fixed");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   165
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   166
  assert(_length->as_register() == r19, "length must in r19,");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   167
  assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   168
  __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_type_array_id)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   169
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   170
  ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   171
  assert(_result->as_register() == r0, "result must in r0");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   172
  __ b(_continuation);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   173
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   174
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   175
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   176
// Implementation of NewObjectArrayStub
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   177
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   178
NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   179
  _klass_reg = klass_reg;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   180
  _result = result;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   181
  _length = length;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   182
  _info = new CodeEmitInfo(info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   183
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   185
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   186
void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   187
  assert(__ rsp_offset() == 0, "frame size should be fixed");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   188
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   189
  assert(_length->as_register() == r19, "length must in r19,");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   190
  assert(_klass_reg->as_register() == r3, "klass_reg must in r3");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   191
  __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   192
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   193
  ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   194
  assert(_result->as_register() == r0, "result must in r0");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   195
  __ b(_continuation);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   196
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   197
// Implementation of MonitorAccessStubs
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   198
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   199
MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   200
: MonitorAccessStub(obj_reg, lock_reg)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   201
{
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   202
  _info = new CodeEmitInfo(info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   203
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   204
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   205
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   206
void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   207
  assert(__ rsp_offset() == 0, "frame size should be fixed");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   208
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   209
  ce->store_parameter(_obj_reg->as_register(),  1);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   210
  ce->store_parameter(_lock_reg->as_register(), 0);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   211
  Runtime1::StubID enter_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   212
  if (ce->compilation()->has_fpu_code()) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   213
    enter_id = Runtime1::monitorenter_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   214
  } else {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   215
    enter_id = Runtime1::monitorenter_nofpu_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   216
  }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   217
  __ far_call(RuntimeAddress(Runtime1::entry_for(enter_id)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   218
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   219
  ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   220
  __ b(_continuation);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   221
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   222
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   223
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   224
void MonitorExitStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   225
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   226
  if (_compute_lock) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   227
    // lock_reg was destroyed by fast unlocking attempt => recompute it
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   228
    ce->monitor_address(_monitor_ix, _lock_reg);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   229
  }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   230
  ce->store_parameter(_lock_reg->as_register(), 0);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   231
  // note: non-blocking leaf routine => no call info needed
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   232
  Runtime1::StubID exit_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   233
  if (ce->compilation()->has_fpu_code()) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   234
    exit_id = Runtime1::monitorexit_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   235
  } else {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   236
    exit_id = Runtime1::monitorexit_nofpu_id;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   237
  }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   238
  __ adr(lr, _continuation);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   239
  __ far_jump(RuntimeAddress(Runtime1::entry_for(exit_id)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   240
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   241
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   242
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   243
// Implementation of patching:
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   244
// - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   245
// - Replace original code with a call to the stub
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   246
// At Runtime:
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   247
// - call to stub, jump to runtime
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   248
// - in runtime: preserve all registers (rspecially objects, i.e., source and destination object)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   249
// - in runtime: after initializing class, restore original code, reexecute instruction
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   250
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   251
int PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   252
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   253
void PatchingStub::align_patch_site(MacroAssembler* masm) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   254
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   255
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   256
void PatchingStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   257
  assert(false, "AArch64 should not use C1 runtime patching");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   258
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   259
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   260
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   261
void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   262
  __ bind(_entry);
35560
b3fa0a291684 8146891: AArch64 needs patch for 8032463
aph
parents: 34200
diff changeset
   263
  ce->store_parameter(_trap_request, 0);
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   264
  __ far_call(RuntimeAddress(Runtime1::entry_for(Runtime1::deoptimize_id)));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   265
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   266
  DEBUG_ONLY(__ should_not_reach_here());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   267
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   268
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   269
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   270
void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   271
  address a;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   272
  if (_info->deoptimize_on_exception()) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   273
    // Deoptimize, do not throw the exception, because it is probably wrong to do it here.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   274
    a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   275
  } else {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   276
    a = Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   277
  }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   278
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   279
  ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   280
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   281
  __ far_call(RuntimeAddress(a));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   282
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   283
  ce->verify_oop_map(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   284
  debug_only(__ should_not_reach_here());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   285
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   286
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   287
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   288
void SimpleExceptionStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   289
  assert(__ rsp_offset() == 0, "frame size should be fixed");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   290
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   291
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   292
  // pass the object in a scratch register because all other registers
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   293
  // must be preserved
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   294
  if (_obj->is_cpu_register()) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   295
    __ mov(rscratch1, _obj->as_register());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   296
  }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   297
  __ far_call(RuntimeAddress(Runtime1::entry_for(_stub)), NULL, rscratch2);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   298
  ce->add_call_info_here(_info);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   299
  debug_only(__ should_not_reach_here());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   300
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   301
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   302
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   303
void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   304
  //---------------slow case: call to native-----------------
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   305
  __ bind(_entry);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   306
  // Figure out where the args should go
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   307
  // This should really convert the IntrinsicID to the Method* and signature
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   308
  // but I don't know how to do that.
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   309
  //
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   310
  VMRegPair args[5];
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   311
  BasicType signature[5] = { T_OBJECT, T_INT, T_OBJECT, T_INT, T_INT};
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   312
  SharedRuntime::java_calling_convention(signature, args, 5, true);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   313
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   314
  // push parameters
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   315
  // (src, src_pos, dest, destPos, length)
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   316
  Register r[5];
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   317
  r[0] = src()->as_register();
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   318
  r[1] = src_pos()->as_register();
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   319
  r[2] = dst()->as_register();
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   320
  r[3] = dst_pos()->as_register();
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   321
  r[4] = length()->as_register();
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   322
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   323
  // next registers will get stored on the stack
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   324
  for (int i = 0; i < 5 ; i++ ) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   325
    VMReg r_1 = args[i].first();
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   326
    if (r_1->is_stack()) {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   327
      int st_off = r_1->reg2stack() * wordSize;
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   328
      __ str (r[i], Address(sp, st_off));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   329
    } else {
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   330
      assert(r[i] == args[i].first()->as_Register(), "Wrong register for arg ");
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   331
    }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   332
  }
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   333
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   334
  ce->align_call(lir_static_call);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   335
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   336
  ce->emit_static_call_stub();
32082
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 30764
diff changeset
   337
  if (ce->compilation()->bailed_out()) {
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 30764
diff changeset
   338
    return; // CodeCache is full
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 30764
diff changeset
   339
  }
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   340
  Address resolve(SharedRuntime::get_resolve_static_call_stub(),
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   341
                  relocInfo::static_call_type);
32082
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 30764
diff changeset
   342
  address call = __ trampoline_call(resolve);
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 30764
diff changeset
   343
  if (call == NULL) {
32086
7590882ae33a 8132875: AArch64: Fix error introduced into AArch64 CodeCache by commit for 8130309
adinn
parents: 32082
diff changeset
   344
    ce->bailout("trampoline stub overflow");
32082
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 30764
diff changeset
   345
    return;
2a3323e25de1 8130309: Need to bailout cleanly if creation of stubs fails when codecache is out of space
thartmann
parents: 30764
diff changeset
   346
  }
29184
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   347
  ce->add_call_info_here(info());
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   348
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   349
#ifndef PRODUCT
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   350
  __ lea(rscratch2, ExternalAddress((address)&Runtime1::_arraycopy_slowcase_cnt));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   351
  __ incrementw(Address(rscratch2));
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   352
#endif
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   353
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   354
  __ b(_continuation);
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   355
}
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   356
e234025cafb6 8068053: AARCH64: C1 and C2 compilers
aph
parents:
diff changeset
   357
#undef __