Mercurial > hg > graal-compiler
annotate src/share/vm/ci/bcEscapeAnalyzer.hpp @ 1766:02f0a9b6f654
6969586: OptimizeStringConcat: SIGSEGV in LoadNode::Value()
Reviewed-by: kvn
author | never |
---|---|
date | Mon, 30 Aug 2010 17:27:35 -0700 |
parents | 8099e71601df |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1123
diff
changeset
|
2 * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1123
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1123
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1123
diff
changeset
|
21 * questions. |
0 | 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: | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
34 Arena* _arena; // ciEnv arena |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
35 |
0 | 36 bool _conservative; // If true, return maximally |
37 // conservative results. | |
38 ciMethod* _method; | |
39 ciMethodData* _methodData; | |
40 int _arg_size; | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
41 VectorSet _arg_local; |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
42 VectorSet _arg_stack; |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
43 VectorSet _arg_returned; |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
44 VectorSet _dirty; |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
45 enum{ ARG_OFFSET_MAX = 31}; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
46 uint *_arg_modified; |
0 | 47 |
48 bool _return_local; | |
78
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
49 bool _return_allocated; |
0 | 50 bool _allocated_escapes; |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
51 bool _unknown_modified; |
0 | 52 |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
53 GrowableArray<ciObject *> _dependencies; |
0 | 54 |
55 ciMethodBlocks *_methodBlocks; | |
56 | |
57 BCEscapeAnalyzer* _parent; | |
58 int _level; | |
59 | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
196
diff
changeset
|
60 public: |
0 | 61 class ArgumentMap; |
62 class StateInfo; | |
63 | |
1123
167c2986d91b
6843629: Make current hotspot build part of jdk5 control build
phh
parents:
196
diff
changeset
|
64 private: |
0 | 65 // helper functions |
66 bool is_argument(int i) { return i >= 0 && i < _arg_size; } | |
67 void set_returned(ArgumentMap vars); | |
68 bool is_argument(ArgumentMap vars); | |
69 bool is_arg_stack(ArgumentMap vars); | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
70 void clear_bits(ArgumentMap vars, VectorSet &bs); |
0 | 71 void set_method_escape(ArgumentMap vars); |
72 void set_global_escape(ArgumentMap vars); | |
73 void set_dirty(ArgumentMap vars); | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
74 void set_modified(ArgumentMap vars, int offs, int size); |
0 | 75 |
76 bool is_recursive_call(ciMethod* callee); | |
77 void add_dependence(ciKlass *klass, ciMethod *meth); | |
78 void propagate_dependencies(ciMethod *meth); | |
79 void invoke(StateInfo &state, Bytecodes::Code code, ciMethod* target, ciKlass* holder); | |
80 | |
81 void iterate_one_block(ciBlock *blk, StateInfo &state, GrowableArray<ciBlock *> &successors); | |
82 void iterate_blocks(Arena *); | |
83 void merge_block_states(StateInfo *blockstates, ciBlock *dest, StateInfo *s_state); | |
84 | |
85 // analysis | |
86 void initialize(); | |
87 void clear_escape_info(); | |
88 void compute_escape_info(); | |
89 vmIntrinsics::ID known_intrinsic(); | |
90 bool compute_escape_for_intrinsic(vmIntrinsics::ID iid); | |
91 bool do_analysis(); | |
92 | |
93 void read_escape_info(); | |
94 | |
95 bool contains(uint arg_set1, uint arg_set2); | |
96 | |
97 public: | |
98 BCEscapeAnalyzer(ciMethod* method, BCEscapeAnalyzer* parent = NULL); | |
99 | |
100 // accessors | |
101 ciMethod* method() const { return _method; } | |
102 ciMethodData* methodData() const { return _methodData; } | |
103 BCEscapeAnalyzer* parent() const { return _parent; } | |
104 int level() const { return _level; } | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
105 GrowableArray<ciObject *>* dependencies() { return &_dependencies; } |
0 | 106 bool has_dependencies() const { return !_dependencies.is_empty(); } |
107 | |
108 // retrieval of interprocedural escape information | |
109 | |
110 // The given argument does not escape the callee. | |
111 bool is_arg_local(int i) const { | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
112 return !_conservative && _arg_local.test(i); |
0 | 113 } |
114 | |
115 // The given argument escapes the callee, but does not become globally | |
116 // reachable. | |
117 bool is_arg_stack(int i) const { | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
118 return !_conservative && _arg_stack.test(i); |
0 | 119 } |
120 | |
121 // The given argument does not escape globally, and may be returned. | |
122 bool is_arg_returned(int i) const { | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
123 return !_conservative && _arg_returned.test(i); } |
0 | 124 |
125 // True iff only input arguments are returned. | |
126 bool is_return_local() const { | |
127 return !_conservative && _return_local; | |
128 } | |
129 | |
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 | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
135 // Tracking of argument modification |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
136 |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
137 enum {OFFSET_ANY = -1}; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
138 bool is_arg_modified(int arg, int offset, int size_in_bytes); |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
139 void set_arg_modified(int arg, int offset, int size_in_bytes); |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
140 bool has_non_arg_side_affects() { return _unknown_modified; } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
141 |
0 | 142 // Copy dependencies from this analysis into "deps" |
143 void copy_dependencies(Dependencies *deps); | |
78
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
144 |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
145 #ifndef PRODUCT |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
146 // dump escape information |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
147 void dump(); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
148 #endif |
0 | 149 }; |