src/hotspot/share/ci/ciMethodBlocks.hpp
author coleenp
Wed, 13 Nov 2019 08:23:23 -0500
changeset 59056 15936b142f86
parent 53244 9807daeb47c4
permissions -rw-r--r--
8233913: Remove implicit conversion from Method* to methodHandle Summary: Fix call sites to use existing THREAD local or pass down THREAD local for shallower callsites. Make linkResolver methods return Method* for caller to handleize if needed. Reviewed-by: iklam, thartmann, hseigel
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: 47216
diff changeset
     2
 * Copyright (c) 2006, 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: 1399
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1399
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: 1399
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: 47216
diff changeset
    25
#ifndef SHARE_CI_CIMETHODBLOCKS_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    26
#define SHARE_CI_CIMETHODBLOCKS_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "ci/ciMethod.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "utilities/growableArray.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class ciBlock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
typedef short ciBlockIndex;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class ciMethodBlocks : public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  ciMethod *_method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  Arena *_arena;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  GrowableArray<ciBlock *>  *_blocks;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  ciBlock  **_bci_to_block;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  int _num_blocks;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  int _code_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  void do_analysis();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  ciMethodBlocks(Arena *arena, ciMethod *meth);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  ciBlock *block_containing(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  ciBlock *block(int index)  { return _blocks->at(index); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  ciBlock *make_block_at(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  ciBlock *split_block_at(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  bool is_block_start(int bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  int num_blocks()  { return _num_blocks;}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  void clear_processed();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
1399
9648dfd4ce09 6384206: Phis which are later unneeded are impairing our ability to inline based on static types
never
parents: 670
diff changeset
    58
  ciBlock *make_dummy_block(); // a block not associated with a bci
9648dfd4ce09 6384206: Phis which are later unneeded are impairing our ability to inline based on static types
never
parents: 670
diff changeset
    59
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  void dump();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
class ciBlock : public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  int _idx;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  int _start_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  int _limit_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  int _control_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  uint _flags;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  int _ex_start_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  int _ex_limit_bci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  ciMethod *_method;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    Processed   = (1 << 0),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    Handler     = (1 << 1),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    MayThrow    = (1 << 2),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    DoesJsr     = (1 << 3),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    DoesRet     = (1 << 4),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    RetTarget   = (1 << 5),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    HasHandler  = (1 << 6)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    fall_through_bci = -1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
1399
9648dfd4ce09 6384206: Phis which are later unneeded are impairing our ability to inline based on static types
never
parents: 670
diff changeset
    93
  ciBlock(ciMethod *method, int index, int start_bci);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  int start_bci() const         { return _start_bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  int limit_bci() const         { return _limit_bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  int control_bci() const       { return _control_bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  int index() const             { return _idx; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  void set_start_bci(int bci)   { _start_bci = bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  void set_limit_bci(int bci)   { _limit_bci = bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  void set_control_bci(int bci) { _control_bci = bci;}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  void set_exception_range(int start_bci, int limit_bci);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  int ex_start_bci() const      { return _ex_start_bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  int ex_limit_bci() const      { return _ex_limit_bci; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  bool contains(int bci) const { return start_bci() <= bci && bci < limit_bci(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  // flag handling
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  bool  processed() const           { return (_flags & Processed) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  bool  is_handler() const          { return (_flags & Handler) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  bool  may_throw() const           { return (_flags & MayThrow) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  bool  does_jsr() const            { return (_flags & DoesJsr) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  bool  does_ret() const            { return (_flags & DoesRet) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  bool  has_handler() const         { return (_flags & HasHandler) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  bool  is_ret_target() const       { return (_flags & RetTarget) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  void  set_processed()             { _flags |= Processed; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  void  clear_processed()           { _flags &= ~Processed; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  void  set_handler()               { _flags |= Handler; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  void  set_may_throw()             { _flags |= MayThrow; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  void  set_does_jsr()              { _flags |= DoesJsr; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  void  clear_does_jsr()            { _flags &= ~DoesJsr; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  void  set_does_ret()              { _flags |= DoesRet; }
199
fb51d01039ff 6621084: ciMethodBlocks::split_block_at() is broken for methods with exception handler
kvn
parents: 1
diff changeset
   121
  void  clear_does_ret()            { _flags &= ~DoesRet; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  void  set_is_ret_target()         { _flags |= RetTarget; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  void  set_has_handler()           { _flags |= HasHandler; }
199
fb51d01039ff 6621084: ciMethodBlocks::split_block_at() is broken for methods with exception handler
kvn
parents: 1
diff changeset
   124
  void  clear_exception_handler()   { _flags &= ~Handler; _ex_start_bci = -1; _ex_limit_bci = -1; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  ciMethod *method() const          { return _method; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  void dump();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  void print_on(outputStream* st) const  PRODUCT_RETURN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   131
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
   132
#endif // SHARE_CI_CIMETHODBLOCKS_HPP