425 // Must this parse be aborted?
426 bool failing() { return C->failing(); }
427
428 Block* rpo_at(int rpo) {
429 assert(0 <= rpo && rpo < _block_count, "oob");
430 return &_blocks[rpo];
431 }
432 Block* start_block() {
433 return rpo_at(flow()->start_block()->rpo());
434 }
435 // Can return null if the flow pass did not complete a block.
436 Block* successor_for_bci(int bci) {
437 return block()->successor_for_bci(bci);
438 }
439
440 private:
441 // Create a JVMS & map for the initial state of this method.
442 SafePointNode* create_entry_map();
443
444 // OSR helpers
445 Node *fetch_interpreter_state(int index, BasicType bt, Node *local_addrs, Node *local_addrs_base);
446 Node* check_interpreter_type(Node* l, const Type* type, SafePointNode* &bad_type_exit);
447 void load_interpreter_state(Node* osr_buf);
448
449 // Functions for managing basic blocks:
450 void init_blocks();
451 void load_state_from(Block* b);
452 void store_state_to(Block* b) { b->record_state(this); }
453
454 // Parse all the basic blocks.
455 void do_all_blocks();
456
457 // Parse the current basic block
458 void do_one_block();
459
460 // Raise an error if we get a bad ciTypeFlow CFG.
461 void handle_missing_successor(int bci);
462
463 // first actions (before BCI 0)
464 void do_method_entry();
465
471 void ensure_phis_everywhere();
472
473 // Merge the current mapping into the basic block starting at bci
474 void merge( int target_bci);
475 // Same as plain merge, except that it allocates a new path number.
476 void merge_new_path( int target_bci);
477 // Merge the current mapping into an exception handler.
478 void merge_exception(int target_bci);
479 // Helper: Merge the current mapping into the given basic block
480 void merge_common(Block* target, int pnum);
481 // Helper functions for merging individual cells.
482 PhiNode *ensure_phi( int idx, bool nocreate = false);
483 PhiNode *ensure_memory_phi(int idx, bool nocreate = false);
484 // Helper to merge the current memory state into the given basic block
485 void merge_memory_edges(MergeMemNode* n, int pnum, bool nophi);
486
487 // Parse this bytecode, and alter the Parsers JVM->Node mapping
488 void do_one_bytecode();
489
490 // helper function to generate array store check
491 void array_store_check();
492 // Helper function to generate array load
493 void array_load(BasicType etype);
494 // Helper function to generate array store
495 void array_store(BasicType etype);
496 // Helper function to compute array addressing
497 Node* array_addressing(BasicType type, int vals, const Type*& elemtype);
498
499 void clinit_deopt();
500
501 void rtm_deopt();
502
503 // Pass current map to exits
504 void return_current(Node* value);
505
506 // Register finalizers on return from Object.<init>
507 void call_register_finalizer();
508
509 // Insert a compiler safepoint into the graph
510 void add_safepoint();
511
512 // Insert a compiler safepoint into the graph, if there is a back-branch.
513 void maybe_add_safepoint(int target_bci) {
514 if (target_bci <= bci()) {
515 add_safepoint();
516 }
517 }
526
527 // Helper functions for type checking bytecodes:
528 void do_checkcast();
529 void do_instanceof();
530
531 // Helper functions for shifting & arithmetic
532 void modf();
533 void modd();
534 void l2f();
535
536 // implementation of _get* and _put* bytecodes
537 void do_getstatic() { do_field_access(true, false); }
538 void do_getfield () { do_field_access(true, true); }
539 void do_putstatic() { do_field_access(false, false); }
540 void do_putfield () { do_field_access(false, true); }
541
542 // common code for making initial checks and forming addresses
543 void do_field_access(bool is_get, bool is_field);
544
545 // common code for actually performing the load or store
546 void do_get_xxx(Node* obj, ciField* field, bool is_field);
547 void do_put_xxx(Node* obj, ciField* field, bool is_field);
548
549 // implementation of object creation bytecodes
550 void do_new();
551 void do_newarray(BasicType elemtype);
552 void do_anewarray();
553 void do_multianewarray();
554 Node* expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, int ndimensions, int nargs);
555
556 // implementation of jsr/ret
557 void do_jsr();
558 void do_ret();
559
560 float dynamic_branch_prediction(float &cnt, BoolTest::mask btest, Node* test);
561 float branch_prediction(float &cnt, BoolTest::mask btest, int target_bci, Node* test);
562 bool seems_never_taken(float prob) const;
563 bool path_is_suitable_for_uncommon_trap(float prob) const;
564 bool seems_stable_comparison() const;
565
566 void do_ifnull(BoolTest::mask btest, Node* c);
567 void do_if(BoolTest::mask btest, Node* c);
568 int repush_if_args();
569 void adjust_map_after_if(BoolTest::mask btest, Node* c, float prob, Block* path);
570 void sharpen_type_after_if(BoolTest::mask btest,
571 Node* con, const Type* tcon,
572 Node* val, const Type* tval);
573 void maybe_add_predicate_after_if(Block* path);
574 IfNode* jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask, float prob, float cnt);
575 void jump_if_true_fork(IfNode *ifNode, int dest_bci_if_true, bool unc);
576 void jump_if_false_fork(IfNode *ifNode, int dest_bci_if_false, bool unc);
577 void jump_if_always_fork(int dest_bci_if_true, bool unc);
578
579 friend class SwitchRange;
580 void do_tableswitch();
581 void do_lookupswitch();
582 void jump_switch_ranges(Node* a, SwitchRange* lo, SwitchRange* hi, int depth = 0);
583 bool create_jump_tables(Node* a, SwitchRange* lo, SwitchRange* hi);
584 void linear_search_switch_ranges(Node* key_val, SwitchRange*& lo, SwitchRange*& hi);
585
586 // helper function for call statistics
587 void count_compiled_calls(bool at_method_entry, bool is_inline) PRODUCT_RETURN;
|
425 // Must this parse be aborted?
426 bool failing() { return C->failing(); }
427
428 Block* rpo_at(int rpo) {
429 assert(0 <= rpo && rpo < _block_count, "oob");
430 return &_blocks[rpo];
431 }
432 Block* start_block() {
433 return rpo_at(flow()->start_block()->rpo());
434 }
435 // Can return null if the flow pass did not complete a block.
436 Block* successor_for_bci(int bci) {
437 return block()->successor_for_bci(bci);
438 }
439
440 private:
441 // Create a JVMS & map for the initial state of this method.
442 SafePointNode* create_entry_map();
443
444 // OSR helpers
445 Node* fetch_interpreter_state(int index, const Type* type, Node* local_addrs, Node* local_addrs_base);
446 Node* check_interpreter_type(Node* l, const Type* type, SafePointNode* &bad_type_exit);
447 void load_interpreter_state(Node* osr_buf);
448
449 // Functions for managing basic blocks:
450 void init_blocks();
451 void load_state_from(Block* b);
452 void store_state_to(Block* b) { b->record_state(this); }
453
454 // Parse all the basic blocks.
455 void do_all_blocks();
456
457 // Parse the current basic block
458 void do_one_block();
459
460 // Raise an error if we get a bad ciTypeFlow CFG.
461 void handle_missing_successor(int bci);
462
463 // first actions (before BCI 0)
464 void do_method_entry();
465
471 void ensure_phis_everywhere();
472
473 // Merge the current mapping into the basic block starting at bci
474 void merge( int target_bci);
475 // Same as plain merge, except that it allocates a new path number.
476 void merge_new_path( int target_bci);
477 // Merge the current mapping into an exception handler.
478 void merge_exception(int target_bci);
479 // Helper: Merge the current mapping into the given basic block
480 void merge_common(Block* target, int pnum);
481 // Helper functions for merging individual cells.
482 PhiNode *ensure_phi( int idx, bool nocreate = false);
483 PhiNode *ensure_memory_phi(int idx, bool nocreate = false);
484 // Helper to merge the current memory state into the given basic block
485 void merge_memory_edges(MergeMemNode* n, int pnum, bool nophi);
486
487 // Parse this bytecode, and alter the Parsers JVM->Node mapping
488 void do_one_bytecode();
489
490 // helper function to generate array store check
491 Node* array_store_check(Node*& adr, const Type*& elemtype);
492 // Helper function to generate array load
493 void array_load(BasicType etype);
494 // Helper function to generate array store
495 void array_store(BasicType etype);
496 // Helper function to compute array addressing
497 Node* array_addressing(BasicType type, int vals, const Type*& elemtype);
498 Node* record_profile_for_speculation_at_array_load(Node* ld);
499
500 void clinit_deopt();
501
502 void rtm_deopt();
503
504 // Pass current map to exits
505 void return_current(Node* value);
506
507 // Register finalizers on return from Object.<init>
508 void call_register_finalizer();
509
510 // Insert a compiler safepoint into the graph
511 void add_safepoint();
512
513 // Insert a compiler safepoint into the graph, if there is a back-branch.
514 void maybe_add_safepoint(int target_bci) {
515 if (target_bci <= bci()) {
516 add_safepoint();
517 }
518 }
527
528 // Helper functions for type checking bytecodes:
529 void do_checkcast();
530 void do_instanceof();
531
532 // Helper functions for shifting & arithmetic
533 void modf();
534 void modd();
535 void l2f();
536
537 // implementation of _get* and _put* bytecodes
538 void do_getstatic() { do_field_access(true, false); }
539 void do_getfield () { do_field_access(true, true); }
540 void do_putstatic() { do_field_access(false, false); }
541 void do_putfield () { do_field_access(false, true); }
542
543 // common code for making initial checks and forming addresses
544 void do_field_access(bool is_get, bool is_field);
545
546 // common code for actually performing the load or store
547 void do_get_xxx(Node* obj, ciField* field);
548 void do_put_xxx(Node* obj, ciField* field, bool is_field);
549
550 // implementation of object creation bytecodes
551 void do_new();
552 void do_aconst_init();
553 void do_withfield();
554 void do_newarray(BasicType elemtype);
555 void do_newarray();
556 void do_multianewarray();
557 Node* expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, int ndimensions, int nargs);
558
559 // implementation of jsr/ret
560 void do_jsr();
561 void do_ret();
562
563 float dynamic_branch_prediction(float &cnt, BoolTest::mask btest, Node* test);
564 float branch_prediction(float &cnt, BoolTest::mask btest, int target_bci, Node* test);
565 bool seems_never_taken(float prob) const;
566 bool path_is_suitable_for_uncommon_trap(float prob) const;
567 bool seems_stable_comparison() const;
568
569 void do_ifnull(BoolTest::mask btest, Node* c);
570 void do_if(BoolTest::mask btest, Node* c, bool new_path = false, Node** ctrl_taken = NULL);
571 void do_acmp(BoolTest::mask btest, Node* left, Node* right);
572 void acmp_always_null_input(Node* input, const TypeOopPtr* tinput, BoolTest::mask btest, Node* eq_region);
573 void acmp_known_non_inline_type_input(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, ciKlass* input_type, BoolTest::mask btest, Node* eq_region);
574 Node* acmp_null_check(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, Node*& null_ctl);
575 void acmp_unknown_non_inline_type_input(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, BoolTest::mask btest, Node* eq_region);
576 int repush_if_args();
577 void adjust_map_after_if(BoolTest::mask btest, Node* c, float prob, Block* path);
578 void sharpen_type_after_if(BoolTest::mask btest,
579 Node* con, const Type* tcon,
580 Node* val, const Type* tval);
581 void maybe_add_predicate_after_if(Block* path);
582 IfNode* jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask, float prob, float cnt);
583 void jump_if_true_fork(IfNode *ifNode, int dest_bci_if_true, bool unc);
584 void jump_if_false_fork(IfNode *ifNode, int dest_bci_if_false, bool unc);
585 void jump_if_always_fork(int dest_bci_if_true, bool unc);
586
587 friend class SwitchRange;
588 void do_tableswitch();
589 void do_lookupswitch();
590 void jump_switch_ranges(Node* a, SwitchRange* lo, SwitchRange* hi, int depth = 0);
591 bool create_jump_tables(Node* a, SwitchRange* lo, SwitchRange* hi);
592 void linear_search_switch_ranges(Node* key_val, SwitchRange*& lo, SwitchRange*& hi);
593
594 // helper function for call statistics
595 void count_compiled_calls(bool at_method_entry, bool is_inline) PRODUCT_RETURN;
|