hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp
author roland
Tue, 29 Dec 2009 19:08:54 +0100
changeset 6745 a34ef8968a84
parent 6453 970dc585ab63
child 6774 a224d6a24120
permissions -rw-r--r--
6986046: C1 valuestack cleanup Summary: fixes an historical oddity in C1 with inlining where all of the expression stacks are kept in the topmost ValueStack instead of being in their respective ValueStacks. Reviewed-by: never Contributed-by: Christian Wimmer <cwimmer@uci.edu>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
     2
 * Copyright (c) 1999, 2010, 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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
#include "incls/_precompiled.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
#include "incls/_c1_CodeStubs_sparc.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
#define __ ce->masm()->
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
                               bool throw_index_out_of_bounds_exception)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  , _index(index)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
{
6745
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
    35
  assert(info != NULL, "must have info");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
void RangeCheckStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  if (_index->is_register()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    __ mov(_index->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    __ set(_index->as_jint(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  if (_throw_index_out_of_bounds_exception) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  __ set(_bci, G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type);
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5547
diff changeset
    66
  __ delayed()->mov_or_nop(_method->as_register(), G5);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  __ br(Assembler::always, true, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
void DivByZeroStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  if (_offset != -1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  __ call(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  __ call(Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
          relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
// Implementation of SimpleExceptionStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
// Note: %g1 and %g3 are already in use
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
void SimpleExceptionStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  __ call(Runtime1::entry_for(_stub), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  if (_obj->is_valid()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    __ delayed()->mov(_obj->as_register(), G4); // _obj contains the optional argument to the stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    __ delayed()->mov(G0, G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  ce->add_call_info_here(_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
// Implementation of ArrayStoreExceptionStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info):
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  _info(info) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  __ call(Runtime1::entry_for(Runtime1::throw_array_store_exception_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
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 NewInstanceStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  _result = result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  _klass = klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  _klass_reg = klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  assert(stub_id == Runtime1::new_instance_id                 ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
         stub_id == Runtime1::fast_new_instance_id            ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
         stub_id == Runtime1::fast_new_instance_init_check_id,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
         "need new_instance id");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  _stub_id   = stub_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
void NewInstanceStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  __ call(Runtime1::entry_for(_stub_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  __ br(Assembler::always, false, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  __ delayed()->mov_or_nop(O0, _result->as_register());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
// Implementation of NewTypeArrayStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  _klass_reg = klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  _length = length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  _result = result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  __ mov(_length->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  __ call(Runtime1::entry_for(Runtime1::new_type_array_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  __ br(Assembler::always, false, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  __ delayed()->mov_or_nop(O0, _result->as_register());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
// Implementation of NewObjectArrayStub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  _klass_reg = klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  _length = length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  _result = result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  __ mov(_length->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  __ call(Runtime1::entry_for(Runtime1::new_object_array_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  __ br(Assembler::always, false, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  __ delayed()->mov_or_nop(O0, _result->as_register());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
// Implementation of MonitorAccessStubs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  : MonitorAccessStub(obj_reg, lock_reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  _info = new CodeEmitInfo(info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  __ mov(_obj_reg->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  if (ce->compilation()->has_fpu_code()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    __ call(Runtime1::entry_for(Runtime1::monitorenter_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    __ call(Runtime1::entry_for(Runtime1::monitorenter_nofpu_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  __ delayed()->mov_or_nop(_lock_reg->as_register(), G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  ce->verify_oop_map(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  __ br(Assembler::always, true, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
void MonitorExitStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  if (_compute_lock) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
    ce->monitor_address(_monitor_ix, _lock_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  }
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::monitorexit_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::monitorexit_nofpu_id), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  __ delayed()->mov_or_nop(_lock_reg->as_register(), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  __ br(Assembler::always, true, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
// Implementation of patching:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
// - 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
   255
// - Replace original code with a call to the stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
// At Runtime:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
// - call to stub, jump to runtime
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
// - in runtime: preserve all registers (especially objects, i.e., source and destination object)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
// - in runtime: after initializing class, restore original code, reexecute instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
int PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
void PatchingStub::align_patch_site(MacroAssembler* ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  // patch sites on sparc are always properly aligned.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
void PatchingStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  // copy original code here
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  assert(NativeCall::instruction_size <= _bytes_to_copy && _bytes_to_copy <= 0xFF,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
         "not enough room for call");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  assert((_bytes_to_copy & 0x3) == 0, "must copy a multiple of four bytes");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  Label call_patch;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  int being_initialized_entry = __ offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  if (_id == load_klass_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
    // 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
   279
#ifdef ASSERT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
    address start = __ pc();
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 1374
diff changeset
   281
#endif
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 1374
diff changeset
   282
    AddressLiteral addrlit(NULL, oop_Relocation::spec(_oop_index));
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 1374
diff changeset
   283
    __ patchable_set(addrlit, _obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
    for (int i = 0; i < _bytes_to_copy; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
      address ptr = (address)(_pc_start + i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
      int a_byte = (*ptr) & 0xFF;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
      assert(a_byte == *start++, "should be the same code");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
    // make a copy the code which is going to be patched.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
    for (int i = 0; i < _bytes_to_copy; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
      address ptr = (address)(_pc_start + i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
      int a_byte = (*ptr) & 0xFF;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
      __ a_byte (a_byte);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  address end_of_patch = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  int bytes_to_skip = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  if (_id == load_klass_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
    int offset = __ offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
    if (CommentedAssembly) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
      __ block_comment(" being_initialized check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
    // static field accesses have special semantics while the class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
    // initializer is being run so we emit a test which can be used to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
    // check that this code is being executed by the initializing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
    // thread.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
    assert(_obj != noreg, "must be a valid register");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
    assert(_oop_index >= 0, "must have oop index");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
    __ ld_ptr(_obj, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc), G3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
    __ cmp(G2_thread, G3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
    __ br(Assembler::notEqual, false, Assembler::pn, call_patch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
    __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
    // load_klass patches may execute the patched code before it's
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
    // copied back into place so we need to jump back into the main
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
    // code of the nmethod to continue execution.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
    __ br(Assembler::always, false, Assembler::pt, _patch_site_continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
    __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    // make sure this extra code gets skipped
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
    bytes_to_skip += __ offset() - offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  // Now emit the patch record telling the runtime how to find the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  // pieces of the patch.  We only need 3 bytes but it has to be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  // aligned as an instruction so emit 4 bytes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  int sizeof_patch_record = 4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  bytes_to_skip += sizeof_patch_record;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  // emit the offsets needed to find the code to patch
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  // Emit the patch record.  We need to emit a full word, so emit an extra empty byte
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  __ a_byte(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  __ a_byte(being_initialized_entry_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  __ a_byte(bytes_to_skip);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  __ a_byte(_bytes_to_copy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  address patch_info_pc = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  address entry = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  NativeGeneralJump::insert_unconditional((address)_pc_start, entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  address target = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  switch (_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
    case access_field_id:  target = Runtime1::entry_for(Runtime1::access_field_patching_id); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
    case load_klass_id:    target = Runtime1::entry_for(Runtime1::load_klass_patching_id); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
    default: ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  __ bind(call_patch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  if (CommentedAssembly) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
    __ block_comment("patch entry point");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  __ call(target, relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  assert(_patch_info_offset == (patch_info_pc - __ pc()), "must not change");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  ce->add_call_info_here(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  __ br(Assembler::always, false, Assembler::pt, _patch_site_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  if (_id == load_klass_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
    CodeSection* cs = __ code_section();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
    address pc = (address)_pc_start;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
    RelocIterator iter(cs, pc, pc + 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
    relocInfo::change_reloc_info_for_address(&iter, (address) pc, relocInfo::oop_type, relocInfo::none);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
    pc = (address)(_pc_start + NativeMovConstReg::add_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
    RelocIterator iter2(cs, pc, pc+1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
    relocInfo::change_reloc_info_for_address(&iter2, (address) pc, relocInfo::oop_type, relocInfo::none);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
5046
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   379
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   380
void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   381
  __ bind(_entry);
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   382
  __ call(SharedRuntime::deopt_blob()->unpack_with_reexecution());
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   383
  __ delayed()->nop();
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   384
  ce->add_call_info_here(_info);
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   385
  debug_only(__ should_not_reach_here());
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   386
}
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   387
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   388
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
  //---------------slow case: call to native-----------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  __ bind(_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  __ mov(src()->as_register(),     O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  __ mov(src_pos()->as_register(), O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
  __ mov(dst()->as_register(),     O2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  __ mov(dst_pos()->as_register(), O3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
  __ mov(length()->as_register(),  O4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
  ce->emit_static_call_stub();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
  __ call(SharedRuntime::get_resolve_static_call_stub(), relocInfo::static_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
  ce->add_call_info_here(info());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
  ce->verify_oop_map(info());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
  __ set((intptr_t)&Runtime1::_arraycopy_slowcase_cnt, O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
  __ ld(O0, 0, O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
  __ inc(O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
  __ st(O1, 0, O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
  __ br(Assembler::always, false, Assembler::pt, _continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
  __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   417
///////////////////////////////////////////////////////////////////////////////////
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   418
#ifndef SERIALGC
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   419
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   420
void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   421
  __ bind(_entry);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   422
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   423
  assert(pre_val()->is_register(), "Precondition.");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   424
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   425
  Register pre_val_reg = pre_val()->as_register();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   426
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   427
  ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   428
  __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   429
                    pre_val_reg, _continuation);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   430
  __ delayed()->nop();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   431
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   432
  __ 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
   433
  __ delayed()->mov(pre_val_reg, G4);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   434
  __ br(Assembler::always, false, Assembler::pt, _continuation);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   435
  __ delayed()->nop();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   436
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   437
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   438
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   439
jbyte* G1PostBarrierStub::_byte_map_base = NULL;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   440
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   441
jbyte* G1PostBarrierStub::byte_map_base_slow() {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   442
  BarrierSet* bs = Universe::heap()->barrier_set();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   443
  assert(bs->is_a(BarrierSet::G1SATBCTLogging),
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   444
         "Must be if we're using this.");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   445
  return ((G1SATBCardTableModRefBS*)bs)->byte_map_base;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   446
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   447
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   448
void G1PostBarrierStub::emit_code(LIR_Assembler* ce) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   449
  __ bind(_entry);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   450
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   451
  assert(addr()->is_register(), "Precondition.");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   452
  assert(new_val()->is_register(), "Precondition.");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   453
  Register addr_reg = addr()->as_pointer_register();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   454
  Register new_val_reg = new_val()->as_register();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   455
  __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   456
                    new_val_reg, _continuation);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   457
  __ delayed()->nop();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   458
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   459
  __ 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
   460
  __ delayed()->mov(addr_reg, G4);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   461
  __ br(Assembler::always, false, Assembler::pt, _continuation);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   462
  __ delayed()->nop();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   463
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   464
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   465
#endif // SERIALGC
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   466
///////////////////////////////////////////////////////////////////////////////////
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   467
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
#undef __