src/hotspot/share/c1/c1_LIRGenerator.hpp
author vlivanov
Tue, 03 Sep 2019 17:45:02 +0300
changeset 57996 bf3fb5465543
parent 54125 70a818b1d9db
permissions -rw-r--r--
8227236: assert(singleton != __null && singleton != declared_interface) failed Reviewed-by: 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: 51487
diff changeset
     2
 * Copyright (c) 2005, 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: 1374
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
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: 1374
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: 51487
diff changeset
    25
#ifndef SHARE_C1_C1_LIRGENERATOR_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51487
diff changeset
    26
#define SHARE_C1_C1_LIRGENERATOR_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    27
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
    28
#include "c1/c1_Decorators.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    29
#include "c1/c1_Instruction.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    30
#include "c1/c1_LIR.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    31
#include "ci/ciMethodData.hpp"
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
    32
#include "gc/shared/barrierSet.hpp"
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49938
diff changeset
    33
#include "jfr/support/jfrIntrinsics.hpp"
42063
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 42037
diff changeset
    34
#include "utilities/macros.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    35
#include "utilities/sizes.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    36
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
    37
class BarrierSetC1;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
    38
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// The classes responsible for code emission and register allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
class LIRGenerator;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
class LIREmitter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
class Invoke;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
class SwitchRange;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
class LIRItem;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
38031
e0b822facc03 8149374: Replace C1-specific collection classes with universal collection classes
fzhinkin
parents: 36559
diff changeset
    48
typedef GrowableArray<LIRItem*> LIRItemList;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
class SwitchRange: public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  int _low_key;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  int _high_key;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  BlockBegin* _sux;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  SwitchRange(int start_key, BlockBegin* sux): _low_key(start_key), _high_key(start_key), _sux(sux) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  void set_high_key(int key) { _high_key = key; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  int high_key() const { return _high_key; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  int low_key() const { return _low_key; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  BlockBegin* sux() const { return _sux; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
38031
e0b822facc03 8149374: Replace C1-specific collection classes with universal collection classes
fzhinkin
parents: 36559
diff changeset
    64
typedef GrowableArray<SwitchRange*> SwitchRangeArray;
e0b822facc03 8149374: Replace C1-specific collection classes with universal collection classes
fzhinkin
parents: 36559
diff changeset
    65
typedef GrowableArray<SwitchRange*> SwitchRangeList;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
class ResolveNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
38031
e0b822facc03 8149374: Replace C1-specific collection classes with universal collection classes
fzhinkin
parents: 36559
diff changeset
    69
typedef GrowableArray<ResolveNode*> NodeList;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// Node objects form a directed graph of LIR_Opr
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
// Edges between Nodes represent moves from one Node to its destinations
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
class ResolveNode: public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  LIR_Opr    _operand;       // the source or destinaton
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  NodeList   _destinations;  // for the operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  bool       _assigned;      // Value assigned to this Node?
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  bool       _visited;       // Node already visited?
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  bool       _start_node;    // Start node already visited?
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  ResolveNode(LIR_Opr operand)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    : _operand(operand)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    , _assigned(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    , _visited(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    , _start_node(false) {};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  // accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  LIR_Opr operand() const           { return _operand; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  int no_of_destinations() const    { return _destinations.length(); }
38031
e0b822facc03 8149374: Replace C1-specific collection classes with universal collection classes
fzhinkin
parents: 36559
diff changeset
    91
  ResolveNode* destination_at(int i)     { return _destinations.at(i); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  bool assigned() const             { return _assigned; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  bool visited() const              { return _visited; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  bool start_node() const           { return _start_node; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  // modifiers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  void append(ResolveNode* dest)         { _destinations.append(dest); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  void set_assigned()               { _assigned = true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  void set_visited()                { _visited = true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  void set_start_node()             { _start_node = true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
// This is shared state to be used by the PhiResolver so the operand
54125
70a818b1d9db 8220502: Inefficient pre-sizing of PhiResolverState arrays in c1_LIRGenerator
redestad
parents: 53244
diff changeset
   105
// arrays don't have to be reallocated for each resolution.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
class PhiResolverState: public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  friend class PhiResolver;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  NodeList _virtual_operands; // Nodes where the operand is a virtual register
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  NodeList _other_operands;   // Nodes where the operand is not a virtual register
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  NodeList _vreg_table;       // Mapping from virtual register to Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  PhiResolverState() {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
54125
70a818b1d9db 8220502: Inefficient pre-sizing of PhiResolverState arrays in c1_LIRGenerator
redestad
parents: 53244
diff changeset
   117
  void reset();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
// class used to move value of phi operand to phi function
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
class PhiResolver: public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  LIRGenerator*     _gen;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  PhiResolverState& _state; // temporary state cached by LIRGenerator
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  ResolveNode*   _loop;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  LIR_Opr _temp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  // access to shared state arrays
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  NodeList& virtual_operands() { return _state._virtual_operands; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  NodeList& other_operands()   { return _state._other_operands;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  NodeList& vreg_table()       { return _state._vreg_table;       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  ResolveNode* create_node(LIR_Opr opr, bool source);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  ResolveNode* source_node(LIR_Opr opr)      { return create_node(opr, true); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  ResolveNode* destination_node(LIR_Opr opr) { return create_node(opr, false); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  void emit_move(LIR_Opr src, LIR_Opr dest);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  void move_to_temp(LIR_Opr src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  void move_temp_to(LIR_Opr dest);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  void move(ResolveNode* src, ResolveNode* dest);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  LIRGenerator* gen() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    return _gen;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
 public:
54125
70a818b1d9db 8220502: Inefficient pre-sizing of PhiResolverState arrays in c1_LIRGenerator
redestad
parents: 53244
diff changeset
   149
  PhiResolver(LIRGenerator* _lir_gen);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  ~PhiResolver();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  void move(LIR_Opr src, LIR_Opr dest);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
// only the classes below belong in the same file
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
class LIRGenerator: public InstructionVisitor, public BlockClosure {
33462
5f04d430d53d 8138890: C1: Ambiguous operator delete
mdoerr
parents: 33089
diff changeset
   158
 // LIRGenerator should never get instatiated on the heap.
5f04d430d53d 8138890: C1: Ambiguous operator delete
mdoerr
parents: 33089
diff changeset
   159
 private:
5f04d430d53d 8138890: C1: Ambiguous operator delete
mdoerr
parents: 33089
diff changeset
   160
  void* operator new(size_t size) throw();
5f04d430d53d 8138890: C1: Ambiguous operator delete
mdoerr
parents: 33089
diff changeset
   161
  void* operator new[](size_t size) throw();
35117
3191066d12e0 8144850: C1: operator delete needs an implementation
mdoerr
parents: 35109
diff changeset
   162
  void operator delete(void* p) { ShouldNotReachHere(); }
3191066d12e0 8144850: C1: operator delete needs an implementation
mdoerr
parents: 35109
diff changeset
   163
  void operator delete[](void* p) { ShouldNotReachHere(); }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   164
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  Compilation*  _compilation;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  ciMethod*     _method;    // method that we are compiling
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  PhiResolverState  _resolver_state;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  BlockBegin*   _block;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  int           _virtual_register_number;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  Values        _instruction_for_operand;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  BitMap2D      _vreg_flags; // flags which can be set on a per-vreg basis
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  LIR_List*     _lir;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  LIRGenerator* gen() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    return this;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
24933
c16c7a4ac386 8031994: java/lang/Character/CheckProp test times out
rbackman
parents: 24442
diff changeset
   178
  void print_if_not_loaded(const NewInstance* new_instance) PRODUCT_RETURN;
c16c7a4ac386 8031994: java/lang/Character/CheckProp test times out
rbackman
parents: 24442
diff changeset
   179
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   180
 public:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  LIR_List* lir(const char * file, int line) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    _lir->set_file_and_line(file, line);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    return _lir;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  LIR_List* lir() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    return _lir;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   191
 private:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  // a simple cache of constants used within a block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  GrowableArray<LIR_Const*>       _constants;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  LIR_OprList                     _reg_for_constants;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  Values                          _unpinned_constants;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  friend class PhiResolver;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   199
 public:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  // unified bailout support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  void bailout(const char* msg) const            { compilation()->bailout(msg); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  bool bailed_out() const                        { return compilation()->bailed_out(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  void block_do_prolog(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  void block_do_epilog(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  // register allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  LIR_Opr rlock(Value instr);                      // lock a free register
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  LIR_Opr rlock_result(Value instr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  LIR_Opr rlock_result(Value instr, BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  LIR_Opr rlock_byte(BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  LIR_Opr rlock_callee_saved(BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  // get a constant into a register and get track of what register was used
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  LIR_Opr load_constant(Constant* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  LIR_Opr load_constant(LIR_Const* constant);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   218
  // Given an immediate value, return an operand usable in logical ops.
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   219
  LIR_Opr load_immediate(int x, BasicType type);
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   220
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  void  set_result(Value x, LIR_Opr opr)           {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
    assert(opr->is_valid(), "must set to valid value");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
    assert(x->operand()->is_illegal(), "operand should never change");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
    assert(!opr->is_register() || opr->is_virtual(), "should never set result to a physical register");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    x->set_operand(opr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    assert(opr == x->operand(), "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    if (opr->is_virtual()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
      _instruction_for_operand.at_put_grow(opr->vreg_number(), x, NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  void  set_no_result(Value x)                     { assert(!x->has_uses(), "can't have use"); x->clear_operand(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  friend class LIRItem;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  LIR_Opr round_item(LIR_Opr opr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  LIR_Opr force_to_spill(LIR_Opr value, BasicType t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  PhiResolverState& resolver_state() { return _resolver_state; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  void  move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  void  move_to_phi(ValueStack* cur_state);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  // platform dependent
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  LIR_Opr getThreadPointer();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   246
 private:
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   247
  // code emission
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   248
  void do_ArithmeticOp_Long(ArithmeticOp* x);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   249
  void do_ArithmeticOp_Int (ArithmeticOp* x);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   250
  void do_ArithmeticOp_FPU (ArithmeticOp* x);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   251
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  void do_RegisterFinalizer(Intrinsic* x);
12949
e125ba4c16bd 7171890: C1: add Class.isInstance intrinsic
roland
parents: 12377
diff changeset
   253
  void do_isInstance(Intrinsic* x);
36552
0db9be43cebb 8150669: C1 intrinsic for Class.isPrimitive
shade
parents: 35117
diff changeset
   254
  void do_isPrimitive(Intrinsic* x);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  void do_getClass(Intrinsic* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  void do_currentThread(Intrinsic* x);
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38241
diff changeset
   257
  void do_FmaIntrinsic(Intrinsic* x);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  void do_MathIntrinsic(Intrinsic* x);
33465
6063f28a6efb 8139575: Update for x86 log in the math lib
iveresov
parents: 33462
diff changeset
   259
  void do_LibmIntrinsic(Intrinsic* x);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  void do_ArrayCopy(Intrinsic* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  void do_CompareAndSwap(Intrinsic* x, ValueType* type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  void do_NIOCheckIndex(Intrinsic* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  void do_FPIntrinsics(Intrinsic* x);
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 8065
diff changeset
   264
  void do_Reference_get(Intrinsic* x);
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17011
diff changeset
   265
  void do_update_CRC32(Intrinsic* x);
38237
d972e3a2df53 8155162: java.util.zip.CRC32C Interpreter/C1 intrinsics support on SPARC
kvn
parents: 38031
diff changeset
   266
  void do_update_CRC32C(Intrinsic* x);
38238
1bbcc430c78d 8151268: Wire up the x86 _vectorizedMismatch stub routine in C1
psandoz
parents: 38237
diff changeset
   267
  void do_vectorizedMismatch(Intrinsic* x);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   269
 public:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  LIR_Opr call_runtime(BasicTypeArray* signature, LIRItemList* args, address entry, ValueType* result_type, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  LIR_Opr call_runtime(BasicTypeArray* signature, LIR_OprList* args, address entry, ValueType* result_type, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  // convenience functions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  LIR_Opr call_runtime(Value arg1, address entry, ValueType* result_type, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  LIR_Opr call_runtime(Value arg1, Value arg2, address entry, ValueType* result_type, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   277
  // Access API
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   278
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   279
 private:
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   280
  BarrierSetC1 *_barrier_set;
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   281
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   282
 public:
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   283
  void access_store_at(DecoratorSet decorators, BasicType type,
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   284
                       LIRItem& base, LIR_Opr offset, LIR_Opr value,
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   285
                       CodeEmitInfo* patch_info = NULL, CodeEmitInfo* store_emit_info = NULL);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   286
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   287
  void access_load_at(DecoratorSet decorators, BasicType type,
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   288
                      LIRItem& base, LIR_Opr offset, LIR_Opr result,
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   289
                      CodeEmitInfo* patch_info = NULL, CodeEmitInfo* load_emit_info = NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
51408
59269a19f108 8208582: Introduce native oop barriers in C1 for OopHandle
eosterlund
parents: 50153
diff changeset
   291
  void access_load(DecoratorSet decorators, BasicType type,
59269a19f108 8208582: Introduce native oop barriers in C1 for OopHandle
eosterlund
parents: 50153
diff changeset
   292
                   LIR_Opr addr, LIR_Opr result);
59269a19f108 8208582: Introduce native oop barriers in C1 for OopHandle
eosterlund
parents: 50153
diff changeset
   293
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   294
  LIR_Opr access_atomic_cmpxchg_at(DecoratorSet decorators, BasicType type,
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   295
                                   LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   296
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   297
  LIR_Opr access_atomic_xchg_at(DecoratorSet decorators, BasicType type,
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   298
                                LIRItem& base, LIRItem& offset, LIRItem& value);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   300
  LIR_Opr access_atomic_add_at(DecoratorSet decorators, BasicType type,
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   301
                               LIRItem& base, LIRItem& offset, LIRItem& value);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   302
51487
f791e6fb8040 8209667: Explicit barriers for C1/LIR
rkennke
parents: 51408
diff changeset
   303
  LIR_Opr access_resolve(DecoratorSet decorators, LIR_Opr obj);
f791e6fb8040 8209667: Explicit barriers for C1/LIR
rkennke
parents: 51408
diff changeset
   304
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   305
  // These need to guarantee JMM volatile semantics are preserved on each platform
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   306
  // and requires one implementation per architecture.
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   307
  LIR_Opr atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   308
  LIR_Opr atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& new_value);
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   309
  LIR_Opr atomic_add(BasicType type, LIR_Opr addr, LIRItem& new_value);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
49938
2c2a722a2c0c 8202379: ARM32 is broken after JDK-8201543 (Modularize C1 GC barriers)
shade
parents: 49906
diff changeset
   311
#ifdef CARDTABLEBARRIERSET_POST_BARRIER_HELPER
2c2a722a2c0c 8202379: ARM32 is broken after JDK-8201543 (Modularize C1 GC barriers)
shade
parents: 49906
diff changeset
   312
  virtual void CardTableBarrierSet_post_barrier_helper(LIR_OprDesc* addr, LIR_Const* card_table_base);
2c2a722a2c0c 8202379: ARM32 is broken after JDK-8201543 (Modularize C1 GC barriers)
shade
parents: 49906
diff changeset
   313
#endif
2c2a722a2c0c 8202379: ARM32 is broken after JDK-8201543 (Modularize C1 GC barriers)
shade
parents: 49906
diff changeset
   314
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  // specific implementations
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   316
  void array_store_check(LIR_Opr value, LIR_Opr array, CodeEmitInfo* store_check_info, ciMethod* profiled_method, int profiled_bci);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  static LIR_Opr result_register_for(ValueType* type, bool callee = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  ciObject* get_jobject_constant(Value value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  LIRItemList* invoke_visit_arguments(Invoke* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  void invoke_load_arguments(Invoke* x, LIRItemList* args, const LIR_OprList* arg_list);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  void trace_block_entry(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  // volatile field operations are never patchable because a klass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  // must be loaded to know it's volatile which means that the offset
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  // it always known as well.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  void volatile_field_store(LIR_Opr value, LIR_Address* address, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  void volatile_field_load(LIR_Address* address, LIR_Opr result, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  void put_Object_unsafe(LIR_Opr src, LIR_Opr offset, LIR_Opr data, BasicType type, bool is_volatile);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  void get_Object_unsafe(LIR_Opr dest, LIR_Opr src, LIR_Opr offset, BasicType type, bool is_volatile);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  void arithmetic_call_op (Bytecodes::Code code, LIR_Opr result, LIR_OprList* args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   338
  void increment_counter(address counter, BasicType type, int step = 1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  void increment_counter(LIR_Address* addr, int step = 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  // is_strictfp is only needed for mul and div (and only generates different code on i486)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  void arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp, CodeEmitInfo* info = NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  // machine dependent.  returns true if it emitted code for the multiply
45632
e56cfcaea55c 8181872: C1: possible overflow when strength reducing integer multiply by constant
vlivanov
parents: 42063
diff changeset
   344
  bool strength_reduce_multiply(LIR_Opr left, jint constant, LIR_Opr result, LIR_Opr tmp);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
24933
c16c7a4ac386 8031994: java/lang/Character/CheckProp test times out
rbackman
parents: 24442
diff changeset
   348
  void klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info, bool need_resolve = false);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  // this loads the length and compares against the index
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  void array_range_check          (LIR_Opr array, LIR_Opr index, CodeEmitInfo* null_check_info, CodeEmitInfo* range_check_info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
  // For java.nio.Buffer.checkIndex
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  void nio_range_check            (LIR_Opr buffer, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  void arithmetic_op_int  (Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, LIR_Opr tmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  void arithmetic_op_long (Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, CodeEmitInfo* info = NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  void arithmetic_op_fpu  (Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp = LIR_OprFact::illegalOpr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
  void shift_op   (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr value, LIR_Opr count, LIR_Opr tmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  void logic_op   (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr left, LIR_Opr right);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info);
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   364
  void monitor_exit  (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
24933
c16c7a4ac386 8031994: java/lang/Character/CheckProp test times out
rbackman
parents: 24442
diff changeset
   366
  void new_instance    (LIR_Opr  dst, ciInstanceKlass* klass, bool is_unresolved, LIR_Opr  scratch1, LIR_Opr  scratch2, LIR_Opr  scratch3,  LIR_Opr scratch4, LIR_Opr  klass_reg, CodeEmitInfo* info);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  // machine dependent
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  void arraycopy_helper(Intrinsic* x, int* flags, ciArrayKlass** expected_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
  // returns a LIR_Address to address an array location.  May also
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  // emit some code as part of address calculation.  If
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
  // needs_card_mark is true then compute the full address for use by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  // both the store and the card mark.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  LIR_Address* generate_address(LIR_Opr base,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
                                LIR_Opr index, int shift,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
                                int disp,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
                                BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  LIR_Address* generate_address(LIR_Opr base, int disp, BasicType type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
    return generate_address(base, LIR_OprFact::illegalOpr, 0, disp, type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  }
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   385
  LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   387
  // the helper for generate_address
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   388
  void add_large_constant(LIR_Opr src, int c, LIR_Opr dest);
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   389
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
  // machine preferences and characteristics
42063
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 42037
diff changeset
   391
  bool can_inline_as_constant(Value i S390_ONLY(COMMA int bits = 20)) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  bool can_inline_as_constant(LIR_Const* c) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  bool can_store_as_constant(Value i, BasicType type) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  LIR_Opr safepoint_poll_register();
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   396
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   397
  void profile_branch(If* if_instr, If::Condition cond);
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   398
  void increment_event_counter_impl(CodeEmitInfo* info,
50153
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   399
                                    ciMethod *method, LIR_Opr step, int frequency,
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   400
                                    int bci, bool backedge, bool notify);
50153
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   401
  void increment_event_counter(CodeEmitInfo* info, LIR_Opr step, int bci, bool backedge);
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   402
  void increment_invocation_counter(CodeEmitInfo *info) {
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   403
    if (compilation()->count_invocations()) {
50153
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   404
      increment_event_counter(info, LIR_OprFact::intConst(InvocationCounter::count_increment), InvocationEntryBci, false);
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   405
    }
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   406
  }
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   407
  void increment_backedge_counter(CodeEmitInfo* info, int bci) {
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   408
    if (compilation()->count_backedges()) {
50153
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   409
      increment_event_counter(info, LIR_OprFact::intConst(InvocationCounter::count_increment), bci, true);
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   410
    }
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   411
  }
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   412
  void increment_backedge_counter_conditionally(LIR_Condition cond, LIR_Opr left, LIR_Opr right, CodeEmitInfo* info, int left_bci, int right_bci, int bci);
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   413
  void increment_backedge_counter(CodeEmitInfo* info, LIR_Opr step, int bci) {
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   414
    if (compilation()->count_backedges()) {
9010b580d8a9 8201447: C1 does backedge profiling incorrectly
iveresov
parents: 50113
diff changeset
   415
      increment_event_counter(info, step, bci, true);
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   416
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
  }
24442
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 21579
diff changeset
   418
  void decrement_age(CodeEmitInfo* info);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
  CodeEmitInfo* state_for(Instruction* x, ValueStack* state, bool ignore_xhandler = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
  CodeEmitInfo* state_for(Instruction* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
  // allocates a virtual register for this instruction if
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
  // one isn't already allocated.  Only for Phi and Local.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
  LIR_Opr operand_for_instruction(Instruction *x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
  void set_block(BlockBegin* block)              { _block = block; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
  void block_prolog(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
  void block_epilog(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
  void do_root (Instruction* instr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
  void walk    (Instruction* instr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
  void bind_block_entry(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
  void start_block(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
  LIR_Opr new_register(BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
  LIR_Opr new_register(Value value)              { return new_register(as_BasicType(value->type())); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
  LIR_Opr new_register(ValueType* type)          { return new_register(as_BasicType(type)); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
  // returns a register suitable for doing pointer math
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
  LIR_Opr new_pointer_register() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
    return new_register(T_LONG);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
    return new_register(T_INT);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
  static LIR_Condition lir_cond(If::Condition cond) {
33589
7cbd1b2c139b 8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux.
goetz
parents: 33089
diff changeset
   451
    LIR_Condition l = lir_cond_unknown;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
    switch (cond) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
    case If::eql: l = lir_cond_equal;        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
    case If::neq: l = lir_cond_notEqual;     break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
    case If::lss: l = lir_cond_less;         break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
    case If::leq: l = lir_cond_lessEqual;    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
    case If::geq: l = lir_cond_greaterEqual; break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
    case If::gtr: l = lir_cond_greater;      break;
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 13886
diff changeset
   459
    case If::aeq: l = lir_cond_aboveEqual;   break;
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 13886
diff changeset
   460
    case If::beq: l = lir_cond_belowEqual;   break;
33589
7cbd1b2c139b 8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux.
goetz
parents: 33089
diff changeset
   461
    default: fatal("You must pass valid If::Condition");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
    };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
    return l;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   466
#ifdef __SOFTFP__
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   467
  void do_soft_float_compare(If *x);
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   468
#endif // __SOFTFP__
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   469
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
  SwitchRangeArray* create_lookup_ranges(TableSwitch* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  SwitchRangeArray* create_lookup_ranges(LookupSwitch* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
  void do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49938
diff changeset
   474
#ifdef JFR_HAVE_INTRINSICS
40899
d7140c75c2c6 8163589: Add back class id intrinsic method for event based tracing
rehn
parents: 38241
diff changeset
   475
  void do_ClassIDIntrinsic(Intrinsic* x);
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49938
diff changeset
   476
  void do_getEventWriter(Intrinsic* x);
40899
d7140c75c2c6 8163589: Add back class id intrinsic method for event based tracing
rehn
parents: 38241
diff changeset
   477
#endif
d7140c75c2c6 8163589: Add back class id intrinsic method for event based tracing
rehn
parents: 38241
diff changeset
   478
35109
92535200db7d 8143817: C1: Platform dependent stack space not preserved for all runtime calls
mdoerr
parents: 34201
diff changeset
   479
  void do_RuntimeCall(address routine, Intrinsic* x);
36384
b0b41336a9a8 8143226: Minor updates to Event Based tracing
mgronlun
parents: 35117
diff changeset
   480
21579
c396d68f3e48 8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents: 21095
diff changeset
   481
  ciKlass* profile_type(ciMethodData* md, int md_first_offset, int md_offset, intptr_t profiled_k,
c396d68f3e48 8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents: 21095
diff changeset
   482
                        Value arg, LIR_Opr& mdp, bool not_null, ciKlass* signature_at_call_k,
c396d68f3e48 8027631: "unexpected profiling mismatch" error with new type profiling
roland
parents: 21095
diff changeset
   483
                        ciKlass* callee_signature_k);
20702
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 18507
diff changeset
   484
  void profile_arguments(ProfileCall* x);
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents: 20709
diff changeset
   485
  void profile_parameters(Base* x);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents: 20709
diff changeset
   486
  void profile_parameters_at_call(ProfileCall* x);
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   487
  LIR_Opr mask_boolean(LIR_Opr array, LIR_Opr value, CodeEmitInfo*& null_check_info);
37480
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 36559
diff changeset
   488
  LIR_Opr maybe_mask_boolean(StoreIndexed* x, LIR_Opr array, LIR_Opr value, CodeEmitInfo*& null_check_info);
12377
ae6def2813e0 7160570: Intrinsification support for tracing framework
rbackman
parents: 11886
diff changeset
   489
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
  Compilation*  compilation() const              { return _compilation; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
  FrameMap*     frame_map() const                { return _compilation->frame_map(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
  ciMethod*     method() const                   { return _method; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
  BlockBegin*   block() const                    { return _block; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
  IRScope*      scope() const                    { return block()->scope(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
  int max_virtual_register_number() const        { return _virtual_register_number; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
  void block_do(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
  // Flags that can be set on vregs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
  enum VregFlag {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
      must_start_in_memory = 0  // needs to be assigned a memory location at beginning, but may then be loaded in a register
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
    , callee_saved     = 1    // must be in a callee saved register
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
    , byte_reg         = 2    // must be in a byte register
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
    , num_vreg_flags
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
  LIRGenerator(Compilation* compilation, ciMethod* method)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
    : _compilation(compilation)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
    , _method(method)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
    , _virtual_register_number(LIR_OprDesc::vreg_base)
49906
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   514
    , _vreg_flags(num_vreg_flags)
4bb58f644e4e 8201543: Modularize C1 GC barriers
eosterlund
parents: 49455
diff changeset
   515
    , _barrier_set(BarrierSet::barrier_set()->barrier_set_c1()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
  // for virtual registers, maps them back to Phi's or Local's
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
  Instruction* instruction_for_opr(LIR_Opr opr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
  Instruction* instruction_for_vreg(int reg_num);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
  void set_vreg_flag   (int vreg_num, VregFlag f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
  bool is_vreg_flag_set(int vreg_num, VregFlag f);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
  void set_vreg_flag   (LIR_Opr opr,  VregFlag f) { set_vreg_flag(opr->vreg_number(), f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
  bool is_vreg_flag_set(LIR_Opr opr,  VregFlag f) { return is_vreg_flag_set(opr->vreg_number(), f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
  // statics
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
  static LIR_Opr exceptionOopOpr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
  static LIR_Opr exceptionPcOpr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
  static LIR_Opr divInOpr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
  static LIR_Opr divOutOpr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
  static LIR_Opr remOutOpr();
42063
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 42037
diff changeset
   533
#ifdef S390
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 42037
diff changeset
   534
  // On S390 we can do ldiv, lrem without RT call.
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 42037
diff changeset
   535
  static LIR_Opr ldivInOpr();
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 42037
diff changeset
   536
  static LIR_Opr ldivOutOpr();
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 42037
diff changeset
   537
  static LIR_Opr lremOutOpr();
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 42037
diff changeset
   538
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  static LIR_Opr shiftCountOpr();
34201
2de6f3566659 8138895: C1: PPC64 Port needs special register for Locks in synchronization code
mdoerr
parents: 33626
diff changeset
   540
  LIR_Opr syncLockOpr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
  LIR_Opr syncTempOpr();
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   542
  LIR_Opr atomicLockOpr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
  // returns a register suitable for saving the thread in a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
  // call_runtime_leaf if one is needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
  LIR_Opr getThreadTemp();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
  // visitor functionality
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
  virtual void do_Phi            (Phi*             x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
  virtual void do_Local          (Local*           x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
  virtual void do_Constant       (Constant*        x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
  virtual void do_LoadField      (LoadField*       x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
  virtual void do_StoreField     (StoreField*      x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
  virtual void do_ArrayLength    (ArrayLength*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
  virtual void do_LoadIndexed    (LoadIndexed*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
  virtual void do_StoreIndexed   (StoreIndexed*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
  virtual void do_NegateOp       (NegateOp*        x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
  virtual void do_ArithmeticOp   (ArithmeticOp*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
  virtual void do_ShiftOp        (ShiftOp*         x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
  virtual void do_LogicOp        (LogicOp*         x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
  virtual void do_CompareOp      (CompareOp*       x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
  virtual void do_IfOp           (IfOp*            x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
  virtual void do_Convert        (Convert*         x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
  virtual void do_NullCheck      (NullCheck*       x);
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 12957
diff changeset
   565
  virtual void do_TypeCast       (TypeCast*        x);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
  virtual void do_Invoke         (Invoke*          x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
  virtual void do_NewInstance    (NewInstance*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
  virtual void do_NewTypeArray   (NewTypeArray*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
  virtual void do_NewObjectArray (NewObjectArray*  x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
  virtual void do_NewMultiArray  (NewMultiArray*   x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
  virtual void do_CheckCast      (CheckCast*       x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
  virtual void do_InstanceOf     (InstanceOf*      x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
  virtual void do_MonitorEnter   (MonitorEnter*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
  virtual void do_MonitorExit    (MonitorExit*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
  virtual void do_Intrinsic      (Intrinsic*       x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
  virtual void do_BlockBegin     (BlockBegin*      x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
  virtual void do_Goto           (Goto*            x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
  virtual void do_If             (If*              x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
  virtual void do_IfInstanceOf   (IfInstanceOf*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
  virtual void do_TableSwitch    (TableSwitch*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
  virtual void do_LookupSwitch   (LookupSwitch*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
  virtual void do_Return         (Return*          x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
  virtual void do_Throw          (Throw*           x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
  virtual void do_Base           (Base*            x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
  virtual void do_OsrEntry       (OsrEntry*        x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
  virtual void do_ExceptionObject(ExceptionObject* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
  virtual void do_RoundFP        (RoundFP*         x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
  virtual void do_UnsafeGetRaw   (UnsafeGetRaw*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
  virtual void do_UnsafePutRaw   (UnsafePutRaw*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
  virtual void do_UnsafeGetObject(UnsafeGetObject* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
  virtual void do_UnsafePutObject(UnsafePutObject* x);
13886
8d82c4dfa722 7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents: 13728
diff changeset
   592
  virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
  virtual void do_ProfileCall    (ProfileCall*     x);
20709
034be898bf04 8026054: New type profiling points: type of return values at calls
roland
parents: 20702
diff changeset
   594
  virtual void do_ProfileReturnType (ProfileReturnType* x);
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   595
  virtual void do_ProfileInvoke  (ProfileInvoke*   x);
8065
7ca689ce3d32 6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents: 7397
diff changeset
   596
  virtual void do_RuntimeCall    (RuntimeCall*     x);
11886
feebf5c9f40c 7120481: storeStore barrier in constructor with final field
jiangli
parents: 9176
diff changeset
   597
  virtual void do_MemBar         (MemBar*          x);
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 13886
diff changeset
   598
  virtual void do_RangeCheckPredicate(RangeCheckPredicate* x);
17011
def8879c5b81 8011648: C1: optimized build is broken after 7153771
roland
parents: 16611
diff changeset
   599
#ifdef ASSERT
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 13886
diff changeset
   600
  virtual void do_Assert         (Assert*          x);
17011
def8879c5b81 8011648: C1: optimized build is broken after 7153771
roland
parents: 16611
diff changeset
   601
#endif
29474
81a5c5330d08 8072383: resolve conflicts between open and closed ports
dlong
parents: 28954
diff changeset
   602
81a5c5330d08 8072383: resolve conflicts between open and closed ports
dlong
parents: 28954
diff changeset
   603
#ifdef C1_LIRGENERATOR_MD_HPP
81a5c5330d08 8072383: resolve conflicts between open and closed ports
dlong
parents: 28954
diff changeset
   604
#include C1_LIRGENERATOR_MD_HPP
81a5c5330d08 8072383: resolve conflicts between open and closed ports
dlong
parents: 28954
diff changeset
   605
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
class LIRItem: public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
  Value         _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
  LIRGenerator* _gen;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
  LIR_Opr       _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
  bool          _destroys_register;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
  LIR_Opr       _new_result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
  LIRGenerator* gen() const { return _gen; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
  LIRItem(Value value, LIRGenerator* gen) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
    _destroys_register = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
    _gen = gen;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
    set_instruction(value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
  LIRItem(LIRGenerator* gen) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
    _destroys_register = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
    _gen = gen;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
    _result = LIR_OprFact::illegalOpr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
    set_instruction(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
  void set_instruction(Value value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
    _value = value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
    _result = LIR_OprFact::illegalOpr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
    if (_value != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
      _gen->walk(_value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
      _result = _value->operand();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
    _new_result = LIR_OprFact::illegalOpr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
  Value value() const          { return _value;          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
  ValueType* type() const      { return value()->type(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
  LIR_Opr result()             {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
    assert(!_destroys_register || (!_result->is_register() || _result->is_virtual()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
           "shouldn't use set_destroys_register with physical regsiters");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
    if (_destroys_register && _result->is_register()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
      if (_new_result->is_illegal()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
        _new_result = _gen->new_register(type());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
        gen()->lir()->move(_result, _new_result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
      return _new_result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
      return _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
    return _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
  void set_result(LIR_Opr opr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
  void load_item();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
  void load_byte_item();
42063
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 42037
diff changeset
   664
  void load_nonconstant(S390_ONLY(int bits = 20));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   665
  // load any values which can't be expressed as part of a single store instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
  void load_for_store(BasicType store_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
  void load_item_force(LIR_Opr reg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
  void dont_load_item() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
    // do nothing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
  void set_destroys_register() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
    _destroys_register = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
  bool is_constant() const { return value()->as_Constant() != NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
  bool is_stack()          { return result()->is_stack(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
  bool is_register()       { return result()->is_register(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
  ciObject* get_jobject_constant() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
  jint      get_jint_constant() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   683
  jlong     get_jlong_constant() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
  jfloat    get_jfloat_constant() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
  jdouble   get_jdouble_constant() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
  jint      get_address_constant() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
   688
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51487
diff changeset
   689
#endif // SHARE_C1_C1_LIRGENERATOR_HPP