src/hotspot/share/c1/c1_GraphBuilder.hpp
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 53244 9807daeb47c4
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
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: 49373
diff changeset
     2
 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1623
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1623
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: 1623
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: 49373
diff changeset
    25
#ifndef SHARE_C1_C1_GRAPHBUILDER_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49373
diff changeset
    26
#define SHARE_C1_C1_GRAPHBUILDER_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6751
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6751
diff changeset
    28
#include "c1/c1_IR.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6751
diff changeset
    29
#include "c1/c1_Instruction.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6751
diff changeset
    30
#include "c1/c1_ValueMap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6751
diff changeset
    31
#include "c1/c1_ValueStack.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6751
diff changeset
    32
#include "ci/ciMethodData.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6751
diff changeset
    33
#include "ci/ciStreams.hpp"
13964
01a2b863cc61 7177003: C1: LogCompilation support
vlivanov
parents: 13886
diff changeset
    34
#include "compiler/compileLog.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6751
diff changeset
    35
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class MemoryBuffer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
49373
47b5652f2928 8199283: Remove ValueObj class for allocation subclassing for compiler code
coleenp
parents: 47216
diff changeset
    38
class GraphBuilder {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  // Per-scope data. These are pushed and popped as we descend into
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  // inlined methods. Currently in order to generate good code in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  // inliner we have to attempt to inline methods directly into the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  // basic block we are parsing; this adds complexity.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  class ScopeData: public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
   private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    ScopeData*  _parent;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    // bci-to-block mapping
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    BlockList*   _bci2block;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    // Scope
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    IRScope*     _scope;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    // Whether this scope or any parent scope has exception handlers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    bool         _has_handler;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    // The bytecodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
    ciBytecodeStream* _stream;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    // Work list
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    BlockList*   _work_list;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    // Maximum inline size for this scope
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    intx         _max_inline_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    // Expression stack depth at point where inline occurred
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    int          _caller_stack_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    // The continuation point for the inline. Currently only used in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    // multi-block inlines, but eventually would like to use this for
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    // all inlines for uniformity and simplicity; in this case would
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    // get the continuation point from the BlockList instead of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    // fabricating it anew because Invokes would be considered to be
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    // BlockEnds.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    BlockBegin*  _continuation;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    // Was this ScopeData created only for the parsing and inlining of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    // a jsr?
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    bool         _parsing_jsr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    // We track the destination bci of the jsr only to determine
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    // bailout conditions, since we only handle a subset of all of the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    // possible jsr-ret control structures. Recursive invocations of a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    // jsr are disallowed by the verifier.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    int          _jsr_entry_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    // We need to track the local variable in which the return address
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    // was stored to ensure we can handle inlining the jsr, because we
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    // don't handle arbitrary jsr/ret constructs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    int          _jsr_ret_addr_local;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    // If we are parsing a jsr, the continuation point for rets
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    BlockBegin*  _jsr_continuation;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    // Cloned XHandlers for jsr-related ScopeDatas
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    XHandlers*   _jsr_xhandlers;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    // Number of returns seen in this scope
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    int          _num_returns;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    // In order to generate profitable code for inlining, we currently
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    // have to perform an optimization for single-block inlined
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    // methods where we continue parsing into the same block. This
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    // allows us to perform CSE across inlined scopes and to avoid
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    // storing parameters to the stack. Having a global register
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    // allocator and being able to perform global CSE would allow this
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    // code to be removed and thereby simplify the inliner.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    BlockBegin*  _cleanup_block;       // The block to which the return was added
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    Instruction* _cleanup_return_prev; // Instruction before return instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    ValueStack*  _cleanup_state;       // State of that block (not yet pinned)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
40868
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   103
    // When inlining do not push the result on the stack
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   104
    bool         _ignore_return;
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   105
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
   public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    ScopeData(ScopeData* parent);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    ScopeData* parent() const                      { return _parent;            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    BlockList* bci2block() const                   { return _bci2block;         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    void       set_bci2block(BlockList* bci2block) { _bci2block = bci2block;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    // NOTE: this has a different effect when parsing jsrs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    BlockBegin* block_at(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    IRScope* scope() const                         { return _scope;             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    // Has side-effect of setting has_handler flag
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    void set_scope(IRScope* scope);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    // Whether this or any parent scope has exception handlers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    bool has_handler() const                       { return _has_handler;       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    void set_has_handler()                         { _has_handler = true;       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    // Exception handlers list to be used for this scope
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    XHandlers* xhandlers() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    // How to get a block to be parsed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    void add_to_work_list(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    // How to remove the next block to be parsed; returns NULL if none left
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    BlockBegin* remove_from_work_list();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    // Indicates parse is over
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    bool is_work_list_empty() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    ciBytecodeStream* stream()                     { return _stream;            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    void set_stream(ciBytecodeStream* stream)      { _stream = stream;          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    intx max_inline_size() const                   { return _max_inline_size;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    BlockBegin* continuation() const               { return _continuation;      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    void set_continuation(BlockBegin* cont)        { _continuation = cont;      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    // Indicates whether this ScopeData was pushed only for the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    // parsing and inlining of a jsr
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    bool parsing_jsr() const                       { return _parsing_jsr;       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
    void set_parsing_jsr()                         { _parsing_jsr = true;       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    int  jsr_entry_bci() const                     { return _jsr_entry_bci;     }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    void set_jsr_entry_bci(int bci)                { _jsr_entry_bci = bci;      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    void set_jsr_return_address_local(int local_no){ _jsr_ret_addr_local = local_no; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    int  jsr_return_address_local() const          { return _jsr_ret_addr_local; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    // Must be called after scope is set up for jsr ScopeData
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    void setup_jsr_xhandlers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    // The jsr continuation is only used when parsing_jsr is true, and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    // is different from the "normal" continuation since we can end up
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    // doing a return (rather than a ret) from within a subroutine
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    BlockBegin* jsr_continuation() const           { return _jsr_continuation;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    void set_jsr_continuation(BlockBegin* cont)    { _jsr_continuation = cont;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    int num_returns();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    void incr_num_returns();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    void set_inline_cleanup_info(BlockBegin* block,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
                                 Instruction* return_prev,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
                                 ValueStack* return_state);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
    BlockBegin*  inline_cleanup_block() const      { return _cleanup_block; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    Instruction* inline_cleanup_return_prev() const{ return _cleanup_return_prev; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    ValueStack*  inline_cleanup_state() const      { return _cleanup_state; }
40868
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   169
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   170
    bool ignore_return() const                     { return _ignore_return;          }
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   171
    void set_ignore_return(bool ignore_return)     { _ignore_return = ignore_return; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  // for all GraphBuilders
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  static bool       _can_trap[Bytecodes::number_of_java_codes];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  // for each instance of GraphBuilder
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  ScopeData*        _scope_data;                 // Per-scope data; used for inlining
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  Compilation*      _compilation;                // the current compilation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  ValueMap*         _vmap;                       // the map of values encountered (for CSE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  MemoryBuffer*     _memory;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  const char*       _inline_bailout_msg;         // non-null if most recent inline attempt failed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  int               _instruction_count;          // for bailing out in pathological jsr/ret cases
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  BlockBegin*       _start;                      // the start block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  BlockBegin*       _osr_entry;                  // the osr entry block block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  ValueStack*       _initial_state;              // The state for the start block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  // for each call to connect_to_end; can also be set by inliner
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  BlockBegin*       _block;                      // the current block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  ValueStack*       _state;                      // the current execution state
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  Instruction*      _last;                       // the last instruction added
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  bool              _skip_block;                 // skip processing of the rest of this block
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  // accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  ScopeData*        scope_data() const           { return _scope_data; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  Compilation*      compilation() const          { return _compilation; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  BlockList*        bci2block() const            { return scope_data()->bci2block(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  ValueMap*         vmap() const                 { assert(UseLocalValueNumbering, "should not access otherwise"); return _vmap; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  bool              has_handler() const          { return scope_data()->has_handler(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  BlockBegin*       block() const                { return _block; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  ValueStack*       state() const                { return _state; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  void              set_state(ValueStack* state) { _state = state; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  IRScope*          scope() const                { return scope_data()->scope(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  ciMethod*         method() const               { return scope()->method(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  ciBytecodeStream* stream() const               { return scope_data()->stream(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  Instruction*      last() const                 { return _last; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  Bytecodes::Code   code() const                 { return stream()->cur_bc(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  int               bci() const                  { return stream()->cur_bci(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  int               next_bci() const             { return stream()->next_bci(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  // unified bailout support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  void bailout(const char* msg) const            { compilation()->bailout(msg); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  bool bailed_out() const                        { return compilation()->bailed_out(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  // stack manipulation helpers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  void ipush(Value t) const                      { state()->ipush(t); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  void lpush(Value t) const                      { state()->lpush(t); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  void fpush(Value t) const                      { state()->fpush(t); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  void dpush(Value t) const                      { state()->dpush(t); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  void apush(Value t) const                      { state()->apush(t); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  void  push(ValueType* type, Value t) const     { state()-> push(type, t); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  Value ipop()                                   { return state()->ipop(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  Value lpop()                                   { return state()->lpop(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  Value fpop()                                   { return state()->fpop(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  Value dpop()                                   { return state()->dpop(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  Value apop()                                   { return state()->apop(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  Value  pop(ValueType* type)                    { return state()-> pop(type); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  // instruction helpers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  void load_constant();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  void load_local(ValueType* type, int index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  void store_local(ValueType* type, int index);
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11635
diff changeset
   235
  void store_local(ValueStack* state, Value value, int index);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  void load_indexed (BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  void store_indexed(BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  void stack_op(Bytecodes::Code code);
6745
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   239
  void arithmetic_op(ValueType* type, Bytecodes::Code code, ValueStack* state_before = NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  void negate_op(ValueType* type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  void shift_op(ValueType* type, Bytecodes::Code code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  void logic_op(ValueType* type, Bytecodes::Code code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  void compare_op(ValueType* type, Bytecodes::Code code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  void convert(Bytecodes::Code op, BasicType from, BasicType to);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  void increment();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  void _goto(int from_bci, int to_bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  void if_node(Value x, If::Condition cond, Value y, ValueStack* stack_before);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  void if_zero(ValueType* type, If::Condition cond);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  void if_null(ValueType* type, If::Condition cond);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  void if_same(ValueType* type, If::Condition cond);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  void jsr(int dest);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  void ret(int local_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  void table_switch();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  void lookup_switch();
40868
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   255
  void method_return(Value x, bool ignore_return = false);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  void call_register_finalizer();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  void access_field(Bytecodes::Code code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  void invoke(Bytecodes::Code code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  void new_instance(int klass_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  void new_type_array();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  void new_object_array();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  void check_cast(int klass_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  void instance_of(int klass_index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  void monitorenter(Value x, int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  void monitorexit(Value x, int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  void new_multi_array(int dimensions);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  void throw_op(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  Value round_fp(Value fp_value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  // stack/code manipulation helpers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  Instruction* append_with_bci(Instruction* instr, int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  Instruction* append(Instruction* instr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  Instruction* append_split(StateSplit* instr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  // other helpers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  BlockBegin* block_at(int bci)                  { return scope_data()->block_at(bci); }
6745
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   277
  XHandlers* handle_exception(Instruction* instruction);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  void connect_to_end(BlockBegin* beg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  void null_check(Value value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  void eliminate_redundant_phis(BlockBegin* start);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  BlockEnd* iterate_bytecodes_for_block(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  void iterate_all_blocks(bool start_in_current_block_for_inlining = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  Dependencies* dependency_recorder() const; // = compilation()->dependencies()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  bool direct_compare(ciKlass* k);
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 33628
diff changeset
   285
  Value make_constant(ciConstant value, ciField* field);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  void kill_all();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
6745
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   289
  // use of state copy routines (try to minimize unnecessary state
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   290
  // object allocations):
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   291
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   292
  // - if the instruction unconditionally needs a full copy of the
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   293
  // state (for patching for example), then use copy_state_before*
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   294
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   295
  // - if the instruction needs a full copy of the state only for
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   296
  // handler generation (Instruction::needs_exception_state() returns
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   297
  // false) then use copy_state_exhandling*
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   298
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   299
  // - if the instruction needs either a full copy of the state for
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   300
  // handler generation and a least a minimal copy of the state (as
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   301
  // returned by Instruction::exception_state()) for debug info
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   302
  // generation (that is when Instruction::needs_exception_state()
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   303
  // returns true) then use copy_state_for_exception*
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   304
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   305
  ValueStack* copy_state_before_with_bci(int bci);
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   306
  ValueStack* copy_state_before();
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   307
  ValueStack* copy_state_exhandling_with_bci(int bci);
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   308
  ValueStack* copy_state_exhandling();
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   309
  ValueStack* copy_state_for_exception_with_bci(int bci);
a34ef8968a84 6986046: C1 valuestack cleanup
roland
parents: 6453
diff changeset
   310
  ValueStack* copy_state_for_exception();
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 13974
diff changeset
   311
  ValueStack* copy_state_if_bb(bool is_bb) { return (is_bb || compilation()->is_optimistic()) ? copy_state_before() : NULL; }
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 13974
diff changeset
   312
  ValueStack* copy_state_indexed_access() { return compilation()->is_optimistic() ? copy_state_before() : copy_state_for_exception(); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  // Inlining support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  // accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  bool parsing_jsr() const                               { return scope_data()->parsing_jsr();           }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  BlockBegin* continuation() const                       { return scope_data()->continuation();          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  BlockBegin* jsr_continuation() const                   { return scope_data()->jsr_continuation();      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  void set_continuation(BlockBegin* continuation)        { scope_data()->set_continuation(continuation); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  void set_inline_cleanup_info(BlockBegin* block,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
                               Instruction* return_prev,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
                               ValueStack* return_state) { scope_data()->set_inline_cleanup_info(block,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
                                                                                                  return_prev,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
                                                                                                  return_state); }
10509
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   328
  void set_inline_cleanup_info() {
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   329
    set_inline_cleanup_info(_block, _last, _state);
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   330
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  BlockBegin*  inline_cleanup_block() const              { return scope_data()->inline_cleanup_block();  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  Instruction* inline_cleanup_return_prev() const        { return scope_data()->inline_cleanup_return_prev(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  ValueStack*  inline_cleanup_state() const              { return scope_data()->inline_cleanup_state();  }
10509
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   334
  void restore_inline_cleanup_info() {
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   335
    _block = inline_cleanup_block();
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   336
    _last  = inline_cleanup_return_prev();
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   337
    _state = inline_cleanup_state();
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   338
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  void incr_num_returns()                                { scope_data()->incr_num_returns();             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  int  num_returns() const                               { return scope_data()->num_returns();           }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  intx max_inline_size() const                           { return scope_data()->max_inline_size();       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  int  inline_level() const                              { return scope()->level();                      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  int  recursive_inline_level(ciMethod* callee) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  // inlining of synchronized methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  void inline_sync_entry(Value lock, BlockBegin* sync_handler);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  void fill_sync_handler(Value lock, BlockBegin* sync_handler, bool default_handler = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
40868
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   349
  void build_graph_for_intrinsic(ciMethod* callee, bool ignore_return);
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 28954
diff changeset
   350
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  // inliners
40868
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   352
  bool try_inline(           ciMethod* callee, bool holder_known, bool ignore_return, Bytecodes::Code bc = Bytecodes::_illegal, Value receiver = NULL);
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   353
  bool try_inline_intrinsics(ciMethod* callee, bool ignore_return = false);
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   354
  bool try_inline_full(      ciMethod* callee, bool holder_known, bool ignore_return, Bytecodes::Code bc = Bytecodes::_illegal, Value receiver = NULL);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  bool try_inline_jsr(int jsr_dest_bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11635
diff changeset
   357
  const char* check_can_parse(ciMethod* callee) const;
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11635
diff changeset
   358
  const char* should_not_inline(ciMethod* callee) const;
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11635
diff changeset
   359
10509
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   360
  // JSR 292 support
40868
607b015fd047 8164122: C1: assert(false) failed: stack or locks not matching (invalid bytecodes)
iveresov
parents: 36604
diff changeset
   361
  bool try_method_handle_inline(ciMethod* callee, bool ignore_return);
10509
43d670e5701e 7079673: JSR 292: C1 should inline bytecoded method handle adapters
twisti
parents: 7397
diff changeset
   362
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  // helpers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  void inline_bailout(const char* msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  BlockBegin* header_block(BlockBegin* entry, BlockBegin::Flag f, ValueStack* state);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  BlockBegin* setup_start_block(int osr_bci, BlockBegin* std_entry, BlockBegin* osr_entry, ValueStack* init_state);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
  void setup_osr_entry_block();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  void clear_inline_bailout();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  ValueStack* state_at_entry();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  void push_root_scope(IRScope* scope, BlockList* bci2block, BlockBegin* start);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  void push_scope(ciMethod* callee, BlockBegin* continuation);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  void push_scope_for_jsr(BlockBegin* jsr_continuation, int jsr_dest_bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
  void pop_scope();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
  void pop_scope_for_jsr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 28954
diff changeset
   376
  void append_unsafe_get_obj(ciMethod* callee, BasicType t, bool is_volatile);
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 28954
diff changeset
   377
  void append_unsafe_put_obj(ciMethod* callee, BasicType t, bool is_volatile);
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 28954
diff changeset
   378
  void append_unsafe_get_raw(ciMethod* callee, BasicType t);
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 28954
diff changeset
   379
  void append_unsafe_put_raw(ciMethod* callee, BasicType t);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  void append_unsafe_CAS(ciMethod* callee);
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 28954
diff changeset
   381
  void append_unsafe_get_and_set_obj(ciMethod* callee, bool is_add);
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 31962
diff changeset
   382
  void append_char_access(ciMethod* callee, bool is_store);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
59330
5b96c12f909d 8234541: C1 emits an empty message when it inlines successfully
phh
parents: 53244
diff changeset
   384
  void print_inlining(ciMethod* callee, const char* msg, bool success = true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
20702
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 16611
diff changeset
   386
  void profile_call(ciMethod* callee, Value recv, ciKlass* predicted_holder, Values* obj_args, bool inlined);
20709
034be898bf04 8026054: New type profiling points: type of return values at calls
roland
parents: 20702
diff changeset
   387
  void profile_return_type(Value ret, ciMethod* callee, ciMethod* m = NULL, int bci = -1);
6751
b399fd234e47 6988346: 6986046 breaks tiered
iveresov
parents: 6745
diff changeset
   388
  void profile_invocation(ciMethod* inlinee, ValueStack* state);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5707
diff changeset
   390
  // Shortcuts to profiling control.
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5707
diff changeset
   391
  bool is_profiling()          { return _compilation->is_profiling();          }
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5707
diff changeset
   392
  bool count_invocations()     { return _compilation->count_invocations();     }
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5707
diff changeset
   393
  bool count_backedges()       { return _compilation->count_backedges();       }
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5707
diff changeset
   394
  bool profile_branches()      { return _compilation->profile_branches();      }
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5707
diff changeset
   395
  bool profile_calls()         { return _compilation->profile_calls();         }
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5707
diff changeset
   396
  bool profile_inlined_calls() { return _compilation->profile_inlined_calls(); }
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5707
diff changeset
   397
  bool profile_checkcasts()    { return _compilation->profile_checkcasts();    }
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents: 20709
diff changeset
   398
  bool profile_parameters()    { return _compilation->profile_parameters();    }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents: 20709
diff changeset
   399
  bool profile_arguments()     { return _compilation->profile_arguments();     }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents: 20709
diff changeset
   400
  bool profile_return()        { return _compilation->profile_return();        }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents: 20709
diff changeset
   402
  Values* args_list_for_profiling(ciMethod* target, int& start, bool may_have_receiver);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents: 20709
diff changeset
   403
  Values* collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver);
24313
2e10cd8a870f 8041481: JVM crashes with collect_args_for_profiling
roland
parents: 22234
diff changeset
   404
  void check_args_for_profiling(Values* obj_args, int expected);
20702
bbe0fcde6e13 8023657: New type profiling points: arguments to call
roland
parents: 16611
diff changeset
   405
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
  NOT_PRODUCT(void print_stats();)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
  // initialization
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
  static void initialize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
  // public
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
  static bool can_trap(ciMethod* method, Bytecodes::Code code) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
    assert(0 <= code && code < Bytecodes::number_of_java_codes, "illegal bytecode");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
    if (_can_trap[code]) return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
    // special handling for finalizer registration
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
    return code == Bytecodes::_return && method->intrinsic_id() == vmIntrinsics::_Object_init;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
  // creation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
  GraphBuilder(Compilation* compilation, IRScope* scope);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
  static void sort_top_into_worklist(BlockList* worklist, BlockBegin* top);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
  BlockBegin* start() const                      { return _start; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6751
diff changeset
   426
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49373
diff changeset
   427
#endif // SHARE_C1_C1_GRAPHBUILDER_HPP