hotspot/src/share/vm/c1/c1_CodeStubs.hpp
author johnc
Thu, 07 Apr 2011 09:53:20 -0700
changeset 9176 42d9d1010f38
parent 8067 f5f4eac4c48f
child 13486 4f0635e148c1
permissions -rw-r--r--
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error Summary: A referent object that is only weakly reachable at the start of concurrent marking but is re-attached to the strongly reachable object graph during marking may not be marked as live. This can cause the reference object to be processed prematurely and leave dangling pointers to the referent object. Implement a read barrier for the java.lang.ref.Reference::referent field by intrinsifying the Reference.get() method, and intercepting accesses though JNI, reflection, and Unsafe, so that when a non-null referent object is read it is also logged in an SATB buffer. Reviewed-by: kvn, iveresov, never, tonyp, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
8067
f5f4eac4c48f 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 7397
diff changeset
     2
 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    25
#ifndef SHARE_VM_C1_C1_CODESTUBS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    26
#define SHARE_VM_C1_C1_CODESTUBS_HPP
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"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    33
#include "utilities/array.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    34
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class CodeEmitInfo;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class LIR_Assembler;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class LIR_OpVisitState;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// CodeStubs are little 'out-of-line' pieces of code that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// usually handle slow cases of operations. All code stubs
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// are collected and code is emitted at the end of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// nmethod.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
class CodeStub: public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  Label _entry;                                  // label at the stub entry point
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  Label _continuation;                           // label where stub continues, if any
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  CodeStub() {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  // code generation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  void assert_no_unbound_labels()                { assert(!_entry.is_unbound() && !_continuation.is_unbound(), "unbound label"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  virtual void emit_code(LIR_Assembler* e) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  virtual CodeEmitInfo* info() const             { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  virtual bool is_exception_throw_stub() const   { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  virtual bool is_range_check_stub() const       { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  virtual bool is_divbyzero_stub() const         { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  virtual void print_name(outputStream* out) const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  // label access
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  Label* entry()                                 { return &_entry; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  Label* continuation()                          { return &_continuation; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // for LIR
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  virtual void visit(LIR_OpVisitState* visit) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    if (LIRTracePeephole && Verbose) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
      tty->print("no visitor for ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
      print_name(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
      tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
define_array(CodeStubArray, CodeStub*)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
define_stack(_CodeStubList, CodeStubArray)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
class CodeStubList: public _CodeStubList {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  CodeStubList(): _CodeStubList() {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  void append(CodeStub* stub) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    if (!contains(stub)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
      _CodeStubList::append(stub);
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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
class CounterOverflowStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  int           _bci;
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
    97
  LIR_Opr       _method;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
public:
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   100
  CounterOverflowStub(CodeEmitInfo* info, int bci, LIR_Opr method) :  _info(info), _bci(bci), _method(method) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    visitor->do_slow_case(_info);
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   107
    visitor->do_input(_method);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  virtual void print_name(outputStream* out) const { out->print("CounterOverflowStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
class ConversionStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  Bytecodes::Code _bytecode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  LIR_Opr         _input;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  LIR_Opr         _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  static float float_zero;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  static double double_zero;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  ConversionStub(Bytecodes::Code bytecode, LIR_Opr input, LIR_Opr result)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    : _bytecode(bytecode), _input(input), _result(result) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  Bytecodes::Code bytecode() { return _bytecode; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  LIR_Opr         input()    { return _input; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  LIR_Opr         result()   { return _result; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    visitor->do_slow_case();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    visitor->do_input(_input);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    visitor->do_output(_result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  virtual void print_name(outputStream* out) const { out->print("ConversionStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
// Throws ArrayIndexOutOfBoundsException by default but can be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
// configured to throw IndexOutOfBoundsException in constructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
class RangeCheckStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  LIR_Opr       _index;
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:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, bool throw_index_out_of_bounds_exception = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  virtual bool is_exception_throw_stub() const   { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  virtual bool is_range_check_stub() const       { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    visitor->do_input(_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  virtual void print_name(outputStream* out) const { out->print("RangeCheckStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
#endif // PRODUCT
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
class DivByZeroStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  int           _offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  DivByZeroStub(CodeEmitInfo* info)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    : _info(info), _offset(-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  DivByZeroStub(int offset, CodeEmitInfo* info)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    : _info(info), _offset(offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  virtual bool is_exception_throw_stub() const   { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  virtual bool is_divbyzero_stub() const         { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  virtual void print_name(outputStream* out) const { out->print("DivByZeroStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
class ImplicitNullCheckStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  int           _offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  ImplicitNullCheckStub(int offset, CodeEmitInfo* info)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    : _offset(offset), _info(info) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  virtual bool is_exception_throw_stub() const   { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  virtual void print_name(outputStream* out) const { out->print("ImplicitNullCheckStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
class NewInstanceStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  ciInstanceKlass* _klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  LIR_Opr          _klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  LIR_Opr          _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  CodeEmitInfo*    _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  Runtime1::StubID _stub_id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    visitor->do_input(_klass_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    visitor->do_output(_result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  virtual void print_name(outputStream* out) const { out->print("NewInstanceStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
class NewTypeArrayStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  LIR_Opr       _klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  LIR_Opr       _length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  LIR_Opr       _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
    visitor->do_input(_klass_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    visitor->do_input(_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
    assert(_result->is_valid(), "must be valid"); visitor->do_output(_result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  virtual void print_name(outputStream* out) const { out->print("NewTypeArrayStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
class NewObjectArrayStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  LIR_Opr        _klass_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  LIR_Opr        _length;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  LIR_Opr        _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  CodeEmitInfo*  _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
    visitor->do_input(_klass_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
    visitor->do_input(_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
    assert(_result->is_valid(), "must be valid"); visitor->do_output(_result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  virtual void print_name(outputStream* out) const { out->print("NewObjectArrayStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
class MonitorAccessStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  LIR_Opr _obj_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  LIR_Opr _lock_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  MonitorAccessStub(LIR_Opr obj_reg, LIR_Opr lock_reg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
    _obj_reg  = obj_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
    _lock_reg  = lock_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  virtual void print_name(outputStream* out) const { out->print("MonitorAccessStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
#endif // PRODUCT
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
class MonitorEnterStub: public MonitorAccessStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
    visitor->do_input(_obj_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
    visitor->do_input(_lock_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
    visitor->do_slow_case(_info);
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("MonitorEnterStub"); }
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 MonitorExitStub: public MonitorAccessStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  bool _compute_lock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  int  _monitor_ix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  MonitorExitStub(LIR_Opr lock_reg, bool compute_lock, int monitor_ix)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
    : MonitorAccessStub(LIR_OprFact::illegalOpr, lock_reg),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
      _compute_lock(compute_lock), _monitor_ix(monitor_ix) { }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
    assert(_obj_reg->is_illegal(), "unused");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
    if (_compute_lock) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
      visitor->do_temp(_lock_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
      visitor->do_input(_lock_reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  virtual void print_name(outputStream* out) const { out->print("MonitorExitStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
class PatchingStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  enum PatchID {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
    access_field_id,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
    load_klass_id
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  enum constants {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
    patch_info_size = 3
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  PatchID       _id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  address       _pc_start;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  int           _bytes_to_copy;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  Label         _patched_code_entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
  Label         _patch_site_entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  Label         _patch_site_continuation;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  Register      _obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  int           _oop_index;  // index of the patchable oop in nmethod oop table if needed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  static int    _patch_info_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  void align_patch_site(MacroAssembler* masm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  static int patch_info_offset() { return _patch_info_offset; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  PatchingStub(MacroAssembler* masm, PatchID id, int oop_index = -1):
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
      _id(id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
    , _info(NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
    , _oop_index(oop_index) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    if (os::is_MP()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
      // force alignment of patch sites on MP hardware so we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
      // can guarantee atomic writes to the patch site.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
      align_patch_site(masm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
    _pc_start = masm->pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    masm->bind(_patch_site_entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  void install(MacroAssembler* masm, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
    _info = info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    _obj = obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
    masm->bind(_patch_site_continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
    _bytes_to_copy = masm->pc() - pc_start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
    if (_id == PatchingStub::access_field_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
      // embed a fixed offset to handle long patches which need to be offset by a word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
      // the patching code will just add the field offset field to this offset so
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
      // that we can refernce either the high or low word of a double word field.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
      int field_offset = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
      switch (patch_code) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
      case lir_patch_low:         field_offset = lo_word_offset_in_bytes; break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
      case lir_patch_high:        field_offset = hi_word_offset_in_bytes; break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
      case lir_patch_normal:      field_offset = 0;                       break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
      default: ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
      NativeMovRegMem* n_move = nativeMovRegMem_at(pc_start());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
      n_move->set_offset(field_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
    } else if (_id == load_klass_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
      assert(_obj != noreg, "must have register object for load_klass");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
      // verify that we're pointing at a NativeMovConstReg
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
      nativeMovConstReg_at(pc_start());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
      ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    assert(_bytes_to_copy <= (masm->pc() - pc_start()), "not enough bytes");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
  address pc_start() const                       { return _pc_start; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
  PatchID id() const                             { return _id; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
  virtual void print_name(outputStream* out) const { out->print("PatchingStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
5046
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   428
//------------------------------------------------------------------------------
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   429
// DeoptimizeStub
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   430
//
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   431
class DeoptimizeStub : public CodeStub {
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   432
private:
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   433
  CodeEmitInfo* _info;
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   434
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   435
public:
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   436
  DeoptimizeStub(CodeEmitInfo* info) : _info(new CodeEmitInfo(info)) {}
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   437
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   438
  virtual void emit_code(LIR_Assembler* e);
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   439
  virtual CodeEmitInfo* info() const           { return _info; }
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   440
  virtual bool is_exception_throw_stub() const { return true; }
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   441
  virtual void visit(LIR_OpVisitState* visitor) {
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   442
    visitor->do_slow_case(_info);
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   443
  }
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   444
#ifndef PRODUCT
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   445
  virtual void print_name(outputStream* out) const { out->print("DeoptimizeStub"); }
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   446
#endif // PRODUCT
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   447
};
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   448
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 1374
diff changeset
   449
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
class SimpleExceptionStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
  LIR_Opr          _obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
  Runtime1::StubID _stub;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
  CodeEmitInfo*    _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
  SimpleExceptionStub(Runtime1::StubID stub, LIR_Opr obj, CodeEmitInfo* info):
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
    _obj(obj), _info(info), _stub(stub) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   461
  void set_obj(LIR_Opr obj) {
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   462
    _obj = obj;
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   463
  }
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   464
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
  virtual CodeEmitInfo* info() const             { return _info; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
  virtual bool is_exception_throw_stub() const   { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
    if (_obj->is_valid()) visitor->do_input(_obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
    visitor->do_slow_case(_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
  virtual void print_name(outputStream* out) const { out->print("SimpleExceptionStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
8067
f5f4eac4c48f 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 7397
diff changeset
   479
class ArrayStoreExceptionStub: public SimpleExceptionStub {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
  CodeEmitInfo* _info;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
 public:
8067
f5f4eac4c48f 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 7397
diff changeset
   484
  ArrayStoreExceptionStub(LIR_Opr obj, CodeEmitInfo* info): SimpleExceptionStub(Runtime1::throw_array_store_exception_id, obj, info) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
  virtual void print_name(outputStream* out) const { out->print("ArrayStoreExceptionStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
class ArrayCopyStub: public CodeStub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
  LIR_OpArrayCopy* _op;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
  ArrayCopyStub(LIR_OpArrayCopy* op): _op(op) { }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
  LIR_Opr src() const                         { return _op->src(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
  LIR_Opr src_pos() const                     { return _op->src_pos(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
  LIR_Opr dst() const                         { return _op->dst(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
  LIR_Opr dst_pos() const                     { return _op->dst_pos(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
  LIR_Opr length() const                      { return _op->length(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
  LIR_Opr tmp() const                         { return _op->tmp(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
  virtual void emit_code(LIR_Assembler* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
  virtual CodeEmitInfo* info() const          { return _op->info(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
  virtual void visit(LIR_OpVisitState* visitor) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
    // don't pass in the code emit info since it's processed in the fast path
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
    visitor->do_slow_case();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
  virtual void print_name(outputStream* out) const { out->print("ArrayCopyStub"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
};
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   515
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   516
//////////////////////////////////////////////////////////////////////////////////////////
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   517
#ifndef SERIALGC
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   518
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   519
// Code stubs for Garbage-First barriers.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   520
class G1PreBarrierStub: public CodeStub {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   521
 private:
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   522
  bool _do_load;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   523
  LIR_Opr _addr;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   524
  LIR_Opr _pre_val;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   525
  LIR_PatchCode _patch_code;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   526
  CodeEmitInfo* _info;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   527
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   528
 public:
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   529
  // Version that _does_ generate a load of the previous value from addr.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   530
  // addr (the address of the field to be read) must be a LIR_Address
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   531
  // pre_val (a temporary register) must be a register;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   532
  G1PreBarrierStub(LIR_Opr addr, LIR_Opr pre_val, LIR_PatchCode patch_code, CodeEmitInfo* info) :
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   533
    _addr(addr), _pre_val(pre_val), _do_load(true),
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   534
    _patch_code(patch_code), _info(info)
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   535
  {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   536
    assert(_pre_val->is_register(), "should be temporary register");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   537
    assert(_addr->is_address(), "should be the address of the field");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   538
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   539
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   540
  // Version that _does not_ generate load of the previous value; the
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   541
  // previous value is assumed to have already been loaded into pre_val.
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   542
  G1PreBarrierStub(LIR_Opr pre_val) :
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   543
    _addr(LIR_OprFact::illegalOpr), _pre_val(pre_val), _do_load(false),
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   544
    _patch_code(lir_patch_none), _info(NULL)
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   545
  {
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   546
    assert(_pre_val->is_register(), "should be a register");
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   547
  }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   548
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   549
  LIR_Opr addr() const { return _addr; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   550
  LIR_Opr pre_val() const { return _pre_val; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   551
  LIR_PatchCode patch_code() const { return _patch_code; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   552
  CodeEmitInfo* info() const { return _info; }
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   553
  bool do_load() const { return _do_load; }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   554
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   555
  virtual void emit_code(LIR_Assembler* e);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   556
  virtual void visit(LIR_OpVisitState* visitor) {
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   557
    if (_do_load) {
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   558
      // don't pass in the code emit info since it's processed in the fast
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   559
      // path
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   560
      if (_info != NULL)
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   561
        visitor->do_slow_case(_info);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   562
      else
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   563
        visitor->do_slow_case();
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   564
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   565
      visitor->do_input(_addr);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   566
      visitor->do_temp(_pre_val);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   567
    } else {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   568
      visitor->do_slow_case();
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   569
      visitor->do_input(_pre_val);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   570
    }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   571
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   572
#ifndef PRODUCT
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   573
  virtual void print_name(outputStream* out) const { out->print("G1PreBarrierStub"); }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   574
#endif // PRODUCT
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   575
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   576
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   577
// This G1 barrier code stub is used in Unsafe.getObject.
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   578
// It generates a sequence of guards around the SATB
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   579
// barrier code that are used to detect when we have
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   580
// the referent field of a Reference object.
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   581
// The first check is assumed to have been generated
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   582
// in the code generated for Unsafe.getObject().
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   583
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   584
class G1UnsafeGetObjSATBBarrierStub: public CodeStub {
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   585
 private:
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   586
  LIR_Opr _val;
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   587
  LIR_Opr _src;
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   588
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   589
  LIR_Opr _tmp;
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   590
  LIR_Opr _thread;
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   591
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   592
  bool _gen_src_check;
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   593
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   594
 public:
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   595
  // A G1 barrier that is guarded by generated guards that determine whether
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   596
  // val (which is the result of Unsafe.getObject() should be recorded in an
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   597
  // SATB log buffer. We could be reading the referent field of a Reference object
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   598
  // using Unsafe.getObject() and we need to record the referent.
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   599
  //
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   600
  // * val is the operand returned by the unsafe.getObject routine.
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   601
  // * src is the base object
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   602
  // * tmp is a temp used to load the klass of src, and then reference type
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   603
  // * thread is the thread object.
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   604
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   605
  G1UnsafeGetObjSATBBarrierStub(LIR_Opr val, LIR_Opr src,
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   606
                                LIR_Opr tmp, LIR_Opr thread,
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   607
                                bool gen_src_check) :
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   608
    _val(val), _src(src),
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   609
    _tmp(tmp), _thread(thread),
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   610
    _gen_src_check(gen_src_check)
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   611
  {
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   612
    assert(_val->is_register(), "should have already been loaded");
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   613
    assert(_src->is_register(), "should have already been loaded");
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   614
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   615
    assert(_tmp->is_register(), "should be a temporary register");
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   616
  }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   617
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   618
  LIR_Opr val() const { return _val; }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   619
  LIR_Opr src() const { return _src; }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   620
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   621
  LIR_Opr tmp() const { return _tmp; }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   622
  LIR_Opr thread() const { return _thread; }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   623
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   624
  bool gen_src_check() const { return _gen_src_check; }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   625
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   626
  virtual void emit_code(LIR_Assembler* e);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   627
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   628
  virtual void visit(LIR_OpVisitState* visitor) {
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   629
    visitor->do_slow_case();
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   630
    visitor->do_input(_val);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   631
    visitor->do_input(_src);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   632
    visitor->do_input(_thread);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   633
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   634
    visitor->do_temp(_tmp);
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   635
  }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   636
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   637
#ifndef PRODUCT
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   638
  virtual void print_name(outputStream* out) const { out->print("G1UnsafeGetObjSATBBarrierStub"); }
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   639
#endif // PRODUCT
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   640
};
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8067
diff changeset
   641
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   642
class G1PostBarrierStub: public CodeStub {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   643
 private:
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   644
  LIR_Opr _addr;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   645
  LIR_Opr _new_val;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   646
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   647
  static jbyte* _byte_map_base;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   648
  static jbyte* byte_map_base_slow();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   649
  static jbyte* byte_map_base() {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   650
    if (_byte_map_base == NULL) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   651
      _byte_map_base = byte_map_base_slow();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   652
    }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   653
    return _byte_map_base;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   654
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   655
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   656
 public:
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   657
  // addr (the address of the object head) and new_val must be registers.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   658
  G1PostBarrierStub(LIR_Opr addr, LIR_Opr new_val): _addr(addr), _new_val(new_val) { }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   659
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   660
  LIR_Opr addr() const { return _addr; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   661
  LIR_Opr new_val() const { return _new_val; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   662
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   663
  virtual void emit_code(LIR_Assembler* e);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   664
  virtual void visit(LIR_OpVisitState* visitor) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   665
    // don't pass in the code emit info since it's processed in the fast path
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   666
    visitor->do_slow_case();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   667
    visitor->do_input(_addr);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   668
    visitor->do_input(_new_val);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   669
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   670
#ifndef PRODUCT
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   671
  virtual void print_name(outputStream* out) const { out->print("G1PostBarrierStub"); }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   672
#endif // PRODUCT
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   673
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   674
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   675
#endif // SERIALGC
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   676
//////////////////////////////////////////////////////////////////////////////////////////
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
   677
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
   678
#endif // SHARE_VM_C1_C1_CODESTUBS_HPP