< prev index next >

src/hotspot/share/opto/parse.hpp

Print this page

427   // Must this parse be aborted?
428   bool failing() const { return C->failing_internal(); } // might have cascading effects, not stressing bailouts for now.
429 
430   Block* rpo_at(int rpo) {
431     assert(0 <= rpo && rpo < _block_count, "oob");
432     return &_blocks[rpo];
433   }
434   Block* start_block() {
435     return rpo_at(flow()->start_block()->rpo());
436   }
437   // Can return null if the flow pass did not complete a block.
438   Block* successor_for_bci(int bci) {
439     return block()->successor_for_bci(bci);
440   }
441 
442  private:
443   // Create a JVMS & map for the initial state of this method.
444   SafePointNode* create_entry_map();
445 
446   // OSR helpers
447   Node *fetch_interpreter_state(int index, BasicType bt, Node *local_addrs, Node *local_addrs_base);
448   Node* check_interpreter_type(Node* l, const Type* type, SafePointNode* &bad_type_exit);
449   void  load_interpreter_state(Node* osr_buf);
450 
451   // Functions for managing basic blocks:
452   void init_blocks();
453   void load_state_from(Block* b);
454   void store_state_to(Block* b) { b->record_state(this); }
455 
456   // Parse all the basic blocks.
457   void do_all_blocks();
458 
459   // Parse the current basic block
460   void do_one_block();
461 
462   // Raise an error if we get a bad ciTypeFlow CFG.
463   void handle_missing_successor(int bci);
464 
465   // first actions (before BCI 0)
466   void do_method_entry();
467 

473   void ensure_phis_everywhere();
474 
475   // Merge the current mapping into the basic block starting at bci
476   void merge(          int target_bci);
477   // Same as plain merge, except that it allocates a new path number.
478   void merge_new_path( int target_bci);
479   // Merge the current mapping into an exception handler.
480   void merge_exception(int target_bci);
481   // Helper: Merge the current mapping into the given basic block
482   void merge_common(Block* target, int pnum);
483   // Helper functions for merging individual cells.
484   PhiNode *ensure_phi(       int idx, bool nocreate = false);
485   PhiNode *ensure_memory_phi(int idx, bool nocreate = false);
486   // Helper to merge the current memory state into the given basic block
487   void merge_memory_edges(MergeMemNode* n, int pnum, bool nophi);
488 
489   // Parse this bytecode, and alter the Parsers JVM->Node mapping
490   void do_one_bytecode();
491 
492   // helper function to generate array store check
493   void array_store_check();
494   // Helper function to generate array load
495   void array_load(BasicType etype);

496   // Helper function to generate array store
497   void array_store(BasicType etype);

498   // Helper function to compute array addressing
499   Node* array_addressing(BasicType type, int vals, const Type*& elemtype);








500 
501   void clinit_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   }
518 
519   // Note:  Intrinsic generation routines may be found in library_call.cpp.

525   bool can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass *klass);
526 
527   // Helper functions for type checking bytecodes:
528   void  do_checkcast();
529   void  do_instanceof();
530 
531   // Helper functions for shifting & arithmetic
532   Node* floating_point_mod(Node* a, Node* b, BasicType type);
533   void l2f();
534 
535   // implementation of _get* and _put* bytecodes
536   void do_getstatic() { do_field_access(true,  false); }
537   void do_getfield () { do_field_access(true,  true); }
538   void do_putstatic() { do_field_access(false, false); }
539   void do_putfield () { do_field_access(false, true); }
540 
541   // common code for making initial checks and forming addresses
542   void do_field_access(bool is_get, bool is_field);
543 
544   // common code for actually performing the load or store
545   void do_get_xxx(Node* obj, ciField* field, bool is_field);
546   void do_put_xxx(Node* obj, ciField* field, bool is_field);



547 
548   // implementation of object creation bytecodes
549   void do_new();
550   void do_newarray(BasicType elemtype);
551   void do_anewarray();
552   void do_multianewarray();
553   Node* expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, int ndimensions, int nargs);
554 
555   // implementation of jsr/ret
556   void do_jsr();
557   void do_ret();
558 
559   float   dynamic_branch_prediction(float &cnt, BoolTest::mask btest, Node* test);
560   float   branch_prediction(float &cnt, BoolTest::mask btest, int target_bci, Node* test);
561   bool    seems_never_taken(float prob) const;
562   bool    path_is_suitable_for_uncommon_trap(float prob) const;
563 
564   void    do_ifnull(BoolTest::mask btest, Node* c);
565   void    do_if(BoolTest::mask btest, Node* c);





566   int     repush_if_args();
567   void    adjust_map_after_if(BoolTest::mask btest, Node* c, float prob, Block* path);
568   void    sharpen_type_after_if(BoolTest::mask btest,
569                                 Node* con, const Type* tcon,
570                                 Node* val, const Type* tval);
571   void    maybe_add_predicate_after_if(Block* path);
572   IfNode* jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask, float prob, float cnt);
573   void    jump_if_true_fork(IfNode *ifNode, int dest_bci_if_true, bool unc);
574   void    jump_if_false_fork(IfNode *ifNode, int dest_bci_if_false, bool unc);
575   void    jump_if_always_fork(int dest_bci_if_true, bool unc);
576 
577   friend class SwitchRange;
578   void    do_tableswitch();
579   void    do_lookupswitch();
580   void    jump_switch_ranges(Node* a, SwitchRange* lo, SwitchRange* hi, int depth = 0);
581   bool    create_jump_tables(Node* a, SwitchRange* lo, SwitchRange* hi);
582   void    linear_search_switch_ranges(Node* key_val, SwitchRange*& lo, SwitchRange*& hi);
583 
584   // helper function for call statistics
585   void count_compiled_calls(bool at_method_entry, bool is_inline) PRODUCT_RETURN;
586 
587   Node_Notes* make_node_notes(Node_Notes* caller_nn);

427   // Must this parse be aborted?
428   bool failing() const { return C->failing_internal(); } // might have cascading effects, not stressing bailouts for now.
429 
430   Block* rpo_at(int rpo) {
431     assert(0 <= rpo && rpo < _block_count, "oob");
432     return &_blocks[rpo];
433   }
434   Block* start_block() {
435     return rpo_at(flow()->start_block()->rpo());
436   }
437   // Can return null if the flow pass did not complete a block.
438   Block* successor_for_bci(int bci) {
439     return block()->successor_for_bci(bci);
440   }
441 
442  private:
443   // Create a JVMS & map for the initial state of this method.
444   SafePointNode* create_entry_map();
445 
446   // OSR helpers
447   Node* fetch_interpreter_state(int index, const Type* type, Node* local_addrs, Node* local_addrs_base);
448   Node* check_interpreter_type(Node* l, const Type* type, SafePointNode* &bad_type_exit);
449   void  load_interpreter_state(Node* osr_buf);
450 
451   // Functions for managing basic blocks:
452   void init_blocks();
453   void load_state_from(Block* b);
454   void store_state_to(Block* b) { b->record_state(this); }
455 
456   // Parse all the basic blocks.
457   void do_all_blocks();
458 
459   // Parse the current basic block
460   void do_one_block();
461 
462   // Raise an error if we get a bad ciTypeFlow CFG.
463   void handle_missing_successor(int bci);
464 
465   // first actions (before BCI 0)
466   void do_method_entry();
467 

473   void ensure_phis_everywhere();
474 
475   // Merge the current mapping into the basic block starting at bci
476   void merge(          int target_bci);
477   // Same as plain merge, except that it allocates a new path number.
478   void merge_new_path( int target_bci);
479   // Merge the current mapping into an exception handler.
480   void merge_exception(int target_bci);
481   // Helper: Merge the current mapping into the given basic block
482   void merge_common(Block* target, int pnum);
483   // Helper functions for merging individual cells.
484   PhiNode *ensure_phi(       int idx, bool nocreate = false);
485   PhiNode *ensure_memory_phi(int idx, bool nocreate = false);
486   // Helper to merge the current memory state into the given basic block
487   void merge_memory_edges(MergeMemNode* n, int pnum, bool nophi);
488 
489   // Parse this bytecode, and alter the Parsers JVM->Node mapping
490   void do_one_bytecode();
491 
492   // helper function to generate array store check
493   Node* array_store_check(Node*& adr, const Type*& elemtype);
494   // Helper function to generate array load
495   void array_load(BasicType etype);
496   Node* load_from_unknown_flat_array(Node* array, Node* array_index, const TypeOopPtr* element_ptr);
497   // Helper function to generate array store
498   void array_store(BasicType etype);
499   void store_to_unknown_flat_array(Node* array, Node* idx, Node* non_null_stored_value);
500   // Helper function to compute array addressing
501   Node* array_addressing(BasicType type, int vals, const Type*& elemtype);
502   bool needs_range_check(const TypeInt* size_type, const Node* index) const;
503   Node* create_speculative_inline_type_array_checks(Node* array, const TypeAryPtr* array_type, const Type*& element_type);
504   Node* cast_to_speculative_array_type(Node* array, const TypeAryPtr*& array_type, const Type*& element_type);
505   Node* cast_to_profiled_array_type(Node* const array);
506   Node* speculate_non_null_free_array(Node* array, const TypeAryPtr*& array_type);
507   Node* speculate_non_flat_array(Node* array, const TypeAryPtr* array_type);
508   void create_range_check(Node* idx, Node* ary, const TypeInt* sizetype);
509   Node* record_profile_for_speculation_at_array_load(Node* ld);
510 
511   void clinit_deopt();
512 
513   // Pass current map to exits
514   void return_current(Node* value);
515 
516   // Register finalizers on return from Object.<init>
517   void call_register_finalizer();
518 
519   // Insert a compiler safepoint into the graph
520   void add_safepoint();
521 
522   // Insert a compiler safepoint into the graph, if there is a back-branch.
523   void maybe_add_safepoint(int target_bci) {
524     if (target_bci <= bci()) {
525       add_safepoint();
526     }
527   }
528 
529   // Note:  Intrinsic generation routines may be found in library_call.cpp.

535   bool can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass *klass);
536 
537   // Helper functions for type checking bytecodes:
538   void  do_checkcast();
539   void  do_instanceof();
540 
541   // Helper functions for shifting & arithmetic
542   Node* floating_point_mod(Node* a, Node* b, BasicType type);
543   void l2f();
544 
545   // implementation of _get* and _put* bytecodes
546   void do_getstatic() { do_field_access(true,  false); }
547   void do_getfield () { do_field_access(true,  true); }
548   void do_putstatic() { do_field_access(false, false); }
549   void do_putfield () { do_field_access(false, true); }
550 
551   // common code for making initial checks and forming addresses
552   void do_field_access(bool is_get, bool is_field);
553 
554   // common code for actually performing the load or store
555   void do_get_xxx(Node* obj, ciField* field);
556   void do_put_xxx(Node* obj, ciField* field, bool is_field);
557   void set_inline_type_field(Node* obj, ciField* field, Node* val);
558 
559   ciType* improve_abstract_inline_type_klass(ciType* field_klass);
560 
561   // implementation of object creation bytecodes
562   void do_new();
563   void do_newarray(BasicType elemtype);
564   void do_newarray();
565   void do_multianewarray();
566   Node* expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, int ndimensions, int nargs);
567 
568   // implementation of jsr/ret
569   void do_jsr();
570   void do_ret();
571 
572   float   dynamic_branch_prediction(float &cnt, BoolTest::mask btest, Node* test);
573   float   branch_prediction(float &cnt, BoolTest::mask btest, int target_bci, Node* test);
574   bool    seems_never_taken(float prob) const;
575   bool    path_is_suitable_for_uncommon_trap(float prob) const;
576 
577   void    do_ifnull(BoolTest::mask btest, Node* c);
578   void    do_if(BoolTest::mask btest, Node* c, bool can_trap = true, bool new_path = false, Node** ctrl_taken = nullptr);
579   void    do_acmp(BoolTest::mask btest, Node* left, Node* right);
580   void    acmp_always_null_input(Node* input, const TypeOopPtr* tinput, BoolTest::mask btest, Node* eq_region);
581   void    acmp_known_non_inline_type_input(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, ciKlass* input_type, BoolTest::mask btest, Node* eq_region);
582   Node*   acmp_null_check(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, Node*& null_ctl);
583   void    acmp_unknown_non_inline_type_input(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, BoolTest::mask btest, Node* eq_region);
584   int     repush_if_args();
585   void    adjust_map_after_if(BoolTest::mask btest, Node* c, float prob, Block* path, bool can_trap = true);
586   void    sharpen_type_after_if(BoolTest::mask btest,
587                                 Node* con, const Type* tcon,
588                                 Node* val, const Type* tval);
589   void    maybe_add_predicate_after_if(Block* path);
590   IfNode* jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask, float prob, float cnt);
591   void    jump_if_true_fork(IfNode *ifNode, int dest_bci_if_true, bool unc);
592   void    jump_if_false_fork(IfNode *ifNode, int dest_bci_if_false, bool unc);
593   void    jump_if_always_fork(int dest_bci_if_true, bool unc);
594 
595   friend class SwitchRange;
596   void    do_tableswitch();
597   void    do_lookupswitch();
598   void    jump_switch_ranges(Node* a, SwitchRange* lo, SwitchRange* hi, int depth = 0);
599   bool    create_jump_tables(Node* a, SwitchRange* lo, SwitchRange* hi);
600   void    linear_search_switch_ranges(Node* key_val, SwitchRange*& lo, SwitchRange*& hi);
601 
602   // helper function for call statistics
603   void count_compiled_calls(bool at_method_entry, bool is_inline) PRODUCT_RETURN;
604 
605   Node_Notes* make_node_notes(Node_Notes* caller_nn);
< prev index next >