src/share/vm/ci/ciMethodBlocks.hpp

Wed, 06 Jan 2010 14:22:39 -0800

author
never
date
Wed, 06 Jan 2010 14:22:39 -0800
changeset 1577
4ce7240d622c
parent 802
194b8e3a2fc4
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6914300: ciEnv should export all well known classes
Reviewed-by: kvn, twisti

duke@435 1 /*
xdono@631 2 * Copyright 2006-2008 Sun Microsystems, Inc. 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 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25
duke@435 26 class ciBlock;
duke@435 27
duke@435 28 typedef short ciBlockIndex;
duke@435 29
duke@435 30 class ciMethodBlocks : public ResourceObj {
duke@435 31 private:
duke@435 32 ciMethod *_method;
duke@435 33 Arena *_arena;
duke@435 34 GrowableArray<ciBlock *> *_blocks;
duke@435 35 ciBlock **_bci_to_block;
duke@435 36 int _num_blocks;
duke@435 37 int _code_size;
duke@435 38
duke@435 39 void do_analysis();
duke@435 40 public:
duke@435 41 ciMethodBlocks(Arena *arena, ciMethod *meth);
duke@435 42
duke@435 43 ciBlock *block_containing(int bci);
duke@435 44 ciBlock *block(int index) { return _blocks->at(index); }
duke@435 45 ciBlock *make_block_at(int bci);
duke@435 46 ciBlock *split_block_at(int bci);
duke@435 47 bool is_block_start(int bci);
duke@435 48 int num_blocks() { return _num_blocks;}
duke@435 49 void clear_processed();
duke@435 50
never@802 51 ciBlock *make_dummy_block(); // a block not associated with a bci
never@802 52
duke@435 53 #ifndef PRODUCT
duke@435 54 void dump();
duke@435 55 #endif
duke@435 56 };
duke@435 57
duke@435 58 class ciBlock : public ResourceObj {
duke@435 59 private:
duke@435 60 int _idx;
duke@435 61 int _start_bci;
duke@435 62 int _limit_bci;
duke@435 63 int _control_bci;
duke@435 64 uint _flags;
duke@435 65 int _ex_start_bci;
duke@435 66 int _ex_limit_bci;
duke@435 67 #ifndef PRODUCT
duke@435 68 ciMethod *_method;
duke@435 69 #endif
duke@435 70 enum {
duke@435 71 Processed = (1 << 0),
duke@435 72 Handler = (1 << 1),
duke@435 73 MayThrow = (1 << 2),
duke@435 74 DoesJsr = (1 << 3),
duke@435 75 DoesRet = (1 << 4),
duke@435 76 RetTarget = (1 << 5),
duke@435 77 HasHandler = (1 << 6)
duke@435 78 };
duke@435 79
duke@435 80
duke@435 81 public:
duke@435 82 enum {
duke@435 83 fall_through_bci = -1
duke@435 84 };
duke@435 85
never@802 86 ciBlock(ciMethod *method, int index, int start_bci);
duke@435 87 int start_bci() const { return _start_bci; }
duke@435 88 int limit_bci() const { return _limit_bci; }
duke@435 89 int control_bci() const { return _control_bci; }
duke@435 90 int index() const { return _idx; }
duke@435 91 void set_start_bci(int bci) { _start_bci = bci; }
duke@435 92 void set_limit_bci(int bci) { _limit_bci = bci; }
duke@435 93 void set_control_bci(int bci) { _control_bci = bci;}
duke@435 94 void set_exception_range(int start_bci, int limit_bci);
duke@435 95 int ex_start_bci() const { return _ex_start_bci; }
duke@435 96 int ex_limit_bci() const { return _ex_limit_bci; }
duke@435 97 bool contains(int bci) const { return start_bci() <= bci && bci < limit_bci(); }
duke@435 98
duke@435 99 // flag handling
duke@435 100 bool processed() const { return (_flags & Processed) != 0; }
duke@435 101 bool is_handler() const { return (_flags & Handler) != 0; }
duke@435 102 bool may_throw() const { return (_flags & MayThrow) != 0; }
duke@435 103 bool does_jsr() const { return (_flags & DoesJsr) != 0; }
duke@435 104 bool does_ret() const { return (_flags & DoesRet) != 0; }
duke@435 105 bool has_handler() const { return (_flags & HasHandler) != 0; }
duke@435 106 bool is_ret_target() const { return (_flags & RetTarget) != 0; }
duke@435 107 void set_processed() { _flags |= Processed; }
duke@435 108 void clear_processed() { _flags &= ~Processed; }
duke@435 109 void set_handler() { _flags |= Handler; }
duke@435 110 void set_may_throw() { _flags |= MayThrow; }
duke@435 111 void set_does_jsr() { _flags |= DoesJsr; }
duke@435 112 void clear_does_jsr() { _flags &= ~DoesJsr; }
duke@435 113 void set_does_ret() { _flags |= DoesRet; }
kvn@461 114 void clear_does_ret() { _flags &= ~DoesRet; }
duke@435 115 void set_is_ret_target() { _flags |= RetTarget; }
duke@435 116 void set_has_handler() { _flags |= HasHandler; }
kvn@461 117 void clear_exception_handler() { _flags &= ~Handler; _ex_start_bci = -1; _ex_limit_bci = -1; }
duke@435 118 #ifndef PRODUCT
duke@435 119 ciMethod *method() const { return _method; }
duke@435 120 void dump();
duke@435 121 void print_on(outputStream* st) const PRODUCT_RETURN;
duke@435 122 #endif
duke@435 123 };

mercurial