src/share/vm/ci/ciMethodBlocks.hpp

Wed, 23 Oct 2013 12:40:23 +0200

author
roland
date
Wed, 23 Oct 2013 12:40:23 +0200
changeset 5991
b2ee5dc63353
parent 2314
f95d63e2154a
child 6876
710a3c8b516e
permissions
-rw-r--r--

8024070: C2 needs some form of type speculation
Summary: record unused type profile information with type system, propagate and use it.
Reviewed-by: kvn, twisti

duke@435 1 /*
stefank@2314 2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_CI_CIMETHODBLOCKS_HPP
stefank@2314 26 #define SHARE_VM_CI_CIMETHODBLOCKS_HPP
stefank@2314 27
stefank@2314 28 #include "ci/ciMethod.hpp"
stefank@2314 29 #include "memory/resourceArea.hpp"
stefank@2314 30 #include "utilities/growableArray.hpp"
stefank@2314 31
duke@435 32
duke@435 33 class ciBlock;
duke@435 34
duke@435 35 typedef short ciBlockIndex;
duke@435 36
duke@435 37 class ciMethodBlocks : public ResourceObj {
duke@435 38 private:
duke@435 39 ciMethod *_method;
duke@435 40 Arena *_arena;
duke@435 41 GrowableArray<ciBlock *> *_blocks;
duke@435 42 ciBlock **_bci_to_block;
duke@435 43 int _num_blocks;
duke@435 44 int _code_size;
duke@435 45
duke@435 46 void do_analysis();
duke@435 47 public:
duke@435 48 ciMethodBlocks(Arena *arena, ciMethod *meth);
duke@435 49
duke@435 50 ciBlock *block_containing(int bci);
duke@435 51 ciBlock *block(int index) { return _blocks->at(index); }
duke@435 52 ciBlock *make_block_at(int bci);
duke@435 53 ciBlock *split_block_at(int bci);
duke@435 54 bool is_block_start(int bci);
duke@435 55 int num_blocks() { return _num_blocks;}
duke@435 56 void clear_processed();
duke@435 57
never@802 58 ciBlock *make_dummy_block(); // a block not associated with a bci
never@802 59
duke@435 60 #ifndef PRODUCT
duke@435 61 void dump();
duke@435 62 #endif
duke@435 63 };
duke@435 64
duke@435 65 class ciBlock : public ResourceObj {
duke@435 66 private:
duke@435 67 int _idx;
duke@435 68 int _start_bci;
duke@435 69 int _limit_bci;
duke@435 70 int _control_bci;
duke@435 71 uint _flags;
duke@435 72 int _ex_start_bci;
duke@435 73 int _ex_limit_bci;
duke@435 74 #ifndef PRODUCT
duke@435 75 ciMethod *_method;
duke@435 76 #endif
duke@435 77 enum {
duke@435 78 Processed = (1 << 0),
duke@435 79 Handler = (1 << 1),
duke@435 80 MayThrow = (1 << 2),
duke@435 81 DoesJsr = (1 << 3),
duke@435 82 DoesRet = (1 << 4),
duke@435 83 RetTarget = (1 << 5),
duke@435 84 HasHandler = (1 << 6)
duke@435 85 };
duke@435 86
duke@435 87
duke@435 88 public:
duke@435 89 enum {
duke@435 90 fall_through_bci = -1
duke@435 91 };
duke@435 92
never@802 93 ciBlock(ciMethod *method, int index, int start_bci);
duke@435 94 int start_bci() const { return _start_bci; }
duke@435 95 int limit_bci() const { return _limit_bci; }
duke@435 96 int control_bci() const { return _control_bci; }
duke@435 97 int index() const { return _idx; }
duke@435 98 void set_start_bci(int bci) { _start_bci = bci; }
duke@435 99 void set_limit_bci(int bci) { _limit_bci = bci; }
duke@435 100 void set_control_bci(int bci) { _control_bci = bci;}
duke@435 101 void set_exception_range(int start_bci, int limit_bci);
duke@435 102 int ex_start_bci() const { return _ex_start_bci; }
duke@435 103 int ex_limit_bci() const { return _ex_limit_bci; }
duke@435 104 bool contains(int bci) const { return start_bci() <= bci && bci < limit_bci(); }
duke@435 105
duke@435 106 // flag handling
duke@435 107 bool processed() const { return (_flags & Processed) != 0; }
duke@435 108 bool is_handler() const { return (_flags & Handler) != 0; }
duke@435 109 bool may_throw() const { return (_flags & MayThrow) != 0; }
duke@435 110 bool does_jsr() const { return (_flags & DoesJsr) != 0; }
duke@435 111 bool does_ret() const { return (_flags & DoesRet) != 0; }
duke@435 112 bool has_handler() const { return (_flags & HasHandler) != 0; }
duke@435 113 bool is_ret_target() const { return (_flags & RetTarget) != 0; }
duke@435 114 void set_processed() { _flags |= Processed; }
duke@435 115 void clear_processed() { _flags &= ~Processed; }
duke@435 116 void set_handler() { _flags |= Handler; }
duke@435 117 void set_may_throw() { _flags |= MayThrow; }
duke@435 118 void set_does_jsr() { _flags |= DoesJsr; }
duke@435 119 void clear_does_jsr() { _flags &= ~DoesJsr; }
duke@435 120 void set_does_ret() { _flags |= DoesRet; }
kvn@461 121 void clear_does_ret() { _flags &= ~DoesRet; }
duke@435 122 void set_is_ret_target() { _flags |= RetTarget; }
duke@435 123 void set_has_handler() { _flags |= HasHandler; }
kvn@461 124 void clear_exception_handler() { _flags &= ~Handler; _ex_start_bci = -1; _ex_limit_bci = -1; }
duke@435 125 #ifndef PRODUCT
duke@435 126 ciMethod *method() const { return _method; }
duke@435 127 void dump();
duke@435 128 void print_on(outputStream* st) const PRODUCT_RETURN;
duke@435 129 #endif
duke@435 130 };
stefank@2314 131
stefank@2314 132 #endif // SHARE_VM_CI_CIMETHODBLOCKS_HPP

mercurial