src/share/vm/ci/ciTypeFlow.hpp

Tue, 08 Aug 2017 15:57:29 +0800

author
aoqi
date
Tue, 08 Aug 2017 15:57:29 +0800
changeset 6876
710a3c8b516e
parent 4153
b9a9ed0f8eeb
parent 0
f90c822e73f8
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_CI_CITYPEFLOW_HPP
aoqi@0 26 #define SHARE_VM_CI_CITYPEFLOW_HPP
aoqi@0 27
aoqi@0 28 #ifdef COMPILER2
aoqi@0 29 #include "ci/ciEnv.hpp"
aoqi@0 30 #include "ci/ciKlass.hpp"
aoqi@0 31 #include "ci/ciMethodBlocks.hpp"
aoqi@0 32 #endif
aoqi@0 33 #ifdef SHARK
aoqi@0 34 #include "ci/ciEnv.hpp"
aoqi@0 35 #include "ci/ciKlass.hpp"
aoqi@0 36 #include "ci/ciMethodBlocks.hpp"
aoqi@0 37 #include "shark/shark_globals.hpp"
aoqi@0 38 #endif
aoqi@0 39
aoqi@0 40
aoqi@0 41 class ciTypeFlow : public ResourceObj {
aoqi@0 42 private:
aoqi@0 43 ciEnv* _env;
aoqi@0 44 ciMethod* _method;
aoqi@0 45 ciMethodBlocks* _methodBlocks;
aoqi@0 46 int _osr_bci;
aoqi@0 47
aoqi@0 48 // information cached from the method:
aoqi@0 49 int _max_locals;
aoqi@0 50 int _max_stack;
aoqi@0 51 int _code_size;
aoqi@0 52 bool _has_irreducible_entry;
aoqi@0 53
aoqi@0 54 const char* _failure_reason;
aoqi@0 55
aoqi@0 56 public:
aoqi@0 57 class StateVector;
aoqi@0 58 class Loop;
aoqi@0 59 class Block;
aoqi@0 60
aoqi@0 61 // Build a type flow analyzer
aoqi@0 62 // Do an OSR analysis if osr_bci >= 0.
aoqi@0 63 ciTypeFlow(ciEnv* env, ciMethod* method, int osr_bci = InvocationEntryBci);
aoqi@0 64
aoqi@0 65 // Accessors
aoqi@0 66 ciMethod* method() const { return _method; }
aoqi@0 67 ciEnv* env() { return _env; }
aoqi@0 68 Arena* arena() { return _env->arena(); }
aoqi@0 69 bool is_osr_flow() const{ return _osr_bci != InvocationEntryBci; }
aoqi@0 70 int start_bci() const { return is_osr_flow()? _osr_bci: 0; }
aoqi@0 71 int max_locals() const { return _max_locals; }
aoqi@0 72 int max_stack() const { return _max_stack; }
aoqi@0 73 int max_cells() const { return _max_locals + _max_stack; }
aoqi@0 74 int code_size() const { return _code_size; }
aoqi@0 75 bool has_irreducible_entry() const { return _has_irreducible_entry; }
aoqi@0 76
aoqi@0 77 // Represents information about an "active" jsr call. This
aoqi@0 78 // class represents a call to the routine at some entry address
aoqi@0 79 // with some distinct return address.
aoqi@0 80 class JsrRecord : public ResourceObj {
aoqi@0 81 private:
aoqi@0 82 int _entry_address;
aoqi@0 83 int _return_address;
aoqi@0 84 public:
aoqi@0 85 JsrRecord(int entry_address, int return_address) {
aoqi@0 86 _entry_address = entry_address;
aoqi@0 87 _return_address = return_address;
aoqi@0 88 }
aoqi@0 89
aoqi@0 90 int entry_address() const { return _entry_address; }
aoqi@0 91 int return_address() const { return _return_address; }
aoqi@0 92
aoqi@0 93 void print_on(outputStream* st) const {
aoqi@0 94 #ifndef PRODUCT
aoqi@0 95 st->print("%d->%d", entry_address(), return_address());
aoqi@0 96 #endif
aoqi@0 97 }
aoqi@0 98 };
aoqi@0 99
aoqi@0 100 // A JsrSet represents some set of JsrRecords. This class
aoqi@0 101 // is used to record a set of all jsr routines which we permit
aoqi@0 102 // execution to return (ret) from.
aoqi@0 103 //
aoqi@0 104 // During abstract interpretation, JsrSets are used to determine
aoqi@0 105 // whether two paths which reach a given block are unique, and
aoqi@0 106 // should be cloned apart, or are compatible, and should merge
aoqi@0 107 // together.
aoqi@0 108 //
aoqi@0 109 // Note that different amounts of effort can be expended determining
aoqi@0 110 // if paths are compatible. <DISCUSSION>
aoqi@0 111 class JsrSet : public ResourceObj {
aoqi@0 112 private:
aoqi@0 113 GrowableArray<JsrRecord*>* _set;
aoqi@0 114
aoqi@0 115 JsrRecord* record_at(int i) {
aoqi@0 116 return _set->at(i);
aoqi@0 117 }
aoqi@0 118
aoqi@0 119 // Insert the given JsrRecord into the JsrSet, maintaining the order
aoqi@0 120 // of the set and replacing any element with the same entry address.
aoqi@0 121 void insert_jsr_record(JsrRecord* record);
aoqi@0 122
aoqi@0 123 // Remove the JsrRecord with the given return address from the JsrSet.
aoqi@0 124 void remove_jsr_record(int return_address);
aoqi@0 125
aoqi@0 126 public:
aoqi@0 127 JsrSet(Arena* arena, int default_len = 4);
aoqi@0 128
aoqi@0 129 // Copy this JsrSet.
aoqi@0 130 void copy_into(JsrSet* jsrs);
aoqi@0 131
aoqi@0 132 // Is this JsrSet compatible with some other JsrSet?
aoqi@0 133 bool is_compatible_with(JsrSet* other);
aoqi@0 134
aoqi@0 135 // Apply the effect of a single bytecode to the JsrSet.
aoqi@0 136 void apply_control(ciTypeFlow* analyzer,
aoqi@0 137 ciBytecodeStream* str,
aoqi@0 138 StateVector* state);
aoqi@0 139
aoqi@0 140 // What is the cardinality of this set?
aoqi@0 141 int size() const { return _set->length(); }
aoqi@0 142
aoqi@0 143 void print_on(outputStream* st) const PRODUCT_RETURN;
aoqi@0 144 };
aoqi@0 145
aoqi@0 146 class LocalSet VALUE_OBJ_CLASS_SPEC {
aoqi@0 147 private:
aoqi@0 148 enum Constants { max = 63 };
aoqi@0 149 uint64_t _bits;
aoqi@0 150 public:
aoqi@0 151 LocalSet() : _bits(0) {}
aoqi@0 152 void add(uint32_t i) { if (i < (uint32_t)max) _bits |= (1LL << i); }
aoqi@0 153 void add(LocalSet* ls) { _bits |= ls->_bits; }
aoqi@0 154 bool test(uint32_t i) const { return i < (uint32_t)max ? (_bits>>i)&1U : true; }
aoqi@0 155 void clear() { _bits = 0; }
aoqi@0 156 void print_on(outputStream* st, int limit) const PRODUCT_RETURN;
aoqi@0 157 };
aoqi@0 158
aoqi@0 159 // Used as a combined index for locals and temps
aoqi@0 160 enum Cell {
aoqi@0 161 Cell_0, Cell_max = INT_MAX
aoqi@0 162 };
aoqi@0 163
aoqi@0 164 // A StateVector summarizes the type information at some
aoqi@0 165 // point in the program
aoqi@0 166 class StateVector : public ResourceObj {
aoqi@0 167 private:
aoqi@0 168 ciType** _types;
aoqi@0 169 int _stack_size;
aoqi@0 170 int _monitor_count;
aoqi@0 171 ciTypeFlow* _outer;
aoqi@0 172
aoqi@0 173 int _trap_bci;
aoqi@0 174 int _trap_index;
aoqi@0 175
aoqi@0 176 LocalSet _def_locals; // For entire block
aoqi@0 177
aoqi@0 178 static ciType* type_meet_internal(ciType* t1, ciType* t2, ciTypeFlow* analyzer);
aoqi@0 179
aoqi@0 180 public:
aoqi@0 181 // Special elements in our type lattice.
aoqi@0 182 enum {
aoqi@0 183 T_TOP = T_VOID, // why not?
aoqi@0 184 T_BOTTOM = T_CONFLICT,
aoqi@0 185 T_LONG2 = T_SHORT, // 2nd word of T_LONG
aoqi@0 186 T_DOUBLE2 = T_CHAR, // 2nd word of T_DOUBLE
aoqi@0 187 T_NULL = T_BYTE // for now.
aoqi@0 188 };
aoqi@0 189 static ciType* top_type() { return ciType::make((BasicType)T_TOP); }
aoqi@0 190 static ciType* bottom_type() { return ciType::make((BasicType)T_BOTTOM); }
aoqi@0 191 static ciType* long2_type() { return ciType::make((BasicType)T_LONG2); }
aoqi@0 192 static ciType* double2_type(){ return ciType::make((BasicType)T_DOUBLE2); }
aoqi@0 193 static ciType* null_type() { return ciType::make((BasicType)T_NULL); }
aoqi@0 194
aoqi@0 195 static ciType* half_type(ciType* t) {
aoqi@0 196 switch (t->basic_type()) {
aoqi@0 197 case T_LONG: return long2_type();
aoqi@0 198 case T_DOUBLE: return double2_type();
aoqi@0 199 default: ShouldNotReachHere(); return NULL;
aoqi@0 200 }
aoqi@0 201 }
aoqi@0 202
aoqi@0 203 // The meet operation for our type lattice.
aoqi@0 204 ciType* type_meet(ciType* t1, ciType* t2) {
aoqi@0 205 return type_meet_internal(t1, t2, outer());
aoqi@0 206 }
aoqi@0 207
aoqi@0 208 // Accessors
aoqi@0 209 ciTypeFlow* outer() const { return _outer; }
aoqi@0 210
aoqi@0 211 int stack_size() const { return _stack_size; }
aoqi@0 212 void set_stack_size(int ss) { _stack_size = ss; }
aoqi@0 213
aoqi@0 214 int monitor_count() const { return _monitor_count; }
aoqi@0 215 void set_monitor_count(int mc) { _monitor_count = mc; }
aoqi@0 216
aoqi@0 217 LocalSet* def_locals() { return &_def_locals; }
aoqi@0 218 const LocalSet* def_locals() const { return &_def_locals; }
aoqi@0 219
aoqi@0 220 static Cell start_cell() { return (Cell)0; }
aoqi@0 221 static Cell next_cell(Cell c) { return (Cell)(((int)c) + 1); }
aoqi@0 222 Cell limit_cell() const {
aoqi@0 223 return (Cell)(outer()->max_locals() + stack_size());
aoqi@0 224 }
aoqi@0 225
aoqi@0 226 // Cell creation
aoqi@0 227 Cell local(int lnum) const {
aoqi@0 228 assert(lnum < outer()->max_locals(), "index check");
aoqi@0 229 return (Cell)(lnum);
aoqi@0 230 }
aoqi@0 231
aoqi@0 232 Cell stack(int snum) const {
aoqi@0 233 assert(snum < stack_size(), "index check");
aoqi@0 234 return (Cell)(outer()->max_locals() + snum);
aoqi@0 235 }
aoqi@0 236
aoqi@0 237 Cell tos() const { return stack(stack_size()-1); }
aoqi@0 238
aoqi@0 239 // For external use only:
aoqi@0 240 ciType* local_type_at(int i) const { return type_at(local(i)); }
aoqi@0 241 ciType* stack_type_at(int i) const { return type_at(stack(i)); }
aoqi@0 242
aoqi@0 243 // Accessors for the type of some Cell c
aoqi@0 244 ciType* type_at(Cell c) const {
aoqi@0 245 assert(start_cell() <= c && c < limit_cell(), "out of bounds");
aoqi@0 246 return _types[c];
aoqi@0 247 }
aoqi@0 248
aoqi@0 249 void set_type_at(Cell c, ciType* type) {
aoqi@0 250 assert(start_cell() <= c && c < limit_cell(), "out of bounds");
aoqi@0 251 _types[c] = type;
aoqi@0 252 }
aoqi@0 253
aoqi@0 254 // Top-of-stack operations.
aoqi@0 255 void set_type_at_tos(ciType* type) { set_type_at(tos(), type); }
aoqi@0 256 ciType* type_at_tos() const { return type_at(tos()); }
aoqi@0 257
aoqi@0 258 void push(ciType* type) {
aoqi@0 259 _stack_size++;
aoqi@0 260 set_type_at_tos(type);
aoqi@0 261 }
aoqi@0 262 void pop() {
aoqi@0 263 debug_only(set_type_at_tos(bottom_type()));
aoqi@0 264 _stack_size--;
aoqi@0 265 }
aoqi@0 266 ciType* pop_value() {
aoqi@0 267 ciType* t = type_at_tos();
aoqi@0 268 pop();
aoqi@0 269 return t;
aoqi@0 270 }
aoqi@0 271
aoqi@0 272 // Convenience operations.
aoqi@0 273 bool is_reference(ciType* type) const {
aoqi@0 274 return type == null_type() || !type->is_primitive_type();
aoqi@0 275 }
aoqi@0 276 bool is_int(ciType* type) const {
aoqi@0 277 return type->basic_type() == T_INT;
aoqi@0 278 }
aoqi@0 279 bool is_long(ciType* type) const {
aoqi@0 280 return type->basic_type() == T_LONG;
aoqi@0 281 }
aoqi@0 282 bool is_float(ciType* type) const {
aoqi@0 283 return type->basic_type() == T_FLOAT;
aoqi@0 284 }
aoqi@0 285 bool is_double(ciType* type) const {
aoqi@0 286 return type->basic_type() == T_DOUBLE;
aoqi@0 287 }
aoqi@0 288
aoqi@0 289 void store_to_local(int lnum) {
aoqi@0 290 _def_locals.add((uint) lnum);
aoqi@0 291 }
aoqi@0 292
aoqi@0 293 void push_translate(ciType* type);
aoqi@0 294
aoqi@0 295 void push_int() {
aoqi@0 296 push(ciType::make(T_INT));
aoqi@0 297 }
aoqi@0 298 void pop_int() {
aoqi@0 299 assert(is_int(type_at_tos()), "must be integer");
aoqi@0 300 pop();
aoqi@0 301 }
aoqi@0 302 void check_int(Cell c) {
aoqi@0 303 assert(is_int(type_at(c)), "must be integer");
aoqi@0 304 }
aoqi@0 305 void push_double() {
aoqi@0 306 push(ciType::make(T_DOUBLE));
aoqi@0 307 push(double2_type());
aoqi@0 308 }
aoqi@0 309 void pop_double() {
aoqi@0 310 assert(type_at_tos() == double2_type(), "must be 2nd half");
aoqi@0 311 pop();
aoqi@0 312 assert(is_double(type_at_tos()), "must be double");
aoqi@0 313 pop();
aoqi@0 314 }
aoqi@0 315 void push_float() {
aoqi@0 316 push(ciType::make(T_FLOAT));
aoqi@0 317 }
aoqi@0 318 void pop_float() {
aoqi@0 319 assert(is_float(type_at_tos()), "must be float");
aoqi@0 320 pop();
aoqi@0 321 }
aoqi@0 322 void push_long() {
aoqi@0 323 push(ciType::make(T_LONG));
aoqi@0 324 push(long2_type());
aoqi@0 325 }
aoqi@0 326 void pop_long() {
aoqi@0 327 assert(type_at_tos() == long2_type(), "must be 2nd half");
aoqi@0 328 pop();
aoqi@0 329 assert(is_long(type_at_tos()), "must be long");
aoqi@0 330 pop();
aoqi@0 331 }
aoqi@0 332 void push_object(ciKlass* klass) {
aoqi@0 333 push(klass);
aoqi@0 334 }
aoqi@0 335 void pop_object() {
aoqi@0 336 assert(is_reference(type_at_tos()), "must be reference type");
aoqi@0 337 pop();
aoqi@0 338 }
aoqi@0 339 void pop_array() {
aoqi@0 340 assert(type_at_tos() == null_type() ||
aoqi@0 341 type_at_tos()->is_array_klass(), "must be array type");
aoqi@0 342 pop();
aoqi@0 343 }
aoqi@0 344 // pop_objArray and pop_typeArray narrow the tos to ciObjArrayKlass
aoqi@0 345 // or ciTypeArrayKlass (resp.). In the rare case that an explicit
aoqi@0 346 // null is popped from the stack, we return NULL. Caller beware.
aoqi@0 347 ciObjArrayKlass* pop_objArray() {
aoqi@0 348 ciType* array = pop_value();
aoqi@0 349 if (array == null_type()) return NULL;
aoqi@0 350 assert(array->is_obj_array_klass(), "must be object array type");
aoqi@0 351 return array->as_obj_array_klass();
aoqi@0 352 }
aoqi@0 353 ciTypeArrayKlass* pop_typeArray() {
aoqi@0 354 ciType* array = pop_value();
aoqi@0 355 if (array == null_type()) return NULL;
aoqi@0 356 assert(array->is_type_array_klass(), "must be prim array type");
aoqi@0 357 return array->as_type_array_klass();
aoqi@0 358 }
aoqi@0 359 void push_null() {
aoqi@0 360 push(null_type());
aoqi@0 361 }
aoqi@0 362 void do_null_assert(ciKlass* unloaded_klass);
aoqi@0 363
aoqi@0 364 // Helper convenience routines.
aoqi@0 365 void do_aaload(ciBytecodeStream* str);
aoqi@0 366 void do_checkcast(ciBytecodeStream* str);
aoqi@0 367 void do_getfield(ciBytecodeStream* str);
aoqi@0 368 void do_getstatic(ciBytecodeStream* str);
aoqi@0 369 void do_invoke(ciBytecodeStream* str, bool has_receiver);
aoqi@0 370 void do_jsr(ciBytecodeStream* str);
aoqi@0 371 void do_ldc(ciBytecodeStream* str);
aoqi@0 372 void do_multianewarray(ciBytecodeStream* str);
aoqi@0 373 void do_new(ciBytecodeStream* str);
aoqi@0 374 void do_newarray(ciBytecodeStream* str);
aoqi@0 375 void do_putfield(ciBytecodeStream* str);
aoqi@0 376 void do_putstatic(ciBytecodeStream* str);
aoqi@0 377 void do_ret(ciBytecodeStream* str);
aoqi@0 378
aoqi@0 379 void overwrite_local_double_long(int index) {
aoqi@0 380 // Invalidate the previous local if it contains first half of
aoqi@0 381 // a double or long value since it's seconf half is being overwritten.
aoqi@0 382 int prev_index = index - 1;
aoqi@0 383 if (prev_index >= 0 &&
aoqi@0 384 (is_double(type_at(local(prev_index))) ||
aoqi@0 385 is_long(type_at(local(prev_index))))) {
aoqi@0 386 set_type_at(local(prev_index), bottom_type());
aoqi@0 387 }
aoqi@0 388 }
aoqi@0 389
aoqi@0 390 void load_local_object(int index) {
aoqi@0 391 ciType* type = type_at(local(index));
aoqi@0 392 assert(is_reference(type), "must be reference type");
aoqi@0 393 push(type);
aoqi@0 394 }
aoqi@0 395 void store_local_object(int index) {
aoqi@0 396 ciType* type = pop_value();
aoqi@0 397 assert(is_reference(type) || type->is_return_address(),
aoqi@0 398 "must be reference type or return address");
aoqi@0 399 overwrite_local_double_long(index);
aoqi@0 400 set_type_at(local(index), type);
aoqi@0 401 store_to_local(index);
aoqi@0 402 }
aoqi@0 403
aoqi@0 404 void load_local_double(int index) {
aoqi@0 405 ciType* type = type_at(local(index));
aoqi@0 406 ciType* type2 = type_at(local(index+1));
aoqi@0 407 assert(is_double(type), "must be double type");
aoqi@0 408 assert(type2 == double2_type(), "must be 2nd half");
aoqi@0 409 push(type);
aoqi@0 410 push(double2_type());
aoqi@0 411 }
aoqi@0 412 void store_local_double(int index) {
aoqi@0 413 ciType* type2 = pop_value();
aoqi@0 414 ciType* type = pop_value();
aoqi@0 415 assert(is_double(type), "must be double");
aoqi@0 416 assert(type2 == double2_type(), "must be 2nd half");
aoqi@0 417 overwrite_local_double_long(index);
aoqi@0 418 set_type_at(local(index), type);
aoqi@0 419 set_type_at(local(index+1), type2);
aoqi@0 420 store_to_local(index);
aoqi@0 421 store_to_local(index+1);
aoqi@0 422 }
aoqi@0 423
aoqi@0 424 void load_local_float(int index) {
aoqi@0 425 ciType* type = type_at(local(index));
aoqi@0 426 assert(is_float(type), "must be float type");
aoqi@0 427 push(type);
aoqi@0 428 }
aoqi@0 429 void store_local_float(int index) {
aoqi@0 430 ciType* type = pop_value();
aoqi@0 431 assert(is_float(type), "must be float type");
aoqi@0 432 overwrite_local_double_long(index);
aoqi@0 433 set_type_at(local(index), type);
aoqi@0 434 store_to_local(index);
aoqi@0 435 }
aoqi@0 436
aoqi@0 437 void load_local_int(int index) {
aoqi@0 438 ciType* type = type_at(local(index));
aoqi@0 439 assert(is_int(type), "must be int type");
aoqi@0 440 push(type);
aoqi@0 441 }
aoqi@0 442 void store_local_int(int index) {
aoqi@0 443 ciType* type = pop_value();
aoqi@0 444 assert(is_int(type), "must be int type");
aoqi@0 445 overwrite_local_double_long(index);
aoqi@0 446 set_type_at(local(index), type);
aoqi@0 447 store_to_local(index);
aoqi@0 448 }
aoqi@0 449
aoqi@0 450 void load_local_long(int index) {
aoqi@0 451 ciType* type = type_at(local(index));
aoqi@0 452 ciType* type2 = type_at(local(index+1));
aoqi@0 453 assert(is_long(type), "must be long type");
aoqi@0 454 assert(type2 == long2_type(), "must be 2nd half");
aoqi@0 455 push(type);
aoqi@0 456 push(long2_type());
aoqi@0 457 }
aoqi@0 458 void store_local_long(int index) {
aoqi@0 459 ciType* type2 = pop_value();
aoqi@0 460 ciType* type = pop_value();
aoqi@0 461 assert(is_long(type), "must be long");
aoqi@0 462 assert(type2 == long2_type(), "must be 2nd half");
aoqi@0 463 overwrite_local_double_long(index);
aoqi@0 464 set_type_at(local(index), type);
aoqi@0 465 set_type_at(local(index+1), type2);
aoqi@0 466 store_to_local(index);
aoqi@0 467 store_to_local(index+1);
aoqi@0 468 }
aoqi@0 469
aoqi@0 470 // Stop interpretation of this path with a trap.
aoqi@0 471 void trap(ciBytecodeStream* str, ciKlass* klass, int index);
aoqi@0 472
aoqi@0 473 public:
aoqi@0 474 StateVector(ciTypeFlow* outer);
aoqi@0 475
aoqi@0 476 // Copy our value into some other StateVector
aoqi@0 477 void copy_into(StateVector* copy) const;
aoqi@0 478
aoqi@0 479 // Meets this StateVector with another, destructively modifying this
aoqi@0 480 // one. Returns true if any modification takes place.
aoqi@0 481 bool meet(const StateVector* incoming);
aoqi@0 482
aoqi@0 483 // Ditto, except that the incoming state is coming from an exception.
aoqi@0 484 bool meet_exception(ciInstanceKlass* exc, const StateVector* incoming);
aoqi@0 485
aoqi@0 486 // Apply the effect of one bytecode to this StateVector
aoqi@0 487 bool apply_one_bytecode(ciBytecodeStream* stream);
aoqi@0 488
aoqi@0 489 // What is the bci of the trap?
aoqi@0 490 int trap_bci() { return _trap_bci; }
aoqi@0 491
aoqi@0 492 // What is the index associated with the trap?
aoqi@0 493 int trap_index() { return _trap_index; }
aoqi@0 494
aoqi@0 495 void print_cell_on(outputStream* st, Cell c) const PRODUCT_RETURN;
aoqi@0 496 void print_on(outputStream* st) const PRODUCT_RETURN;
aoqi@0 497 };
aoqi@0 498
aoqi@0 499 // Parameter for "find_block" calls:
aoqi@0 500 // Describes the difference between a public and backedge copy.
aoqi@0 501 enum CreateOption {
aoqi@0 502 create_public_copy,
aoqi@0 503 create_backedge_copy,
aoqi@0 504 no_create
aoqi@0 505 };
aoqi@0 506
aoqi@0 507 // Successor iterator
aoqi@0 508 class SuccIter : public StackObj {
aoqi@0 509 private:
aoqi@0 510 Block* _pred;
aoqi@0 511 int _index;
aoqi@0 512 Block* _succ;
aoqi@0 513 public:
aoqi@0 514 SuccIter() : _pred(NULL), _index(-1), _succ(NULL) {}
aoqi@0 515 SuccIter(Block* pred) : _pred(pred), _index(-1), _succ(NULL) { next(); }
aoqi@0 516 int index() { return _index; }
aoqi@0 517 Block* pred() { return _pred; } // Return predecessor
aoqi@0 518 bool done() { return _index < 0; } // Finished?
aoqi@0 519 Block* succ() { return _succ; } // Return current successor
aoqi@0 520 void next(); // Advance
aoqi@0 521 void set_succ(Block* succ); // Update current successor
aoqi@0 522 bool is_normal_ctrl() { return index() < _pred->successors()->length(); }
aoqi@0 523 };
aoqi@0 524
aoqi@0 525 // A basic block
aoqi@0 526 class Block : public ResourceObj {
aoqi@0 527 private:
aoqi@0 528 ciBlock* _ciblock;
aoqi@0 529 GrowableArray<Block*>* _exceptions;
aoqi@0 530 GrowableArray<ciInstanceKlass*>* _exc_klasses;
aoqi@0 531 GrowableArray<Block*>* _successors;
aoqi@0 532 StateVector* _state;
aoqi@0 533 JsrSet* _jsrs;
aoqi@0 534
aoqi@0 535 int _trap_bci;
aoqi@0 536 int _trap_index;
aoqi@0 537
aoqi@0 538 // pre_order, assigned at first visit. Used as block ID and "visited" tag
aoqi@0 539 int _pre_order;
aoqi@0 540
aoqi@0 541 // A post-order, used to compute the reverse post order (RPO) provided to the client
aoqi@0 542 int _post_order; // used to compute rpo
aoqi@0 543
aoqi@0 544 // Has this block been cloned for a loop backedge?
aoqi@0 545 bool _backedge_copy;
aoqi@0 546
aoqi@0 547 // This block is entry to irreducible loop.
aoqi@0 548 bool _irreducible_entry;
aoqi@0 549
aoqi@0 550 // This block has monitor entry point.
aoqi@0 551 bool _has_monitorenter;
aoqi@0 552
aoqi@0 553 // A pointer used for our internal work list
aoqi@0 554 bool _on_work_list; // on the work list
aoqi@0 555 Block* _next;
aoqi@0 556 Block* _rpo_next; // Reverse post order list
aoqi@0 557
aoqi@0 558 // Loop info
aoqi@0 559 Loop* _loop; // nearest loop
aoqi@0 560
aoqi@0 561 ciBlock* ciblock() const { return _ciblock; }
aoqi@0 562 StateVector* state() const { return _state; }
aoqi@0 563
aoqi@0 564 // Compute the exceptional successors and types for this Block.
aoqi@0 565 void compute_exceptions();
aoqi@0 566
aoqi@0 567 public:
aoqi@0 568 // constructors
aoqi@0 569 Block(ciTypeFlow* outer, ciBlock* ciblk, JsrSet* jsrs);
aoqi@0 570
aoqi@0 571 void set_trap(int trap_bci, int trap_index) {
aoqi@0 572 _trap_bci = trap_bci;
aoqi@0 573 _trap_index = trap_index;
aoqi@0 574 assert(has_trap(), "");
aoqi@0 575 }
aoqi@0 576 bool has_trap() const { return _trap_bci != -1; }
aoqi@0 577 int trap_bci() const { assert(has_trap(), ""); return _trap_bci; }
aoqi@0 578 int trap_index() const { assert(has_trap(), ""); return _trap_index; }
aoqi@0 579
aoqi@0 580 // accessors
aoqi@0 581 ciTypeFlow* outer() const { return state()->outer(); }
aoqi@0 582 int start() const { return _ciblock->start_bci(); }
aoqi@0 583 int limit() const { return _ciblock->limit_bci(); }
aoqi@0 584 int control() const { return _ciblock->control_bci(); }
aoqi@0 585 JsrSet* jsrs() const { return _jsrs; }
aoqi@0 586
aoqi@0 587 bool is_backedge_copy() const { return _backedge_copy; }
aoqi@0 588 void set_backedge_copy(bool z);
aoqi@0 589 int backedge_copy_count() const { return outer()->backedge_copy_count(ciblock()->index(), _jsrs); }
aoqi@0 590
aoqi@0 591 // access to entry state
aoqi@0 592 int stack_size() const { return _state->stack_size(); }
aoqi@0 593 int monitor_count() const { return _state->monitor_count(); }
aoqi@0 594 ciType* local_type_at(int i) const { return _state->local_type_at(i); }
aoqi@0 595 ciType* stack_type_at(int i) const { return _state->stack_type_at(i); }
aoqi@0 596
aoqi@0 597 // Data flow on locals
aoqi@0 598 bool is_invariant_local(uint v) const {
aoqi@0 599 assert(is_loop_head(), "only loop heads");
aoqi@0 600 // Find outermost loop with same loop head
aoqi@0 601 Loop* lp = loop();
aoqi@0 602 while (lp->parent() != NULL) {
aoqi@0 603 if (lp->parent()->head() != lp->head()) break;
aoqi@0 604 lp = lp->parent();
aoqi@0 605 }
aoqi@0 606 return !lp->def_locals()->test(v);
aoqi@0 607 }
aoqi@0 608 LocalSet* def_locals() { return _state->def_locals(); }
aoqi@0 609 const LocalSet* def_locals() const { return _state->def_locals(); }
aoqi@0 610
aoqi@0 611 // Get the successors for this Block.
aoqi@0 612 GrowableArray<Block*>* successors(ciBytecodeStream* str,
aoqi@0 613 StateVector* state,
aoqi@0 614 JsrSet* jsrs);
aoqi@0 615 GrowableArray<Block*>* successors() {
aoqi@0 616 assert(_successors != NULL, "must be filled in");
aoqi@0 617 return _successors;
aoqi@0 618 }
aoqi@0 619
aoqi@0 620 // Get the exceptional successors for this Block.
aoqi@0 621 GrowableArray<Block*>* exceptions() {
aoqi@0 622 if (_exceptions == NULL) {
aoqi@0 623 compute_exceptions();
aoqi@0 624 }
aoqi@0 625 return _exceptions;
aoqi@0 626 }
aoqi@0 627
aoqi@0 628 // Get the exception klasses corresponding to the
aoqi@0 629 // exceptional successors for this Block.
aoqi@0 630 GrowableArray<ciInstanceKlass*>* exc_klasses() {
aoqi@0 631 if (_exc_klasses == NULL) {
aoqi@0 632 compute_exceptions();
aoqi@0 633 }
aoqi@0 634 return _exc_klasses;
aoqi@0 635 }
aoqi@0 636
aoqi@0 637 // Is this Block compatible with a given JsrSet?
aoqi@0 638 bool is_compatible_with(JsrSet* other) {
aoqi@0 639 return _jsrs->is_compatible_with(other);
aoqi@0 640 }
aoqi@0 641
aoqi@0 642 // Copy the value of our state vector into another.
aoqi@0 643 void copy_state_into(StateVector* copy) const {
aoqi@0 644 _state->copy_into(copy);
aoqi@0 645 }
aoqi@0 646
aoqi@0 647 // Copy the value of our JsrSet into another
aoqi@0 648 void copy_jsrs_into(JsrSet* copy) const {
aoqi@0 649 _jsrs->copy_into(copy);
aoqi@0 650 }
aoqi@0 651
aoqi@0 652 // Meets the start state of this block with another state, destructively
aoqi@0 653 // modifying this one. Returns true if any modification takes place.
aoqi@0 654 bool meet(const StateVector* incoming) {
aoqi@0 655 return state()->meet(incoming);
aoqi@0 656 }
aoqi@0 657
aoqi@0 658 // Ditto, except that the incoming state is coming from an
aoqi@0 659 // exception path. This means the stack is replaced by the
aoqi@0 660 // appropriate exception type.
aoqi@0 661 bool meet_exception(ciInstanceKlass* exc, const StateVector* incoming) {
aoqi@0 662 return state()->meet_exception(exc, incoming);
aoqi@0 663 }
aoqi@0 664
aoqi@0 665 // Work list manipulation
aoqi@0 666 void set_next(Block* block) { _next = block; }
aoqi@0 667 Block* next() const { return _next; }
aoqi@0 668
aoqi@0 669 void set_on_work_list(bool c) { _on_work_list = c; }
aoqi@0 670 bool is_on_work_list() const { return _on_work_list; }
aoqi@0 671
aoqi@0 672 bool has_pre_order() const { return _pre_order >= 0; }
aoqi@0 673 void set_pre_order(int po) { assert(!has_pre_order(), ""); _pre_order = po; }
aoqi@0 674 int pre_order() const { assert(has_pre_order(), ""); return _pre_order; }
aoqi@0 675 void set_next_pre_order() { set_pre_order(outer()->inc_next_pre_order()); }
aoqi@0 676 bool is_start() const { return _pre_order == outer()->start_block_num(); }
aoqi@0 677
aoqi@0 678 // Reverse post order
aoqi@0 679 void df_init();
aoqi@0 680 bool has_post_order() const { return _post_order >= 0; }
aoqi@0 681 void set_post_order(int po) { assert(!has_post_order() && po >= 0, ""); _post_order = po; }
aoqi@0 682 void reset_post_order(int o){ _post_order = o; }
aoqi@0 683 int post_order() const { assert(has_post_order(), ""); return _post_order; }
aoqi@0 684
aoqi@0 685 bool has_rpo() const { return has_post_order() && outer()->have_block_count(); }
aoqi@0 686 int rpo() const { assert(has_rpo(), ""); return outer()->block_count() - post_order() - 1; }
aoqi@0 687 void set_rpo_next(Block* b) { _rpo_next = b; }
aoqi@0 688 Block* rpo_next() { return _rpo_next; }
aoqi@0 689
aoqi@0 690 // Loops
aoqi@0 691 Loop* loop() const { return _loop; }
aoqi@0 692 void set_loop(Loop* lp) { _loop = lp; }
aoqi@0 693 bool is_loop_head() const { return _loop && _loop->head() == this; }
aoqi@0 694 void set_irreducible_entry(bool c) { _irreducible_entry = c; }
aoqi@0 695 bool is_irreducible_entry() const { return _irreducible_entry; }
aoqi@0 696 void set_has_monitorenter() { _has_monitorenter = true; }
aoqi@0 697 bool has_monitorenter() const { return _has_monitorenter; }
aoqi@0 698 bool is_visited() const { return has_pre_order(); }
aoqi@0 699 bool is_post_visited() const { return has_post_order(); }
aoqi@0 700 bool is_clonable_exit(Loop* lp);
aoqi@0 701 Block* looping_succ(Loop* lp); // Successor inside of loop
aoqi@0 702 bool is_single_entry_loop_head() const {
aoqi@0 703 if (!is_loop_head()) return false;
aoqi@0 704 for (Loop* lp = loop(); lp != NULL && lp->head() == this; lp = lp->parent())
aoqi@0 705 if (lp->is_irreducible()) return false;
aoqi@0 706 return true;
aoqi@0 707 }
aoqi@0 708
aoqi@0 709 void print_value_on(outputStream* st) const PRODUCT_RETURN;
aoqi@0 710 void print_on(outputStream* st) const PRODUCT_RETURN;
aoqi@0 711 };
aoqi@0 712
aoqi@0 713 // Loop
aoqi@0 714 class Loop : public ResourceObj {
aoqi@0 715 private:
aoqi@0 716 Loop* _parent;
aoqi@0 717 Loop* _sibling; // List of siblings, null terminated
aoqi@0 718 Loop* _child; // Head of child list threaded thru sibling pointer
aoqi@0 719 Block* _head; // Head of loop
aoqi@0 720 Block* _tail; // Tail of loop
aoqi@0 721 bool _irreducible;
aoqi@0 722 LocalSet _def_locals;
aoqi@0 723
aoqi@0 724 public:
aoqi@0 725 Loop(Block* head, Block* tail) :
aoqi@0 726 _head(head), _tail(tail),
aoqi@0 727 _parent(NULL), _sibling(NULL), _child(NULL),
aoqi@0 728 _irreducible(false), _def_locals() {}
aoqi@0 729
aoqi@0 730 Loop* parent() const { return _parent; }
aoqi@0 731 Loop* sibling() const { return _sibling; }
aoqi@0 732 Loop* child() const { return _child; }
aoqi@0 733 Block* head() const { return _head; }
aoqi@0 734 Block* tail() const { return _tail; }
aoqi@0 735 void set_parent(Loop* p) { _parent = p; }
aoqi@0 736 void set_sibling(Loop* s) { _sibling = s; }
aoqi@0 737 void set_child(Loop* c) { _child = c; }
aoqi@0 738 void set_head(Block* hd) { _head = hd; }
aoqi@0 739 void set_tail(Block* tl) { _tail = tl; }
aoqi@0 740
aoqi@0 741 int depth() const; // nesting depth
aoqi@0 742
aoqi@0 743 // Returns true if lp is a nested loop or us.
aoqi@0 744 bool contains(Loop* lp) const;
aoqi@0 745 bool contains(Block* blk) const { return contains(blk->loop()); }
aoqi@0 746
aoqi@0 747 // Data flow on locals
aoqi@0 748 LocalSet* def_locals() { return &_def_locals; }
aoqi@0 749 const LocalSet* def_locals() const { return &_def_locals; }
aoqi@0 750
aoqi@0 751 // Merge the branch lp into this branch, sorting on the loop head
aoqi@0 752 // pre_orders. Returns the new branch.
aoqi@0 753 Loop* sorted_merge(Loop* lp);
aoqi@0 754
aoqi@0 755 // Mark non-single entry to loop
aoqi@0 756 void set_irreducible(Block* entry) {
aoqi@0 757 _irreducible = true;
aoqi@0 758 entry->set_irreducible_entry(true);
aoqi@0 759 }
aoqi@0 760 bool is_irreducible() const { return _irreducible; }
aoqi@0 761
aoqi@0 762 bool is_root() const { return _tail->pre_order() == max_jint; }
aoqi@0 763
aoqi@0 764 void print(outputStream* st = tty, int indent = 0) const PRODUCT_RETURN;
aoqi@0 765 };
aoqi@0 766
aoqi@0 767 // Postorder iteration over the loop tree.
aoqi@0 768 class PostorderLoops : public StackObj {
aoqi@0 769 private:
aoqi@0 770 Loop* _root;
aoqi@0 771 Loop* _current;
aoqi@0 772 public:
aoqi@0 773 PostorderLoops(Loop* root) : _root(root), _current(root) {
aoqi@0 774 while (_current->child() != NULL) {
aoqi@0 775 _current = _current->child();
aoqi@0 776 }
aoqi@0 777 }
aoqi@0 778 bool done() { return _current == NULL; } // Finished iterating?
aoqi@0 779 void next(); // Advance to next loop
aoqi@0 780 Loop* current() { return _current; } // Return current loop.
aoqi@0 781 };
aoqi@0 782
aoqi@0 783 // Preorder iteration over the loop tree.
aoqi@0 784 class PreorderLoops : public StackObj {
aoqi@0 785 private:
aoqi@0 786 Loop* _root;
aoqi@0 787 Loop* _current;
aoqi@0 788 public:
aoqi@0 789 PreorderLoops(Loop* root) : _root(root), _current(root) {}
aoqi@0 790 bool done() { return _current == NULL; } // Finished iterating?
aoqi@0 791 void next(); // Advance to next loop
aoqi@0 792 Loop* current() { return _current; } // Return current loop.
aoqi@0 793 };
aoqi@0 794
aoqi@0 795 // Standard indexes of successors, for various bytecodes.
aoqi@0 796 enum {
aoqi@0 797 FALL_THROUGH = 0, // normal control
aoqi@0 798 IF_NOT_TAKEN = 0, // the not-taken branch of an if (i.e., fall-through)
aoqi@0 799 IF_TAKEN = 1, // the taken branch of an if
aoqi@0 800 GOTO_TARGET = 0, // unique successor for goto, jsr, or ret
aoqi@0 801 SWITCH_DEFAULT = 0, // default branch of a switch
aoqi@0 802 SWITCH_CASES = 1 // first index for any non-default switch branches
aoqi@0 803 // Unlike in other blocks, the successors of a switch are listed uniquely.
aoqi@0 804 };
aoqi@0 805
aoqi@0 806 private:
aoqi@0 807 // A mapping from pre_order to Blocks. This array is created
aoqi@0 808 // only at the end of the flow.
aoqi@0 809 Block** _block_map;
aoqi@0 810
aoqi@0 811 // For each ciBlock index, a list of Blocks which share this ciBlock.
aoqi@0 812 GrowableArray<Block*>** _idx_to_blocklist;
aoqi@0 813 // count of ciBlocks
aoqi@0 814 int _ciblock_count;
aoqi@0 815
aoqi@0 816 // Tells if a given instruction is able to generate an exception edge.
aoqi@0 817 bool can_trap(ciBytecodeStream& str);
aoqi@0 818
aoqi@0 819 // Clone the loop heads. Returns true if any cloning occurred.
aoqi@0 820 bool clone_loop_heads(Loop* lp, StateVector* temp_vector, JsrSet* temp_set);
aoqi@0 821
aoqi@0 822 // Clone lp's head and replace tail's successors with clone.
aoqi@0 823 Block* clone_loop_head(Loop* lp, StateVector* temp_vector, JsrSet* temp_set);
aoqi@0 824
aoqi@0 825 public:
aoqi@0 826 // Return the block beginning at bci which has a JsrSet compatible
aoqi@0 827 // with jsrs.
aoqi@0 828 Block* block_at(int bci, JsrSet* set, CreateOption option = create_public_copy);
aoqi@0 829
aoqi@0 830 // block factory
aoqi@0 831 Block* get_block_for(int ciBlockIndex, JsrSet* jsrs, CreateOption option = create_public_copy);
aoqi@0 832
aoqi@0 833 // How many of the blocks have the backedge_copy bit set?
aoqi@0 834 int backedge_copy_count(int ciBlockIndex, JsrSet* jsrs) const;
aoqi@0 835
aoqi@0 836 // Return an existing block containing bci which has a JsrSet compatible
aoqi@0 837 // with jsrs, or NULL if there is none.
aoqi@0 838 Block* existing_block_at(int bci, JsrSet* set) { return block_at(bci, set, no_create); }
aoqi@0 839
aoqi@0 840 // Tell whether the flow analysis has encountered an error of some sort.
aoqi@0 841 bool failing() { return env()->failing() || _failure_reason != NULL; }
aoqi@0 842
aoqi@0 843 // Reason this compilation is failing, such as "too many basic blocks".
aoqi@0 844 const char* failure_reason() { return _failure_reason; }
aoqi@0 845
aoqi@0 846 // Note a failure.
aoqi@0 847 void record_failure(const char* reason);
aoqi@0 848
aoqi@0 849 // Return the block of a given pre-order number.
aoqi@0 850 int have_block_count() const { return _block_map != NULL; }
aoqi@0 851 int block_count() const { assert(have_block_count(), "");
aoqi@0 852 return _next_pre_order; }
aoqi@0 853 Block* pre_order_at(int po) const { assert(0 <= po && po < block_count(), "out of bounds");
aoqi@0 854 return _block_map[po]; }
aoqi@0 855 Block* start_block() const { return pre_order_at(start_block_num()); }
aoqi@0 856 int start_block_num() const { return 0; }
aoqi@0 857 Block* rpo_at(int rpo) const { assert(0 <= rpo && rpo < block_count(), "out of bounds");
aoqi@0 858 return _block_map[rpo]; }
aoqi@0 859 int next_pre_order() { return _next_pre_order; }
aoqi@0 860 int inc_next_pre_order() { return _next_pre_order++; }
aoqi@0 861
aoqi@0 862 private:
aoqi@0 863 // A work list used during flow analysis.
aoqi@0 864 Block* _work_list;
aoqi@0 865
aoqi@0 866 // List of blocks in reverse post order
aoqi@0 867 Block* _rpo_list;
aoqi@0 868
aoqi@0 869 // Next Block::_pre_order. After mapping, doubles as block_count.
aoqi@0 870 int _next_pre_order;
aoqi@0 871
aoqi@0 872 // Are there more blocks on the work list?
aoqi@0 873 bool work_list_empty() { return _work_list == NULL; }
aoqi@0 874
aoqi@0 875 // Get the next basic block from our work list.
aoqi@0 876 Block* work_list_next();
aoqi@0 877
aoqi@0 878 // Add a basic block to our work list.
aoqi@0 879 void add_to_work_list(Block* block);
aoqi@0 880
aoqi@0 881 // Prepend a basic block to rpo list.
aoqi@0 882 void prepend_to_rpo_list(Block* blk) {
aoqi@0 883 blk->set_rpo_next(_rpo_list);
aoqi@0 884 _rpo_list = blk;
aoqi@0 885 }
aoqi@0 886
aoqi@0 887 // Root of the loop tree
aoqi@0 888 Loop* _loop_tree_root;
aoqi@0 889
aoqi@0 890 // State used for make_jsr_record
aoqi@0 891 int _jsr_count;
aoqi@0 892 GrowableArray<JsrRecord*>* _jsr_records;
aoqi@0 893
aoqi@0 894 public:
aoqi@0 895 // Make a JsrRecord for a given (entry, return) pair, if such a record
aoqi@0 896 // does not already exist.
aoqi@0 897 JsrRecord* make_jsr_record(int entry_address, int return_address);
aoqi@0 898
aoqi@0 899 void set_loop_tree_root(Loop* ltr) { _loop_tree_root = ltr; }
aoqi@0 900 Loop* loop_tree_root() { return _loop_tree_root; }
aoqi@0 901
aoqi@0 902 private:
aoqi@0 903 // Get the initial state for start_bci:
aoqi@0 904 const StateVector* get_start_state();
aoqi@0 905
aoqi@0 906 // Merge the current state into all exceptional successors at the
aoqi@0 907 // current point in the code.
aoqi@0 908 void flow_exceptions(GrowableArray<Block*>* exceptions,
aoqi@0 909 GrowableArray<ciInstanceKlass*>* exc_klasses,
aoqi@0 910 StateVector* state);
aoqi@0 911
aoqi@0 912 // Merge the current state into all successors at the current point
aoqi@0 913 // in the code.
aoqi@0 914 void flow_successors(GrowableArray<Block*>* successors,
aoqi@0 915 StateVector* state);
aoqi@0 916
aoqi@0 917 // Interpret the effects of the bytecodes on the incoming state
aoqi@0 918 // vector of a basic block. Push the changed state to succeeding
aoqi@0 919 // basic blocks.
aoqi@0 920 void flow_block(Block* block,
aoqi@0 921 StateVector* scratch_state,
aoqi@0 922 JsrSet* scratch_jsrs);
aoqi@0 923
aoqi@0 924 // Perform the type flow analysis, creating and cloning Blocks as
aoqi@0 925 // necessary.
aoqi@0 926 void flow_types();
aoqi@0 927
aoqi@0 928 // Perform the depth first type flow analysis. Helper for flow_types.
aoqi@0 929 void df_flow_types(Block* start,
aoqi@0 930 bool do_flow,
aoqi@0 931 StateVector* temp_vector,
aoqi@0 932 JsrSet* temp_set);
aoqi@0 933
aoqi@0 934 // Incrementally build loop tree.
aoqi@0 935 void build_loop_tree(Block* blk);
aoqi@0 936
aoqi@0 937 // Create the block map, which indexes blocks in pre_order.
aoqi@0 938 void map_blocks();
aoqi@0 939
aoqi@0 940 public:
aoqi@0 941 // Perform type inference flow analysis.
aoqi@0 942 void do_flow();
aoqi@0 943
aoqi@0 944 void print_on(outputStream* st) const PRODUCT_RETURN;
aoqi@0 945
aoqi@0 946 void rpo_print_on(outputStream* st) const PRODUCT_RETURN;
aoqi@0 947 };
aoqi@0 948
aoqi@0 949 #endif // SHARE_VM_CI_CITYPEFLOW_HPP

mercurial