Mercurial > hg > truffle
comparison src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp @ 14909:4ca6dc0799b6
Backout jdk9 merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 01 Apr 2014 13:57:07 +0200 |
parents | d8041d695d19 |
children | 52b4284cb496 |
comparison
equal
deleted
inserted
replaced
14908:8db6e76cb658 | 14909:4ca6dc0799b6 |
---|---|
1313 ShouldNotReachHere(); | 1313 ShouldNotReachHere(); |
1314 } | 1314 } |
1315 } | 1315 } |
1316 | 1316 |
1317 Address LIR_Assembler::as_Address(LIR_Address* addr) { | 1317 Address LIR_Assembler::as_Address(LIR_Address* addr) { |
1318 Register reg = addr->base()->as_pointer_register(); | 1318 Register reg = addr->base()->as_register(); |
1319 LIR_Opr index = addr->index(); | 1319 LIR_Opr index = addr->index(); |
1320 if (index->is_illegal()) { | 1320 if (index->is_illegal()) { |
1321 return Address(reg, addr->disp()); | 1321 return Address(reg, addr->disp()); |
1322 } else { | 1322 } else { |
1323 assert (addr->disp() == 0, "unsupported address mode"); | 1323 assert (addr->disp() == 0, "unsupported address mode"); |
3098 __ st_ptr(tmp1, counter_addr); | 3098 __ st_ptr(tmp1, counter_addr); |
3099 } | 3099 } |
3100 } | 3100 } |
3101 | 3101 |
3102 void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) { | 3102 void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) { |
3103 Register obj = op->obj()->as_register(); | 3103 fatal("Type profiling not implemented on this platform"); |
3104 Register tmp1 = op->tmp()->as_pointer_register(); | |
3105 Register tmp2 = G1; | |
3106 Address mdo_addr = as_Address(op->mdp()->as_address_ptr()); | |
3107 ciKlass* exact_klass = op->exact_klass(); | |
3108 intptr_t current_klass = op->current_klass(); | |
3109 bool not_null = op->not_null(); | |
3110 bool no_conflict = op->no_conflict(); | |
3111 | |
3112 Label update, next, none; | |
3113 | |
3114 bool do_null = !not_null; | |
3115 bool exact_klass_set = exact_klass != NULL && ciTypeEntries::valid_ciklass(current_klass) == exact_klass; | |
3116 bool do_update = !TypeEntries::is_type_unknown(current_klass) && !exact_klass_set; | |
3117 | |
3118 assert(do_null || do_update, "why are we here?"); | |
3119 assert(!TypeEntries::was_null_seen(current_klass) || do_update, "why are we here?"); | |
3120 | |
3121 __ verify_oop(obj); | |
3122 | |
3123 if (tmp1 != obj) { | |
3124 __ mov(obj, tmp1); | |
3125 } | |
3126 if (do_null) { | |
3127 __ br_notnull_short(tmp1, Assembler::pt, update); | |
3128 if (!TypeEntries::was_null_seen(current_klass)) { | |
3129 __ ld_ptr(mdo_addr, tmp1); | |
3130 __ or3(tmp1, TypeEntries::null_seen, tmp1); | |
3131 __ st_ptr(tmp1, mdo_addr); | |
3132 } | |
3133 if (do_update) { | |
3134 __ ba(next); | |
3135 __ delayed()->nop(); | |
3136 } | |
3137 #ifdef ASSERT | |
3138 } else { | |
3139 __ br_notnull_short(tmp1, Assembler::pt, update); | |
3140 __ stop("unexpect null obj"); | |
3141 #endif | |
3142 } | |
3143 | |
3144 __ bind(update); | |
3145 | |
3146 if (do_update) { | |
3147 #ifdef ASSERT | |
3148 if (exact_klass != NULL) { | |
3149 Label ok; | |
3150 __ load_klass(tmp1, tmp1); | |
3151 metadata2reg(exact_klass->constant_encoding(), tmp2); | |
3152 __ cmp_and_br_short(tmp1, tmp2, Assembler::equal, Assembler::pt, ok); | |
3153 __ stop("exact klass and actual klass differ"); | |
3154 __ bind(ok); | |
3155 } | |
3156 #endif | |
3157 | |
3158 Label do_update; | |
3159 __ ld_ptr(mdo_addr, tmp2); | |
3160 | |
3161 if (!no_conflict) { | |
3162 if (exact_klass == NULL || TypeEntries::is_type_none(current_klass)) { | |
3163 if (exact_klass != NULL) { | |
3164 metadata2reg(exact_klass->constant_encoding(), tmp1); | |
3165 } else { | |
3166 __ load_klass(tmp1, tmp1); | |
3167 } | |
3168 | |
3169 __ xor3(tmp1, tmp2, tmp1); | |
3170 __ btst(TypeEntries::type_klass_mask, tmp1); | |
3171 // klass seen before, nothing to do. The unknown bit may have been | |
3172 // set already but no need to check. | |
3173 __ brx(Assembler::zero, false, Assembler::pt, next); | |
3174 __ delayed()-> | |
3175 | |
3176 btst(TypeEntries::type_unknown, tmp1); | |
3177 // already unknown. Nothing to do anymore. | |
3178 __ brx(Assembler::notZero, false, Assembler::pt, next); | |
3179 | |
3180 if (TypeEntries::is_type_none(current_klass)) { | |
3181 __ delayed()->btst(TypeEntries::type_mask, tmp2); | |
3182 __ brx(Assembler::zero, true, Assembler::pt, do_update); | |
3183 // first time here. Set profile type. | |
3184 __ delayed()->or3(tmp2, tmp1, tmp2); | |
3185 } else { | |
3186 __ delayed()->nop(); | |
3187 } | |
3188 } else { | |
3189 assert(ciTypeEntries::valid_ciklass(current_klass) != NULL && | |
3190 ciTypeEntries::valid_ciklass(current_klass) != exact_klass, "conflict only"); | |
3191 | |
3192 __ btst(TypeEntries::type_unknown, tmp2); | |
3193 // already unknown. Nothing to do anymore. | |
3194 __ brx(Assembler::notZero, false, Assembler::pt, next); | |
3195 __ delayed()->nop(); | |
3196 } | |
3197 | |
3198 // different than before. Cannot keep accurate profile. | |
3199 __ or3(tmp2, TypeEntries::type_unknown, tmp2); | |
3200 } else { | |
3201 // There's a single possible klass at this profile point | |
3202 assert(exact_klass != NULL, "should be"); | |
3203 if (TypeEntries::is_type_none(current_klass)) { | |
3204 metadata2reg(exact_klass->constant_encoding(), tmp1); | |
3205 __ xor3(tmp1, tmp2, tmp1); | |
3206 __ btst(TypeEntries::type_klass_mask, tmp1); | |
3207 __ brx(Assembler::zero, false, Assembler::pt, next); | |
3208 #ifdef ASSERT | |
3209 | |
3210 { | |
3211 Label ok; | |
3212 __ delayed()->btst(TypeEntries::type_mask, tmp2); | |
3213 __ brx(Assembler::zero, true, Assembler::pt, ok); | |
3214 __ delayed()->nop(); | |
3215 | |
3216 __ stop("unexpected profiling mismatch"); | |
3217 __ bind(ok); | |
3218 } | |
3219 // first time here. Set profile type. | |
3220 __ or3(tmp2, tmp1, tmp2); | |
3221 #else | |
3222 // first time here. Set profile type. | |
3223 __ delayed()->or3(tmp2, tmp1, tmp2); | |
3224 #endif | |
3225 | |
3226 } else { | |
3227 assert(ciTypeEntries::valid_ciklass(current_klass) != NULL && | |
3228 ciTypeEntries::valid_ciklass(current_klass) != exact_klass, "inconsistent"); | |
3229 | |
3230 // already unknown. Nothing to do anymore. | |
3231 __ btst(TypeEntries::type_unknown, tmp2); | |
3232 __ brx(Assembler::notZero, false, Assembler::pt, next); | |
3233 __ delayed()->or3(tmp2, TypeEntries::type_unknown, tmp2); | |
3234 } | |
3235 } | |
3236 | |
3237 __ bind(do_update); | |
3238 __ st_ptr(tmp2, mdo_addr); | |
3239 | |
3240 __ bind(next); | |
3241 } | |
3242 } | 3104 } |
3243 | 3105 |
3244 void LIR_Assembler::align_backward_branch_target() { | 3106 void LIR_Assembler::align_backward_branch_target() { |
3245 __ align(OptoLoopAlignment); | 3107 __ align(OptoLoopAlignment); |
3246 } | 3108 } |
3456 } | 3318 } |
3457 | 3319 |
3458 | 3320 |
3459 void LIR_Assembler::leal(LIR_Opr addr_opr, LIR_Opr dest) { | 3321 void LIR_Assembler::leal(LIR_Opr addr_opr, LIR_Opr dest) { |
3460 LIR_Address* addr = addr_opr->as_address_ptr(); | 3322 LIR_Address* addr = addr_opr->as_address_ptr(); |
3461 assert(addr->index()->is_illegal() && addr->scale() == LIR_Address::times_1, "can't handle complex addresses yet"); | 3323 assert(addr->index()->is_illegal() && addr->scale() == LIR_Address::times_1 && Assembler::is_simm13(addr->disp()), "can't handle complex addresses yet"); |
3462 | 3324 |
3463 if (Assembler::is_simm13(addr->disp())) { | 3325 __ add(addr->base()->as_pointer_register(), addr->disp(), dest->as_pointer_register()); |
3464 __ add(addr->base()->as_pointer_register(), addr->disp(), dest->as_pointer_register()); | |
3465 } else { | |
3466 __ set(addr->disp(), G3_scratch); | |
3467 __ add(addr->base()->as_pointer_register(), G3_scratch, dest->as_pointer_register()); | |
3468 } | |
3469 } | 3326 } |
3470 | 3327 |
3471 | 3328 |
3472 void LIR_Assembler::get_thread(LIR_Opr result_reg) { | 3329 void LIR_Assembler::get_thread(LIR_Opr result_reg) { |
3473 assert(result_reg->is_register(), "check"); | 3330 assert(result_reg->is_register(), "check"); |