src/hotspot/share/c1/c1_CodeStubs.hpp
author mdoerr
Tue, 05 Nov 2019 11:53:46 +0100
changeset 58932 8623f75be895
parent 53244 9807daeb47c4
permissions -rw-r--r--
8233081: C1: PatchingStub for field access copies too much Reviewed-by: thartmann, dlong
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51996
diff changeset
     2
 * Copyright (c) 1999, 2019, 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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51996
diff changeset
    25
#ifndef SHARE_C1_C1_CODESTUBS_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51996
diff changeset
    26
#define SHARE_C1_C1_CODESTUBS_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    28
#include "c1/c1_FrameMap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    29
#include "c1/c1_IR.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    30
#include "c1/c1_Instruction.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    31
#include "c1/c1_LIR.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    32
#include "c1/c1_Runtime1.hpp"
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 24442
diff changeset
    33
#include "code/nativeInst.hpp"
46448
b5350a83520b 8153646: Move vm/utilities/array.hpp to vm/oops
hseigel
parents: 38031
diff changeset
    34
#include "utilities/growableArray.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13728
diff changeset
    35
#include "utilities/macros.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    36
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class CodeEmitInfo;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class LIR_Assembler;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class LIR_OpVisitState;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// CodeStubs are little 'out-of-line' pieces of code that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// usually handle slow cases of operations. All code stubs
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// are collected and code is emitted at the end of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// nmethod.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
class CodeStub: public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  Label _entry;                                  // label at the stub entry point
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  Label _continuation;                           // label where stub continues, if any
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  CodeStub() {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  // code generation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  void assert_no_unbound_labels()                { assert(!_entry.is_unbound() && !_continuation.is_unbound(), "unbound label"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  virtual void emit_code(LIR_Assembler* e) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  virtual CodeEmitInfo* info() const             { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  virtual bool is_exception_throw_stub() const   { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  virtual bool is_range_check_stub() const       { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  virtual bool is_divbyzero_stub() const         { return false; }
44738
11431bbc9549 8168699: Validate special case invocations
coleenp
parents: 38031
diff changeset
    61
  virtual bool is_simple_exception_stub() const  { return false; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  virtual void print_name(outputStream* out) const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // label access
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  Label* entry()                                 { return &_entry; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  Label* continuation()                          { return &_continuation; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  // for LIR
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  virtual void visit(LIR_OpVisitState* visit) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    if (LIRTracePeephole && Verbose) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
      tty->print("no visitor for ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      print_name(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
      tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
38031
e0b822facc03 8149374: Replace C1-specific collection classes with universal collection classes
fzhinkin
parents: 28637
diff changeset
    81
class CodeStubList: public GrowableArray<CodeStub*> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
 public:
38031
e0b822facc03 8149374: Replace C1-specific collection classes with universal collection classes
fzhinkin
parents: 28637
diff changeset
    83
  CodeStubList(): GrowableArray<CodeStub*>() {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  void append(CodeStub* stub) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    if (!contains(stub)) {
38031
e0b822facc03 8149374: Replace C1-specific collection classes with universal collection classes
fzhinkin
parents: 28637
diff changeset
    87
      GrowableArray<CodeStub*>::append(stub);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
class CounterOverflowStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  int           _bci;
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
    96
  LIR_Opr       _method;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
public:
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
    99
  CounterOverflowStub(CodeEmitInfo* info, int bci, LIR_Opr method) :  _info(info), _bci(bci), _method(method) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    visitor->do_slow_case(_info);
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   106
    visitor->do_input(_method);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  virtual void print_name(outputStream* out) const { out->print("CounterOverflowStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
class ConversionStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  Bytecodes::Code _bytecode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  LIR_Opr         _input;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  LIR_Opr         _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  static float float_zero;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  static double double_zero;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  ConversionStub(Bytecodes::Code bytecode, LIR_Opr input, LIR_Opr result)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    : _bytecode(bytecode), _input(input), _result(result) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  Bytecodes::Code bytecode() { return _bytecode; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  LIR_Opr         input()    { return _input; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  LIR_Opr         result()   { return _result; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    visitor->do_slow_case();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    visitor->do_input(_input);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    visitor->do_output(_result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  virtual void print_name(outputStream* out) const { out->print("ConversionStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
// Throws ArrayIndexOutOfBoundsException by default but can be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
// configured to throw IndexOutOfBoundsException in constructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
class RangeCheckStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  LIR_Opr       _index;
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
   150
  LIR_Opr       _array;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  bool          _throw_index_out_of_bounds_exception;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
 public:
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
   154
  // For ArrayIndexOutOfBoundsException.
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
   155
  RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array);
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
   156
  // For IndexOutOfBoundsException.
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
   157
  RangeCheckStub(CodeEmitInfo* info, LIR_Opr index);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  virtual bool is_exception_throw_stub() const   { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  virtual bool is_range_check_stub() const       { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    visitor->do_input(_index);
50094
2f79462aab9b 8201593: Print array length in ArrayIndexOutOfBoundsException.
goetz
parents: 49906
diff changeset
   165
    if (_array) { visitor->do_input(_array); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  virtual void print_name(outputStream* out) const { out->print("RangeCheckStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   172
// stub used when predicate fails and deoptimization is needed
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   173
class PredicateFailedStub: public CodeStub {
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   174
 private:
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   175
  CodeEmitInfo* _info;
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   176
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   177
 public:
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   178
  PredicateFailedStub(CodeEmitInfo* info);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   179
  virtual void emit_code(LIR_Assembler* e);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   180
  virtual CodeEmitInfo* info() const             { return _info; }
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   181
  virtual void visit(LIR_OpVisitState* visitor) {
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   182
    visitor->do_slow_case(_info);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   183
  }
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   184
#ifndef PRODUCT
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   185
  virtual void print_name(outputStream* out) const { out->print("PredicateFailedStub"); }
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   186
#endif // PRODUCT
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
   187
};
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
class DivByZeroStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  int           _offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  DivByZeroStub(CodeEmitInfo* info)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    : _info(info), _offset(-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  DivByZeroStub(int offset, CodeEmitInfo* info)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
    : _info(info), _offset(offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  virtual bool is_exception_throw_stub() const   { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  virtual bool is_divbyzero_stub() const         { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  virtual void print_name(outputStream* out) const { out->print("DivByZeroStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
#endif // PRODUCT
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
class ImplicitNullCheckStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  int           _offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  ImplicitNullCheckStub(int offset, CodeEmitInfo* info)
51333
f6641fcf7b7e 8208670: Compiler changes to allow enabling -Wreorder
tschatzl
parents: 50094
diff changeset
   221
    : _info(info), _offset(offset) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  virtual bool is_exception_throw_stub() const   { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  virtual void print_name(outputStream* out) const { out->print("ImplicitNullCheckStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
class NewInstanceStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  ciInstanceKlass* _klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  LIR_Opr          _klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  LIR_Opr          _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  CodeEmitInfo*    _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  Runtime1::StubID _stub_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    visitor->do_input(_klass_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
    visitor->do_output(_result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  virtual void print_name(outputStream* out) const { out->print("NewInstanceStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
class NewTypeArrayStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  LIR_Opr       _klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  LIR_Opr       _length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  LIR_Opr       _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
    visitor->do_input(_klass_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
    visitor->do_input(_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
    assert(_result->is_valid(), "must be valid"); visitor->do_output(_result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  virtual void print_name(outputStream* out) const { out->print("NewTypeArrayStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
class NewObjectArrayStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  LIR_Opr        _klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  LIR_Opr        _length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  LIR_Opr        _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  CodeEmitInfo*  _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
    visitor->do_input(_klass_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
    visitor->do_input(_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    assert(_result->is_valid(), "must be valid"); visitor->do_output(_result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  virtual void print_name(outputStream* out) const { out->print("NewObjectArrayStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
class MonitorAccessStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  LIR_Opr _obj_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  LIR_Opr _lock_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  MonitorAccessStub(LIR_Opr obj_reg, LIR_Opr lock_reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
    _obj_reg  = obj_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
    _lock_reg  = lock_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  virtual void print_name(outputStream* out) const { out->print("MonitorAccessStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
class MonitorEnterStub: public MonitorAccessStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
    visitor->do_input(_obj_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
    visitor->do_input(_lock_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  virtual void print_name(outputStream* out) const { out->print("MonitorEnterStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
class MonitorExitStub: public MonitorAccessStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  bool _compute_lock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  int  _monitor_ix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  MonitorExitStub(LIR_Opr lock_reg, bool compute_lock, int monitor_ix)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
    : MonitorAccessStub(LIR_OprFact::illegalOpr, lock_reg),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
      _compute_lock(compute_lock), _monitor_ix(monitor_ix) { }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
    assert(_obj_reg->is_illegal(), "unused");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
    if (_compute_lock) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
      visitor->do_temp(_lock_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
      visitor->do_input(_lock_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  virtual void print_name(outputStream* out) const { out->print("MonitorExitStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
class PatchingStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
  enum PatchID {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
    access_field_id,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   369
    load_klass_id,
19710
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 16611
diff changeset
   370
    load_mirror_id,
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 16611
diff changeset
   371
    load_appendix_id
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
  enum constants {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
    patch_info_size = 3
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  PatchID       _id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  address       _pc_start;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
  int           _bytes_to_copy;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  Label         _patched_code_entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
  Label         _patch_site_entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  Label         _patch_site_continuation;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  Register      _obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  CodeEmitInfo* _info;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   385
  int           _index;  // index of the patchable oop or Klass* in nmethod oop or metadata table if needed
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  static int    _patch_info_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
  void align_patch_site(MacroAssembler* masm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  static int patch_info_offset() { return _patch_info_offset; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   393
  PatchingStub(MacroAssembler* masm, PatchID id, int index = -1):
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
      _id(id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
    , _info(NULL)
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13486
diff changeset
   396
    , _index(index) {
51996
84743156e780 8188764: Obsolete AssumeMP and then remove all support for non-MP builds
dholmes
parents: 51333
diff changeset
   397
    // force alignment of patch sites so we
84743156e780 8188764: Obsolete AssumeMP and then remove all support for non-MP builds
dholmes
parents: 51333
diff changeset
   398
    // can guarantee atomic writes to the patch site.
84743156e780 8188764: Obsolete AssumeMP and then remove all support for non-MP builds
dholmes
parents: 51333
diff changeset
   399
    align_patch_site(masm);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
    _pc_start = masm->pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
    masm->bind(_patch_site_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
  void install(MacroAssembler* masm, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
    _info = info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
    _obj = obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
    masm->bind(_patch_site_continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
    _bytes_to_copy = masm->pc() - pc_start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
    if (_id == PatchingStub::access_field_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
      // embed a fixed offset to handle long patches which need to be offset by a word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
      // the patching code will just add the field offset field to this offset so
58932
8623f75be895 8233081: C1: PatchingStub for field access copies too much
mdoerr
parents: 53244
diff changeset
   412
      // that we can reference either the high or low word of a double word field.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
      int field_offset = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
      switch (patch_code) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
      case lir_patch_low:         field_offset = lo_word_offset_in_bytes; break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
      case lir_patch_high:        field_offset = hi_word_offset_in_bytes; break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
      case lir_patch_normal:      field_offset = 0;                       break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
      default: ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
      NativeMovRegMem* n_move = nativeMovRegMem_at(pc_start());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
      n_move->set_offset(field_offset);
58932
8623f75be895 8233081: C1: PatchingStub for field access copies too much
mdoerr
parents: 53244
diff changeset
   422
      // Copy will never get executed, so only copy the part which is required for patching.
8623f75be895 8233081: C1: PatchingStub for field access copies too much
mdoerr
parents: 53244
diff changeset
   423
      _bytes_to_copy = MAX2(n_move->num_bytes_to_end_of_patch(), (int)NativeGeneralJump::instruction_size);
19710
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 16611
diff changeset
   424
    } else if (_id == load_klass_id || _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
   425
      assert(_obj != noreg, "must have register object for load_klass/load_mirror");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
      // verify that we're pointing at a NativeMovConstReg
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
      nativeMovConstReg_at(pc_start());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
      ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
    assert(_bytes_to_copy <= (masm->pc() - pc_start()), "not enough bytes");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  address pc_start() const                       { return _pc_start; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
  PatchID id() const                             { return _id; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
  virtual void print_name(outputStream* out) const { out->print("PatchingStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
5046
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   450
//------------------------------------------------------------------------------
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   451
// DeoptimizeStub
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   452
//
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   453
class DeoptimizeStub : public CodeStub {
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   454
private:
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   455
  CodeEmitInfo* _info;
24442
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 22234
diff changeset
   456
  jint _trap_request;
5046
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   457
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   458
public:
24442
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 22234
diff changeset
   459
  DeoptimizeStub(CodeEmitInfo* info, Deoptimization::DeoptReason reason, Deoptimization::DeoptAction action) :
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 22234
diff changeset
   460
    _info(new CodeEmitInfo(info)), _trap_request(Deoptimization::make_trap_request(reason, action)) {}
5046
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   461
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   462
  virtual void emit_code(LIR_Assembler* e);
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   463
  virtual CodeEmitInfo* info() const           { return _info; }
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   464
  virtual bool is_exception_throw_stub() const { return true; }
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   465
  virtual void visit(LIR_OpVisitState* visitor) {
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   466
    visitor->do_slow_case(_info);
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   467
  }
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   468
#ifndef PRODUCT
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   469
  virtual void print_name(outputStream* out) const { out->print("DeoptimizeStub"); }
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   470
#endif // PRODUCT
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   471
};
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   472
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   473
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
class SimpleExceptionStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
  LIR_Opr          _obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
  Runtime1::StubID _stub;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
  CodeEmitInfo*    _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
  SimpleExceptionStub(Runtime1::StubID stub, LIR_Opr obj, CodeEmitInfo* info):
51333
f6641fcf7b7e 8208670: Compiler changes to allow enabling -Wreorder
tschatzl
parents: 50094
diff changeset
   482
    _obj(obj), _stub(stub), _info(info) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   485
  void set_obj(LIR_Opr obj) {
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   486
    _obj = obj;
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   487
  }
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   488
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
  virtual bool is_exception_throw_stub() const   { return true; }
44738
11431bbc9549 8168699: Validate special case invocations
coleenp
parents: 38031
diff changeset
   492
  virtual bool is_simple_exception_stub() const  { return true; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
    if (_obj->is_valid()) visitor->do_input(_obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
  virtual void print_name(outputStream* out) const { out->print("SimpleExceptionStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
8067
f5f4eac4c48f 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 7397
diff changeset
   504
class ArrayStoreExceptionStub: public SimpleExceptionStub {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
 public:
8067
f5f4eac4c48f 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 7397
diff changeset
   509
  ArrayStoreExceptionStub(LIR_Opr obj, CodeEmitInfo* info): SimpleExceptionStub(Runtime1::throw_array_store_exception_id, obj, info) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
  virtual void print_name(outputStream* out) const { out->print("ArrayStoreExceptionStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
class ArrayCopyStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
  LIR_OpArrayCopy* _op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
  ArrayCopyStub(LIR_OpArrayCopy* op): _op(op) { }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
  LIR_Opr src() const                         { return _op->src(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
  LIR_Opr src_pos() const                     { return _op->src_pos(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
  LIR_Opr dst() const                         { return _op->dst(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
  LIR_Opr dst_pos() const                     { return _op->dst_pos(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
  LIR_Opr length() const                      { return _op->length(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
  LIR_Opr tmp() const                         { return _op->tmp(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
  virtual CodeEmitInfo* info() const          { return _op->info(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
    // don't pass in the code emit info since it's processed in the fast path
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
    visitor->do_slow_case();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
  virtual void print_name(outputStream* out) const { out->print("ArrayCopyStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
};
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   540
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51996
diff changeset
   541
#endif // SHARE_C1_C1_CODESTUBS_HPP