1 /*
2 * Copyright (c) 2005, 2008, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // This class implements a fast, conservative analysis of effect of methods
26 // on the escape state of their arguments. The analysis is at the bytecode
27 // level.
28
29 class ciMethodBlocks;
30 class ciBlock;
31
32 class BCEscapeAnalyzer : public ResourceObj {
33 private:
34 Arena* _arena; // ciEnv arena
35
36 bool _conservative; // If true, return maximally
37 // conservative results.
38 ciMethod* _method;
39 ciMethodData* _methodData;
40 int _arg_size;
41 VectorSet _arg_local;
42 VectorSet _arg_stack;
43 VectorSet _arg_returned;
44 VectorSet _dirty;
130 // True iff only newly allocated unescaped objects are returned.
131 bool is_return_allocated() const {
132 return !_conservative && _return_allocated && !_allocated_escapes;
133 }
134
135 // Tracking of argument modification
136
137 enum {OFFSET_ANY = -1};
138 bool is_arg_modified(int arg, int offset, int size_in_bytes);
139 void set_arg_modified(int arg, int offset, int size_in_bytes);
140 bool has_non_arg_side_affects() { return _unknown_modified; }
141
142 // Copy dependencies from this analysis into "deps"
143 void copy_dependencies(Dependencies *deps);
144
145 #ifndef PRODUCT
146 // dump escape information
147 void dump();
148 #endif
149 };
|
1 /*
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_CI_BCESCAPEANALYZER_HPP
26 #define SHARE_VM_CI_BCESCAPEANALYZER_HPP
27
28 #ifdef COMPILER2
29 #include "ci/ciMethod.hpp"
30 #include "ci/ciMethodData.hpp"
31 #include "code/dependencies.hpp"
32 #include "libadt/vectset.hpp"
33 #include "memory/allocation.hpp"
34 #include "utilities/growableArray.hpp"
35 #endif
36
37 // This class implements a fast, conservative analysis of effect of methods
38 // on the escape state of their arguments. The analysis is at the bytecode
39 // level.
40
41 class ciMethodBlocks;
42 class ciBlock;
43
44 class BCEscapeAnalyzer : public ResourceObj {
45 private:
46 Arena* _arena; // ciEnv arena
47
48 bool _conservative; // If true, return maximally
49 // conservative results.
50 ciMethod* _method;
51 ciMethodData* _methodData;
52 int _arg_size;
53 VectorSet _arg_local;
54 VectorSet _arg_stack;
55 VectorSet _arg_returned;
56 VectorSet _dirty;
142 // True iff only newly allocated unescaped objects are returned.
143 bool is_return_allocated() const {
144 return !_conservative && _return_allocated && !_allocated_escapes;
145 }
146
147 // Tracking of argument modification
148
149 enum {OFFSET_ANY = -1};
150 bool is_arg_modified(int arg, int offset, int size_in_bytes);
151 void set_arg_modified(int arg, int offset, int size_in_bytes);
152 bool has_non_arg_side_affects() { return _unknown_modified; }
153
154 // Copy dependencies from this analysis into "deps"
155 void copy_dependencies(Dependencies *deps);
156
157 #ifndef PRODUCT
158 // dump escape information
159 void dump();
160 #endif
161 };
162
163 #endif // SHARE_VM_CI_BCESCAPEANALYZER_HPP
|