Mercurial > hg > truffle
comparison src/share/vm/opto/parse2.cpp @ 276:aa8f54688692
Merge
author | trims |
---|---|
date | Sun, 10 Aug 2008 21:31:42 -0700 |
parents | 3e333d6f35dd |
children | 8261ee795323 |
comparison
equal
deleted
inserted
replaced
240:585535ec8a14 | 276:aa8f54688692 |
---|---|
873 // counts would keep the program recompiling indefinitely. | 873 // counts would keep the program recompiling indefinitely. |
874 bool Parse::seems_never_taken(float prob) { | 874 bool Parse::seems_never_taken(float prob) { |
875 return prob < PROB_MIN; | 875 return prob < PROB_MIN; |
876 } | 876 } |
877 | 877 |
878 //-------------------------------repush_if_args-------------------------------- | |
879 // Push arguments of an "if" bytecode back onto the stack by adjusting _sp. | |
878 inline void Parse::repush_if_args() { | 880 inline void Parse::repush_if_args() { |
879 #ifndef PRODUCT | 881 #ifndef PRODUCT |
880 if (PrintOpto && WizardMode) { | 882 if (PrintOpto && WizardMode) { |
881 tty->print("defending against excessive implicit null exceptions on %s @%d in ", | 883 tty->print("defending against excessive implicit null exceptions on %s @%d in ", |
882 Bytecodes::name(iter().cur_bc()), iter().cur_bci()); | 884 Bytecodes::name(iter().cur_bc()), iter().cur_bci()); |
890 assert(bc_depth == 1 || argument(1) != NULL, "two must exist"); | 892 assert(bc_depth == 1 || argument(1) != NULL, "two must exist"); |
891 _sp += bc_depth; | 893 _sp += bc_depth; |
892 } | 894 } |
893 | 895 |
894 //----------------------------------do_ifnull---------------------------------- | 896 //----------------------------------do_ifnull---------------------------------- |
895 void Parse::do_ifnull(BoolTest::mask btest) { | 897 void Parse::do_ifnull(BoolTest::mask btest, Node *c) { |
896 int target_bci = iter().get_dest(); | 898 int target_bci = iter().get_dest(); |
897 | 899 |
898 Block* branch_block = successor_for_bci(target_bci); | 900 Block* branch_block = successor_for_bci(target_bci); |
899 Block* next_block = successor_for_bci(iter().next_bci()); | 901 Block* next_block = successor_for_bci(iter().next_bci()); |
900 | 902 |
902 float prob = branch_prediction(cnt, btest, target_bci); | 904 float prob = branch_prediction(cnt, btest, target_bci); |
903 if (prob == PROB_UNKNOWN) { | 905 if (prob == PROB_UNKNOWN) { |
904 // (An earlier version of do_ifnull omitted this trap for OSR methods.) | 906 // (An earlier version of do_ifnull omitted this trap for OSR methods.) |
905 #ifndef PRODUCT | 907 #ifndef PRODUCT |
906 if (PrintOpto && Verbose) | 908 if (PrintOpto && Verbose) |
907 tty->print_cr("Never-taken backedge stops compilation at bci %d",bci()); | 909 tty->print_cr("Never-taken edge stops compilation at bci %d",bci()); |
908 #endif | 910 #endif |
909 repush_if_args(); // to gather stats on loop | 911 repush_if_args(); // to gather stats on loop |
910 // We need to mark this branch as taken so that if we recompile we will | 912 // We need to mark this branch as taken so that if we recompile we will |
911 // see that it is possible. In the tiered system the interpreter doesn't | 913 // see that it is possible. In the tiered system the interpreter doesn't |
912 // do profiling and by the time we get to the lower tier from the interpreter | 914 // do profiling and by the time we get to the lower tier from the interpreter |
921 next_block->next_path_num(); | 923 next_block->next_path_num(); |
922 } | 924 } |
923 return; | 925 return; |
924 } | 926 } |
925 | 927 |
926 // If this is a backwards branch in the bytecodes, add Safepoint | |
927 maybe_add_safepoint(target_bci); | |
928 | |
929 explicit_null_checks_inserted++; | 928 explicit_null_checks_inserted++; |
930 Node* a = null(); | |
931 Node* b = pop(); | |
932 Node* c = _gvn.transform( new (C, 3) CmpPNode(b, a) ); | |
933 | |
934 // Make a cast-away-nullness that is control dependent on the test | |
935 const Type *t = _gvn.type(b); | |
936 const Type *t_not_null = t->join(TypePtr::NOTNULL); | |
937 Node *cast = new (C, 2) CastPPNode(b,t_not_null); | |
938 | 929 |
939 // Generate real control flow | 930 // Generate real control flow |
940 Node *tst = _gvn.transform( new (C, 2) BoolNode( c, btest ) ); | 931 Node *tst = _gvn.transform( new (C, 2) BoolNode( c, btest ) ); |
941 | 932 |
942 // Sanity check the probability value | 933 // Sanity check the probability value |
994 float untaken_prob = 1.0 - prob; | 985 float untaken_prob = 1.0 - prob; |
995 | 986 |
996 if (prob == PROB_UNKNOWN) { | 987 if (prob == PROB_UNKNOWN) { |
997 #ifndef PRODUCT | 988 #ifndef PRODUCT |
998 if (PrintOpto && Verbose) | 989 if (PrintOpto && Verbose) |
999 tty->print_cr("Never-taken backedge stops compilation at bci %d",bci()); | 990 tty->print_cr("Never-taken edge stops compilation at bci %d",bci()); |
1000 #endif | 991 #endif |
1001 repush_if_args(); // to gather stats on loop | 992 repush_if_args(); // to gather stats on loop |
1002 // We need to mark this branch as taken so that if we recompile we will | 993 // We need to mark this branch as taken so that if we recompile we will |
1003 // see that it is possible. In the tiered system the interpreter doesn't | 994 // see that it is possible. In the tiered system the interpreter doesn't |
1004 // do profiling and by the time we get to the lower tier from the interpreter | 995 // do profiling and by the time we get to the lower tier from the interpreter |
2098 taken = method()->scale_count(taken); | 2089 taken = method()->scale_count(taken); |
2099 target_block->set_count(taken); | 2090 target_block->set_count(taken); |
2100 break; | 2091 break; |
2101 } | 2092 } |
2102 | 2093 |
2103 case Bytecodes::_ifnull: | 2094 case Bytecodes::_ifnull: btest = BoolTest::eq; goto handle_if_null; |
2104 do_ifnull(BoolTest::eq); | 2095 case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null; |
2105 break; | 2096 handle_if_null: |
2106 case Bytecodes::_ifnonnull: | 2097 // If this is a backwards branch in the bytecodes, add Safepoint |
2107 do_ifnull(BoolTest::ne); | 2098 maybe_add_safepoint(iter().get_dest()); |
2099 a = null(); | |
2100 b = pop(); | |
2101 c = _gvn.transform( new (C, 3) CmpPNode(b, a) ); | |
2102 do_ifnull(btest, c); | |
2108 break; | 2103 break; |
2109 | 2104 |
2110 case Bytecodes::_if_acmpeq: btest = BoolTest::eq; goto handle_if_acmp; | 2105 case Bytecodes::_if_acmpeq: btest = BoolTest::eq; goto handle_if_acmp; |
2111 case Bytecodes::_if_acmpne: btest = BoolTest::ne; goto handle_if_acmp; | 2106 case Bytecodes::_if_acmpne: btest = BoolTest::ne; goto handle_if_acmp; |
2112 handle_if_acmp: | 2107 handle_if_acmp: |