annotate src/share/vm/ci/ciMethodBlocks.hpp @ 196:d1605aabd0a1 jdk7-b30

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents 0871d5cd64cd
children 194b8e3a2fc4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
196
d1605aabd0a1 6719955: Update copyright year
xdono
parents: 26
diff changeset
2 * Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25
a61af66fc99e Initial load
duke
parents:
diff changeset
26 class ciBlock;
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 typedef short ciBlockIndex;
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 class ciMethodBlocks : public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
32 ciMethod *_method;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 Arena *_arena;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 GrowableArray<ciBlock *> *_blocks;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 ciBlock **_bci_to_block;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 int _num_blocks;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 int _code_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 void do_analysis();
a61af66fc99e Initial load
duke
parents:
diff changeset
40 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
41 ciMethodBlocks(Arena *arena, ciMethod *meth);
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 ciBlock *block_containing(int bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
44 ciBlock *block(int index) { return _blocks->at(index); }
a61af66fc99e Initial load
duke
parents:
diff changeset
45 ciBlock *make_block_at(int bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 ciBlock *split_block_at(int bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
47 bool is_block_start(int bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
48 int num_blocks() { return _num_blocks;}
a61af66fc99e Initial load
duke
parents:
diff changeset
49 void clear_processed();
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
52 void dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
53 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
54 };
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 class ciBlock : public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
58 int _idx;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 int _start_bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 int _limit_bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 int _control_bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 uint _flags;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 int _ex_start_bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 int _ex_limit_bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
66 ciMethod *_method;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
68 enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
69 Processed = (1 << 0),
a61af66fc99e Initial load
duke
parents:
diff changeset
70 Handler = (1 << 1),
a61af66fc99e Initial load
duke
parents:
diff changeset
71 MayThrow = (1 << 2),
a61af66fc99e Initial load
duke
parents:
diff changeset
72 DoesJsr = (1 << 3),
a61af66fc99e Initial load
duke
parents:
diff changeset
73 DoesRet = (1 << 4),
a61af66fc99e Initial load
duke
parents:
diff changeset
74 RetTarget = (1 << 5),
a61af66fc99e Initial load
duke
parents:
diff changeset
75 HasHandler = (1 << 6)
a61af66fc99e Initial load
duke
parents:
diff changeset
76 };
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
80 enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 fall_through_bci = -1
a61af66fc99e Initial load
duke
parents:
diff changeset
82 };
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 ciBlock(ciMethod *method, int index, ciMethodBlocks *mb, int start_bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
85 int start_bci() const { return _start_bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
86 int limit_bci() const { return _limit_bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
87 int control_bci() const { return _control_bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
88 int index() const { return _idx; }
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void set_start_bci(int bci) { _start_bci = bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
90 void set_limit_bci(int bci) { _limit_bci = bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 void set_control_bci(int bci) { _control_bci = bci;}
a61af66fc99e Initial load
duke
parents:
diff changeset
92 void set_exception_range(int start_bci, int limit_bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
93 int ex_start_bci() const { return _ex_start_bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
94 int ex_limit_bci() const { return _ex_limit_bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
95 bool contains(int bci) const { return start_bci() <= bci && bci < limit_bci(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // flag handling
a61af66fc99e Initial load
duke
parents:
diff changeset
99 bool processed() const { return (_flags & Processed) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 bool is_handler() const { return (_flags & Handler) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 bool may_throw() const { return (_flags & MayThrow) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 bool does_jsr() const { return (_flags & DoesJsr) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 bool does_ret() const { return (_flags & DoesRet) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
104 bool has_handler() const { return (_flags & HasHandler) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
105 bool is_ret_target() const { return (_flags & RetTarget) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
106 void set_processed() { _flags |= Processed; }
a61af66fc99e Initial load
duke
parents:
diff changeset
107 void clear_processed() { _flags &= ~Processed; }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 void set_handler() { _flags |= Handler; }
a61af66fc99e Initial load
duke
parents:
diff changeset
109 void set_may_throw() { _flags |= MayThrow; }
a61af66fc99e Initial load
duke
parents:
diff changeset
110 void set_does_jsr() { _flags |= DoesJsr; }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 void clear_does_jsr() { _flags &= ~DoesJsr; }
a61af66fc99e Initial load
duke
parents:
diff changeset
112 void set_does_ret() { _flags |= DoesRet; }
26
0871d5cd64cd 6621084: ciMethodBlocks::split_block_at() is broken for methods with exception handler
kvn
parents: 0
diff changeset
113 void clear_does_ret() { _flags &= ~DoesRet; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
114 void set_is_ret_target() { _flags |= RetTarget; }
a61af66fc99e Initial load
duke
parents:
diff changeset
115 void set_has_handler() { _flags |= HasHandler; }
26
0871d5cd64cd 6621084: ciMethodBlocks::split_block_at() is broken for methods with exception handler
kvn
parents: 0
diff changeset
116 void clear_exception_handler() { _flags &= ~Handler; _ex_start_bci = -1; _ex_limit_bci = -1; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
117 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
118 ciMethod *method() const { return _method; }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 void dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
120 void print_on(outputStream* st) const PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
121 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
122 };