Mercurial > hg > truffle
comparison src/share/vm/c1/c1_LinearScan.cpp @ 722:a134d9824964
6828024: verification of fixed interval usage is too weak
Reviewed-by: kvn
author | never |
---|---|
date | Thu, 16 Apr 2009 15:50:32 -0700 |
parents | 9ee9cf798b59 |
children | bd02caa94611 |
comparison
equal
deleted
inserted
replaced
721:1b42d5772ae0 | 722:a134d9824964 |
---|---|
2954 propagate_spill_slots(); | 2954 propagate_spill_slots(); |
2955 CHECK_BAILOUT(); | 2955 CHECK_BAILOUT(); |
2956 | 2956 |
2957 NOT_PRODUCT(print_intervals("After Register Allocation")); | 2957 NOT_PRODUCT(print_intervals("After Register Allocation")); |
2958 NOT_PRODUCT(print_lir(2, "LIR after register allocation:")); | 2958 NOT_PRODUCT(print_lir(2, "LIR after register allocation:")); |
2959 | |
2960 sort_intervals_after_allocation(); | |
2961 | |
2959 DEBUG_ONLY(verify()); | 2962 DEBUG_ONLY(verify()); |
2960 | 2963 |
2961 sort_intervals_after_allocation(); | |
2962 eliminate_spill_moves(); | 2964 eliminate_spill_moves(); |
2963 assign_reg_num(); | 2965 assign_reg_num(); |
2964 CHECK_BAILOUT(); | 2966 CHECK_BAILOUT(); |
2965 | 2967 |
2966 NOT_PRODUCT(print_lir(2, "LIR after assignment of register numbers:")); | 2968 NOT_PRODUCT(print_lir(2, "LIR after assignment of register numbers:")); |
3145 assert(has_error == false, "register allocation invalid"); | 3147 assert(has_error == false, "register allocation invalid"); |
3146 } | 3148 } |
3147 | 3149 |
3148 | 3150 |
3149 void LinearScan::verify_no_oops_in_fixed_intervals() { | 3151 void LinearScan::verify_no_oops_in_fixed_intervals() { |
3152 Interval* fixed_intervals; | |
3153 Interval* other_intervals; | |
3154 create_unhandled_lists(&fixed_intervals, &other_intervals, is_precolored_cpu_interval, NULL); | |
3155 | |
3156 // to ensure a walking until the last instruction id, add a dummy interval | |
3157 // with a high operation id | |
3158 other_intervals = new Interval(any_reg); | |
3159 other_intervals->add_range(max_jint - 2, max_jint - 1); | |
3160 IntervalWalker* iw = new IntervalWalker(this, fixed_intervals, other_intervals); | |
3161 | |
3150 LIR_OpVisitState visitor; | 3162 LIR_OpVisitState visitor; |
3151 for (int i = 0; i < block_count(); i++) { | 3163 for (int i = 0; i < block_count(); i++) { |
3152 BlockBegin* block = block_at(i); | 3164 BlockBegin* block = block_at(i); |
3153 | 3165 |
3154 LIR_OpList* instructions = block->lir()->instructions_list(); | 3166 LIR_OpList* instructions = block->lir()->instructions_list(); |
3156 for (int j = 0; j < instructions->length(); j++) { | 3168 for (int j = 0; j < instructions->length(); j++) { |
3157 LIR_Op* op = instructions->at(j); | 3169 LIR_Op* op = instructions->at(j); |
3158 int op_id = op->id(); | 3170 int op_id = op->id(); |
3159 | 3171 |
3160 visitor.visit(op); | 3172 visitor.visit(op); |
3173 | |
3174 if (visitor.info_count() > 0) { | |
3175 iw->walk_before(op->id()); | |
3176 bool check_live = true; | |
3177 if (op->code() == lir_move) { | |
3178 LIR_Op1* move = (LIR_Op1*)op; | |
3179 check_live = (move->patch_code() == lir_patch_none); | |
3180 } | |
3181 LIR_OpBranch* branch = op->as_OpBranch(); | |
3182 if (branch != NULL && branch->stub() != NULL && branch->stub()->is_exception_throw_stub()) { | |
3183 // Don't bother checking the stub in this case since the | |
3184 // exception stub will never return to normal control flow. | |
3185 check_live = false; | |
3186 } | |
3187 | |
3188 // Make sure none of the fixed registers is live across an | |
3189 // oopmap since we can't handle that correctly. | |
3190 if (check_live) { | |
3191 for (Interval* interval = iw->active_first(fixedKind); | |
3192 interval != Interval::end(); | |
3193 interval = interval->next()) { | |
3194 if (interval->current_to() > op->id() + 1) { | |
3195 // This interval is live out of this op so make sure | |
3196 // that this interval represents some value that's | |
3197 // referenced by this op either as an input or output. | |
3198 bool ok = false; | |
3199 for_each_visitor_mode(mode) { | |
3200 int n = visitor.opr_count(mode); | |
3201 for (int k = 0; k < n; k++) { | |
3202 LIR_Opr opr = visitor.opr_at(mode, k); | |
3203 if (opr->is_fixed_cpu()) { | |
3204 if (interval_at(reg_num(opr)) == interval) { | |
3205 ok = true; | |
3206 break; | |
3207 } | |
3208 int hi = reg_numHi(opr); | |
3209 if (hi != -1 && interval_at(hi) == interval) { | |
3210 ok = true; | |
3211 break; | |
3212 } | |
3213 } | |
3214 } | |
3215 } | |
3216 assert(ok, "fixed intervals should never be live across an oopmap point"); | |
3217 } | |
3218 } | |
3219 } | |
3220 } | |
3161 | 3221 |
3162 // oop-maps at calls do not contain registers, so check is not needed | 3222 // oop-maps at calls do not contain registers, so check is not needed |
3163 if (!visitor.has_call()) { | 3223 if (!visitor.has_call()) { |
3164 | 3224 |
3165 for_each_visitor_mode(mode) { | 3225 for_each_visitor_mode(mode) { |