hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp
author roland
Wed, 21 Aug 2013 13:34:45 +0200
changeset 19710 2f8ca425504e
parent 16611 6807a703dd6b
child 22234 da823d78ad65
permissions -rw-r--r--
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked Summary: Do patching rather bailing out for unlinked call with appendix Reviewed-by: twisti, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
     2
 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    26
#include "c1/c1_CodeStubs.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    27
#include "c1/c1_FrameMap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    28
#include "c1/c1_LIRAssembler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    29
#include "c1/c1_MacroAssembler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    30
#include "c1/c1_Runtime1.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    31
#include "nativeInst_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    32
#include "runtime/sharedRuntime.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 14837
diff changeset
    33
#include "utilities/macros.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    34
#include "vmreg_sparc.inline.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 14837
diff changeset
    35
#if INCLUDE_ALL_GCS
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6774
diff changeset
    36
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 14837
diff changeset
    37
#endif // INCLUDE_ALL_GCS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
#define __ ce->masm()->
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
                               bool throw_index_out_of_bounds_exception)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  , _index(index)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
{
6745
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
    46
  assert(info != NULL, "must have info");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
void RangeCheckStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    54
  if (_info->deoptimize_on_exception()) {
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    55
    address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    56
    __ call(a, relocInfo::runtime_call_type);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    57
    __ delayed()->nop();
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    58
    ce->add_call_info_here(_info);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    59
    ce->verify_oop_map(_info);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    60
    debug_only(__ should_not_reach_here());
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    61
    return;
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    62
  }
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    63
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  if (_index->is_register()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    __ mov(_index->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    __ set(_index->as_jint(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  if (_throw_index_out_of_bounds_exception) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  ce->verify_oop_map(_info);
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    77
  debug_only(__ should_not_reach_here());
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    78
}
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    79
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    80
PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    81
  _info = new CodeEmitInfo(info);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    84
void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    85
  __ bind(_entry);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    86
  address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    87
  __ call(a, relocInfo::runtime_call_type);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    88
  __ delayed()->nop();
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    89
  ce->add_call_info_here(_info);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    90
  ce->verify_oop_map(_info);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    91
  debug_only(__ should_not_reach_here());
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
    92
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  __ set(_bci, G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type);
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5547
diff changeset
    98
  __ delayed()->mov_or_nop(_method->as_register(), G5);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  __ br(Assembler::always, true, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
void DivByZeroStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  if (_offset != -1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  __ call(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   123
  address a;
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   124
  if (_info->deoptimize_on_exception()) {
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   125
    // Deoptimize, do not throw the exception, because it is probably wrong to do it here.
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   126
    a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   127
  } else {
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   128
    a = Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   129
  }
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   130
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  __ bind(_entry);
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   133
  __ call(a, relocInfo::runtime_call_type);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
// Implementation of SimpleExceptionStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
// Note: %g1 and %g3 are already in use
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
void SimpleExceptionStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  __ call(Runtime1::entry_for(_stub), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  if (_obj->is_valid()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    __ delayed()->mov(_obj->as_register(), G4); // _obj contains the optional argument to the stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    __ delayed()->mov(G0, G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
// Implementation of NewInstanceStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  _result = result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  _klass = klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  _klass_reg = klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  assert(stub_id == Runtime1::new_instance_id                 ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
         stub_id == Runtime1::fast_new_instance_id            ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
         stub_id == Runtime1::fast_new_instance_init_check_id,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
         "need new_instance id");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  _stub_id   = stub_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
void NewInstanceStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  __ call(Runtime1::entry_for(_stub_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  __ br(Assembler::always, false, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  __ delayed()->mov_or_nop(O0, _result->as_register());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
// Implementation of NewTypeArrayStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  _klass_reg = klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  _length = length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  _result = result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  __ mov(_length->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  __ call(Runtime1::entry_for(Runtime1::new_type_array_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  __ br(Assembler::always, false, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  __ delayed()->mov_or_nop(O0, _result->as_register());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
// Implementation of NewObjectArrayStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  _klass_reg = klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  _length = length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  _result = result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  __ mov(_length->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  __ call(Runtime1::entry_for(Runtime1::new_object_array_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  __ br(Assembler::always, false, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  __ delayed()->mov_or_nop(O0, _result->as_register());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
// Implementation of MonitorAccessStubs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  : MonitorAccessStub(obj_reg, lock_reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  __ mov(_obj_reg->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  if (ce->compilation()->has_fpu_code()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
    __ call(Runtime1::entry_for(Runtime1::monitorenter_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
    __ call(Runtime1::entry_for(Runtime1::monitorenter_nofpu_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  __ delayed()->mov_or_nop(_lock_reg->as_register(), G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  __ br(Assembler::always, true, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
void MonitorExitStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  if (_compute_lock) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
    ce->monitor_address(_monitor_ix, _lock_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  if (ce->compilation()->has_fpu_code()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
    __ call(Runtime1::entry_for(Runtime1::monitorexit_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
    __ call(Runtime1::entry_for(Runtime1::monitorexit_nofpu_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  __ delayed()->mov_or_nop(_lock_reg->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  __ br(Assembler::always, true, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
// Implementation of patching:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
// - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
// - Replace original code with a call to the stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
// At Runtime:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
// - call to stub, jump to runtime
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
// - in runtime: preserve all registers (especially objects, i.e., source and destination object)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
// - in runtime: after initializing class, restore original code, reexecute instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
int PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
void PatchingStub::align_patch_site(MacroAssembler* ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  // patch sites on sparc are always properly aligned.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
void PatchingStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  // copy original code here
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  assert(NativeCall::instruction_size <= _bytes_to_copy && _bytes_to_copy <= 0xFF,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
         "not enough room for call");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  assert((_bytes_to_copy & 0x3) == 0, "must copy a multiple of four bytes");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  Label call_patch;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  int being_initialized_entry = __ offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  if (_id == load_klass_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    // produce a copy of the load klass instruction for use by the being initialized case
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 1374
diff changeset
   297
#ifdef ASSERT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
    address start = __ pc();
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 1374
diff changeset
   299
#endif
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   300
    AddressLiteral addrlit(NULL, metadata_Relocation::spec(_index));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   301
    __ patchable_set(addrlit, _obj);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   302
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   303
#ifdef ASSERT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   304
    for (int i = 0; i < _bytes_to_copy; i++) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   305
      address ptr = (address)(_pc_start + i);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   306
      int a_byte = (*ptr) & 0xFF;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   307
      assert(a_byte == *start++, "should be the same code");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   308
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   309
#endif
19710
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 16611
diff changeset
   310
  } else if (_id == load_mirror_id || _id == load_appendix_id) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   311
    // produce a copy of the load mirror instruction for use by the being initialized case
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   312
#ifdef ASSERT
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   313
    address start = __ pc();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   314
#endif
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   315
    AddressLiteral addrlit(NULL, oop_Relocation::spec(_index));
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 1374
diff changeset
   316
    __ patchable_set(addrlit, _obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
    for (int i = 0; i < _bytes_to_copy; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
      address ptr = (address)(_pc_start + i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
      int a_byte = (*ptr) & 0xFF;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
      assert(a_byte == *start++, "should be the same code");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    // make a copy the code which is going to be patched.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
    for (int i = 0; i < _bytes_to_copy; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
      address ptr = (address)(_pc_start + i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
      int a_byte = (*ptr) & 0xFF;
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 13728
diff changeset
   330
      __ emit_int8 (a_byte);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  address end_of_patch = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  int bytes_to_skip = 0;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   336
  if (_id == load_mirror_id) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    int offset = __ offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
    if (CommentedAssembly) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
      __ block_comment(" being_initialized check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
    // static field accesses have special semantics while the class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
    // initializer is being run so we emit a test which can be used to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
    // check that this code is being executed by the initializing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
    // thread.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
    assert(_obj != noreg, "must be a valid register");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   347
    assert(_index >= 0, "must have oop index");
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   348
    __ ld_ptr(_obj, java_lang_Class::klass_offset_in_bytes(), G3);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   349
    __ ld_ptr(G3, in_bytes(InstanceKlass::init_thread_offset()), G3);
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 9186
diff changeset
   350
    __ cmp_and_brx_short(G2_thread, G3, Assembler::notEqual, Assembler::pn, call_patch);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
    // load_klass patches may execute the patched code before it's
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
    // copied back into place so we need to jump back into the main
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
    // code of the nmethod to continue execution.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
    __ br(Assembler::always, false, Assembler::pt, _patch_site_continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
    __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
    // make sure this extra code gets skipped
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
    bytes_to_skip += __ offset() - offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  // Now emit the patch record telling the runtime how to find the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  // pieces of the patch.  We only need 3 bytes but it has to be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  // aligned as an instruction so emit 4 bytes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  int sizeof_patch_record = 4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  bytes_to_skip += sizeof_patch_record;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  // emit the offsets needed to find the code to patch
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  // Emit the patch record.  We need to emit a full word, so emit an extra empty byte
14837
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 13728
diff changeset
   372
  __ emit_int8(0);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 13728
diff changeset
   373
  __ emit_int8(being_initialized_entry_offset);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 13728
diff changeset
   374
  __ emit_int8(bytes_to_skip);
a75c3082d106 8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents: 13728
diff changeset
   375
  __ emit_int8(_bytes_to_copy);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
  address patch_info_pc = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
  address entry = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  NativeGeneralJump::insert_unconditional((address)_pc_start, entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
  address target = NULL;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   382
  relocInfo::relocType reloc_type = relocInfo::none;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  switch (_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
    case access_field_id:  target = Runtime1::entry_for(Runtime1::access_field_patching_id); break;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   385
    case load_klass_id:    target = Runtime1::entry_for(Runtime1::load_klass_patching_id); reloc_type = relocInfo::metadata_type; break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   386
    case load_mirror_id:   target = Runtime1::entry_for(Runtime1::load_mirror_patching_id); reloc_type = relocInfo::oop_type; break;
19710
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 16611
diff changeset
   387
    case load_appendix_id: target = Runtime1::entry_for(Runtime1::load_appendix_patching_id); reloc_type = relocInfo::oop_type; break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
    default: ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
  __ bind(call_patch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  if (CommentedAssembly) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
    __ block_comment("patch entry point");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  __ call(target, relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
  assert(_patch_info_offset == (patch_info_pc - __ pc()), "must not change");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
  __ br(Assembler::always, false, Assembler::pt, _patch_site_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
  __ delayed()->nop();
19710
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 16611
diff changeset
   401
  if (_id == load_klass_id || _id == load_mirror_id || _id == load_appendix_id) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
    CodeSection* cs = __ code_section();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
    address pc = (address)_pc_start;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
    RelocIterator iter(cs, pc, pc + 1);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   405
    relocInfo::change_reloc_info_for_address(&iter, (address) pc, reloc_type, relocInfo::none);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
    pc = (address)(_pc_start + NativeMovConstReg::add_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
    RelocIterator iter2(cs, pc, pc+1);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   409
    relocInfo::change_reloc_info_for_address(&iter2, (address) pc, reloc_type, relocInfo::none);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
5046
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   414
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   415
void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   416
  __ bind(_entry);
10972
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10497
diff changeset
   417
  __ call(Runtime1::entry_for(Runtime1::deoptimize_id), relocInfo::runtime_call_type);
5046
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   418
  __ delayed()->nop();
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   419
  ce->add_call_info_here(_info);
10972
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10497
diff changeset
   420
  DEBUG_ONLY(__ should_not_reach_here());
5046
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   421
}
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   422
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   423
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
  //---------------slow case: call to native-----------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
  __ mov(src()->as_register(),     O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
  __ mov(src_pos()->as_register(), O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
  __ mov(dst()->as_register(),     O2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
  __ mov(dst_pos()->as_register(), O3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
  __ mov(length()->as_register(),  O4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
  ce->emit_static_call_stub();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
  __ call(SharedRuntime::get_resolve_static_call_stub(), relocInfo::static_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
  ce->add_call_info_here(info());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
  ce->verify_oop_map(info());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
  __ set((intptr_t)&Runtime1::_arraycopy_slowcase_cnt, O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
  __ ld(O0, 0, O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
  __ inc(O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
  __ st(O1, 0, O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
  __ br(Assembler::always, false, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   452
///////////////////////////////////////////////////////////////////////////////////
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 14837
diff changeset
   453
#if INCLUDE_ALL_GCS
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   454
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   455
void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8729
diff changeset
   456
  // At this point we know that marking is in progress.
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8729
diff changeset
   457
  // If do_load() is true then we have to emit the
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8729
diff changeset
   458
  // load of the previous value; otherwise it has already
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8729
diff changeset
   459
  // been loaded into _pre_val.
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8729
diff changeset
   460
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   461
  __ bind(_entry);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   462
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   463
  assert(pre_val()->is_register(), "Precondition.");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   464
  Register pre_val_reg = pre_val()->as_register();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   465
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8729
diff changeset
   466
  if (do_load()) {
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8729
diff changeset
   467
    ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8729
diff changeset
   468
  }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8729
diff changeset
   469
6774
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   470
  if (__ is_in_wdisp16_range(_continuation)) {
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   471
    __ br_null(pre_val_reg, /*annul*/false, Assembler::pt, _continuation);
6774
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   472
  } else {
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   473
    __ cmp(pre_val_reg, G0);
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   474
    __ brx(Assembler::equal, false, Assembler::pn, _continuation);
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   475
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   476
  __ delayed()->nop();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   477
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   478
  __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id));
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   479
  __ delayed()->mov(pre_val_reg, G4);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   480
  __ br(Assembler::always, false, Assembler::pt, _continuation);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   481
  __ delayed()->nop();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   482
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   483
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   484
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   485
jbyte* G1PostBarrierStub::_byte_map_base = NULL;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   486
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   487
jbyte* G1PostBarrierStub::byte_map_base_slow() {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   488
  BarrierSet* bs = Universe::heap()->barrier_set();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   489
  assert(bs->is_a(BarrierSet::G1SATBCTLogging),
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   490
         "Must be if we're using this.");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   491
  return ((G1SATBCardTableModRefBS*)bs)->byte_map_base;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   492
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   493
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   494
void G1PostBarrierStub::emit_code(LIR_Assembler* ce) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   495
  __ bind(_entry);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   496
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   497
  assert(addr()->is_register(), "Precondition.");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   498
  assert(new_val()->is_register(), "Precondition.");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   499
  Register addr_reg = addr()->as_pointer_register();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   500
  Register new_val_reg = new_val()->as_register();
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   501
6774
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   502
  if (__ is_in_wdisp16_range(_continuation)) {
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   503
    __ br_null(new_val_reg, /*annul*/false, Assembler::pt, _continuation);
6774
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   504
  } else {
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   505
    __ cmp(new_val_reg, G0);
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   506
    __ brx(Assembler::equal, false, Assembler::pn, _continuation);
a224d6a24120 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 6745
diff changeset
   507
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   508
  __ delayed()->nop();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   509
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   510
  __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_post_barrier_slow_id));
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   511
  __ delayed()->mov(addr_reg, G4);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   512
  __ br(Assembler::always, false, Assembler::pt, _continuation);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   513
  __ delayed()->nop();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   514
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   515
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 14837
diff changeset
   516
#endif // INCLUDE_ALL_GCS
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   517
///////////////////////////////////////////////////////////////////////////////////
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   518
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
#undef __