< prev index next >

src/hotspot/share/opto/parse.hpp

Print this page

394   // Must this parse be aborted?
395   bool failing()                { return C->failing(); }
396 
397   Block* rpo_at(int rpo) {
398     assert(0 <= rpo && rpo < _block_count, "oob");
399     return &_blocks[rpo];
400   }
401   Block* start_block() {
402     return rpo_at(flow()->start_block()->rpo());
403   }
404   // Can return NULL if the flow pass did not complete a block.
405   Block* successor_for_bci(int bci) {
406     return block()->successor_for_bci(bci);
407   }
408 
409  private:
410   // Create a JVMS & map for the initial state of this method.
411   SafePointNode* create_entry_map();
412 
413   // OSR helpers
414   Node *fetch_interpreter_state(int index, BasicType bt, Node *local_addrs, Node *local_addrs_base);
415   Node* check_interpreter_type(Node* l, const Type* type, SafePointNode* &bad_type_exit);
416   void  load_interpreter_state(Node* osr_buf);
417 
418   // Functions for managing basic blocks:
419   void init_blocks();
420   void load_state_from(Block* b);
421   void store_state_to(Block* b) { b->record_state(this); }
422 
423   // Parse all the basic blocks.
424   void do_all_blocks();
425 
426   // Parse the current basic block
427   void do_one_block();
428 
429   // Raise an error if we get a bad ciTypeFlow CFG.
430   void handle_missing_successor(int bci);
431 
432   // first actions (before BCI 0)
433   void do_method_entry();
434 

440   void ensure_phis_everywhere();
441 
442   // Merge the current mapping into the basic block starting at bci
443   void merge(          int target_bci);
444   // Same as plain merge, except that it allocates a new path number.
445   void merge_new_path( int target_bci);
446   // Merge the current mapping into an exception handler.
447   void merge_exception(int target_bci);
448   // Helper: Merge the current mapping into the given basic block
449   void merge_common(Block* target, int pnum);
450   // Helper functions for merging individual cells.
451   PhiNode *ensure_phi(       int idx, bool nocreate = false);
452   PhiNode *ensure_memory_phi(int idx, bool nocreate = false);
453   // Helper to merge the current memory state into the given basic block
454   void merge_memory_edges(MergeMemNode* n, int pnum, bool nophi);
455 
456   // Parse this bytecode, and alter the Parsers JVM->Node mapping
457   void do_one_bytecode();
458 
459   // helper function to generate array store check
460   void array_store_check();
461   // Helper function to generate array load
462   void array_load(BasicType etype);
463   // Helper function to generate array store
464   void array_store(BasicType etype);
465   // Helper function to compute array addressing
466   Node* array_addressing(BasicType type, int vals, const Type*& elemtype);

467 
468   void clinit_deopt();
469 
470   void rtm_deopt();
471 
472   // Pass current map to exits
473   void return_current(Node* value);
474 
475   // Register finalizers on return from Object.<init>
476   void call_register_finalizer();
477 
478   // Insert a compiler safepoint into the graph
479   void add_safepoint();
480 
481   // Insert a compiler safepoint into the graph, if there is a back-branch.
482   void maybe_add_safepoint(int target_bci) {
483     if (target_bci <= bci()) {
484       add_safepoint();
485     }
486   }

495 
496   // Helper functions for type checking bytecodes:
497   void  do_checkcast();
498   void  do_instanceof();
499 
500   // Helper functions for shifting & arithmetic
501   void modf();
502   void modd();
503   void l2f();
504 
505   // implementation of _get* and _put* bytecodes
506   void do_getstatic() { do_field_access(true,  false); }
507   void do_getfield () { do_field_access(true,  true); }
508   void do_putstatic() { do_field_access(false, false); }
509   void do_putfield () { do_field_access(false, true); }
510 
511   // common code for making initial checks and forming addresses
512   void do_field_access(bool is_get, bool is_field);
513 
514   // common code for actually performing the load or store
515   void do_get_xxx(Node* obj, ciField* field, bool is_field);
516   void do_put_xxx(Node* obj, ciField* field, bool is_field);
517 
518   // implementation of object creation bytecodes
519   void do_new();


520   void do_newarray(BasicType elemtype);
521   void do_anewarray();
522   void do_multianewarray();
523   Node* expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, int ndimensions, int nargs);
524 
525   // implementation of jsr/ret
526   void do_jsr();
527   void do_ret();
528 
529   float   dynamic_branch_prediction(float &cnt, BoolTest::mask btest, Node* test);
530   float   branch_prediction(float &cnt, BoolTest::mask btest, int target_bci, Node* test);
531   bool    seems_never_taken(float prob) const;
532   bool    path_is_suitable_for_uncommon_trap(float prob) const;
533   bool    seems_stable_comparison() const;
534 
535   void    do_ifnull(BoolTest::mask btest, Node* c);
536   void    do_if(BoolTest::mask btest, Node* c);





537   int     repush_if_args();
538   void    adjust_map_after_if(BoolTest::mask btest, Node* c, float prob,
539                               Block* path, Block* other_path);
540   void    sharpen_type_after_if(BoolTest::mask btest,
541                                 Node* con, const Type* tcon,
542                                 Node* val, const Type* tval);
543   void    maybe_add_predicate_after_if(Block* path);
544   IfNode* jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask, float prob, float cnt);
545   void    jump_if_true_fork(IfNode *ifNode, int dest_bci_if_true, bool unc);
546   void    jump_if_false_fork(IfNode *ifNode, int dest_bci_if_false, bool unc);
547   void    jump_if_always_fork(int dest_bci_if_true, bool unc);
548 
549   friend class SwitchRange;
550   void    do_tableswitch();
551   void    do_lookupswitch();
552   void    jump_switch_ranges(Node* a, SwitchRange* lo, SwitchRange* hi, int depth = 0);
553   bool    create_jump_tables(Node* a, SwitchRange* lo, SwitchRange* hi);
554   void    linear_search_switch_ranges(Node* key_val, SwitchRange*& lo, SwitchRange*& hi);
555 
556   void decrement_age();
557 
558   // helper function for call statistics
559   void count_compiled_calls(bool at_method_entry, bool is_inline) PRODUCT_RETURN;

394   // Must this parse be aborted?
395   bool failing()                { return C->failing(); }
396 
397   Block* rpo_at(int rpo) {
398     assert(0 <= rpo && rpo < _block_count, "oob");
399     return &_blocks[rpo];
400   }
401   Block* start_block() {
402     return rpo_at(flow()->start_block()->rpo());
403   }
404   // Can return NULL if the flow pass did not complete a block.
405   Block* successor_for_bci(int bci) {
406     return block()->successor_for_bci(bci);
407   }
408 
409  private:
410   // Create a JVMS & map for the initial state of this method.
411   SafePointNode* create_entry_map();
412 
413   // OSR helpers
414   Node* fetch_interpreter_state(int index, const Type* type, Node* local_addrs, Node* local_addrs_base);
415   Node* check_interpreter_type(Node* l, const Type* type, SafePointNode* &bad_type_exit);
416   void  load_interpreter_state(Node* osr_buf);
417 
418   // Functions for managing basic blocks:
419   void init_blocks();
420   void load_state_from(Block* b);
421   void store_state_to(Block* b) { b->record_state(this); }
422 
423   // Parse all the basic blocks.
424   void do_all_blocks();
425 
426   // Parse the current basic block
427   void do_one_block();
428 
429   // Raise an error if we get a bad ciTypeFlow CFG.
430   void handle_missing_successor(int bci);
431 
432   // first actions (before BCI 0)
433   void do_method_entry();
434 

440   void ensure_phis_everywhere();
441 
442   // Merge the current mapping into the basic block starting at bci
443   void merge(          int target_bci);
444   // Same as plain merge, except that it allocates a new path number.
445   void merge_new_path( int target_bci);
446   // Merge the current mapping into an exception handler.
447   void merge_exception(int target_bci);
448   // Helper: Merge the current mapping into the given basic block
449   void merge_common(Block* target, int pnum);
450   // Helper functions for merging individual cells.
451   PhiNode *ensure_phi(       int idx, bool nocreate = false);
452   PhiNode *ensure_memory_phi(int idx, bool nocreate = false);
453   // Helper to merge the current memory state into the given basic block
454   void merge_memory_edges(MergeMemNode* n, int pnum, bool nophi);
455 
456   // Parse this bytecode, and alter the Parsers JVM->Node mapping
457   void do_one_bytecode();
458 
459   // helper function to generate array store check
460   Node* array_store_check(Node*& adr, const Type*& elemtype);
461   // Helper function to generate array load
462   void array_load(BasicType etype);
463   // Helper function to generate array store
464   void array_store(BasicType etype);
465   // Helper function to compute array addressing
466   Node* array_addressing(BasicType type, int vals, const Type*& elemtype);
467   Node* record_profile_for_speculation_at_array_load(Node* ld);
468 
469   void clinit_deopt();
470 
471   void rtm_deopt();
472 
473   // Pass current map to exits
474   void return_current(Node* value);
475 
476   // Register finalizers on return from Object.<init>
477   void call_register_finalizer();
478 
479   // Insert a compiler safepoint into the graph
480   void add_safepoint();
481 
482   // Insert a compiler safepoint into the graph, if there is a back-branch.
483   void maybe_add_safepoint(int target_bci) {
484     if (target_bci <= bci()) {
485       add_safepoint();
486     }
487   }

496 
497   // Helper functions for type checking bytecodes:
498   void  do_checkcast();
499   void  do_instanceof();
500 
501   // Helper functions for shifting & arithmetic
502   void modf();
503   void modd();
504   void l2f();
505 
506   // implementation of _get* and _put* bytecodes
507   void do_getstatic() { do_field_access(true,  false); }
508   void do_getfield () { do_field_access(true,  true); }
509   void do_putstatic() { do_field_access(false, false); }
510   void do_putfield () { do_field_access(false, true); }
511 
512   // common code for making initial checks and forming addresses
513   void do_field_access(bool is_get, bool is_field);
514 
515   // common code for actually performing the load or store
516   void do_get_xxx(Node* obj, ciField* field);
517   void do_put_xxx(Node* obj, ciField* field, bool is_field);
518 
519   // implementation of object creation bytecodes
520   void do_new();
521   void do_defaultvalue();
522   void do_withfield();
523   void do_newarray(BasicType elemtype);
524   void do_newarray();
525   void do_multianewarray();
526   Node* expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, int ndimensions, int nargs);
527 
528   // implementation of jsr/ret
529   void do_jsr();
530   void do_ret();
531 
532   float   dynamic_branch_prediction(float &cnt, BoolTest::mask btest, Node* test);
533   float   branch_prediction(float &cnt, BoolTest::mask btest, int target_bci, Node* test);
534   bool    seems_never_taken(float prob) const;
535   bool    path_is_suitable_for_uncommon_trap(float prob) const;
536   bool    seems_stable_comparison() const;
537 
538   void    do_ifnull(BoolTest::mask btest, Node* c);
539   void    do_if(BoolTest::mask btest, Node* c, bool new_path = false, Node** ctrl_taken = NULL);
540   void    do_acmp(BoolTest::mask btest, Node* left, Node* right);
541   void    acmp_always_null_input(Node* input, const TypeOopPtr* tinput, BoolTest::mask btest, Node* eq_region);
542   void    acmp_known_non_inline_type_input(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, ciKlass* input_type, BoolTest::mask btest, Node* eq_region);
543   Node*   acmp_null_check(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, Node*& null_ctl);
544   void    acmp_unknown_non_inline_type_input(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, BoolTest::mask btest, Node* eq_region);
545   int     repush_if_args();
546   void    adjust_map_after_if(BoolTest::mask btest, Node* c, float prob, Block* path);

547   void    sharpen_type_after_if(BoolTest::mask btest,
548                                 Node* con, const Type* tcon,
549                                 Node* val, const Type* tval);
550   void    maybe_add_predicate_after_if(Block* path);
551   IfNode* jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask, float prob, float cnt);
552   void    jump_if_true_fork(IfNode *ifNode, int dest_bci_if_true, bool unc);
553   void    jump_if_false_fork(IfNode *ifNode, int dest_bci_if_false, bool unc);
554   void    jump_if_always_fork(int dest_bci_if_true, bool unc);
555 
556   friend class SwitchRange;
557   void    do_tableswitch();
558   void    do_lookupswitch();
559   void    jump_switch_ranges(Node* a, SwitchRange* lo, SwitchRange* hi, int depth = 0);
560   bool    create_jump_tables(Node* a, SwitchRange* lo, SwitchRange* hi);
561   void    linear_search_switch_ranges(Node* key_val, SwitchRange*& lo, SwitchRange*& hi);
562 
563   void decrement_age();
564 
565   // helper function for call statistics
566   void count_compiled_calls(bool at_method_entry, bool is_inline) PRODUCT_RETURN;
< prev index next >