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