Mercurial > hg > truffle
comparison src/share/vm/opto/compile.cpp @ 8883:b9a918201d47
Merge with hsx25
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Sat, 06 Apr 2013 20:04:06 +0200 |
parents | b7c2c5b2572c |
children | cc32ccaaf47f |
comparison
equal
deleted
inserted
replaced
8660:d47b52b0ff68 | 8883:b9a918201d47 |
---|---|
890 bool save_arg_registers, | 890 bool save_arg_registers, |
891 bool return_pc ) | 891 bool return_pc ) |
892 : Phase(Compiler), | 892 : Phase(Compiler), |
893 _env(ci_env), | 893 _env(ci_env), |
894 _log(ci_env->log()), | 894 _log(ci_env->log()), |
895 _compile_id(-1), | 895 _compile_id(0), |
896 _save_argument_registers(save_arg_registers), | 896 _save_argument_registers(save_arg_registers), |
897 _method(NULL), | 897 _method(NULL), |
898 _stub_name(stub_name), | 898 _stub_name(stub_name), |
899 _stub_function(stub_function), | 899 _stub_function(stub_function), |
900 _stub_entry_point(NULL), | 900 _stub_entry_point(NULL), |
2897 if (in2->outcnt() == 0) { // Remove dead node | 2897 if (in2->outcnt() == 0) { // Remove dead node |
2898 in2->disconnect_inputs(NULL, this); | 2898 in2->disconnect_inputs(NULL, this); |
2899 } | 2899 } |
2900 } | 2900 } |
2901 break; | 2901 break; |
2902 case Op_MemBarStoreStore: | |
2903 // Break the link with AllocateNode: it is no longer useful and | |
2904 // confuses register allocation. | |
2905 if (n->req() > MemBarNode::Precedent) { | |
2906 n->set_req(MemBarNode::Precedent, top()); | |
2907 } | |
2908 break; | |
2902 default: | 2909 default: |
2903 assert( !n->is_Call(), "" ); | 2910 assert( !n->is_Call(), "" ); |
2904 assert( !n->is_Mem(), "" ); | 2911 assert( !n->is_Mem(), "" ); |
2905 break; | 2912 break; |
2906 } | 2913 } |
3667 // Clear control input and let IGVN optimize expensive nodes if | 3674 // Clear control input and let IGVN optimize expensive nodes if |
3668 // OptimizeExpensiveOps is off. | 3675 // OptimizeExpensiveOps is off. |
3669 n->set_req(0, NULL); | 3676 n->set_req(0, NULL); |
3670 } | 3677 } |
3671 } | 3678 } |
3679 | |
3680 // Auxiliary method to support randomized stressing/fuzzing. | |
3681 // | |
3682 // This method can be called the arbitrary number of times, with current count | |
3683 // as the argument. The logic allows selecting a single candidate from the | |
3684 // running list of candidates as follows: | |
3685 // int count = 0; | |
3686 // Cand* selected = null; | |
3687 // while(cand = cand->next()) { | |
3688 // if (randomized_select(++count)) { | |
3689 // selected = cand; | |
3690 // } | |
3691 // } | |
3692 // | |
3693 // Including count equalizes the chances any candidate is "selected". | |
3694 // This is useful when we don't have the complete list of candidates to choose | |
3695 // from uniformly. In this case, we need to adjust the randomicity of the | |
3696 // selection, or else we will end up biasing the selection towards the latter | |
3697 // candidates. | |
3698 // | |
3699 // Quick back-envelope calculation shows that for the list of n candidates | |
3700 // the equal probability for the candidate to persist as "best" can be | |
3701 // achieved by replacing it with "next" k-th candidate with the probability | |
3702 // of 1/k. It can be easily shown that by the end of the run, the | |
3703 // probability for any candidate is converged to 1/n, thus giving the | |
3704 // uniform distribution among all the candidates. | |
3705 // | |
3706 // We don't care about the domain size as long as (RANDOMIZED_DOMAIN / count) is large. | |
3707 #define RANDOMIZED_DOMAIN_POW 29 | |
3708 #define RANDOMIZED_DOMAIN (1 << RANDOMIZED_DOMAIN_POW) | |
3709 #define RANDOMIZED_DOMAIN_MASK ((1 << (RANDOMIZED_DOMAIN_POW + 1)) - 1) | |
3710 bool Compile::randomized_select(int count) { | |
3711 assert(count > 0, "only positive"); | |
3712 return (os::random() & RANDOMIZED_DOMAIN_MASK) < (RANDOMIZED_DOMAIN / count); | |
3713 } |