177 while (true) { |
177 while (true) { |
178 if (in->bottom_type() == TypePtr::NULL_PTR) { |
178 if (in->bottom_type() == TypePtr::NULL_PTR) { |
179 if (trace) {tty->print_cr("NULL");} |
179 if (trace) {tty->print_cr("NULL");} |
180 } else if (!in->bottom_type()->make_ptr()->make_oopptr()) { |
180 } else if (!in->bottom_type()->make_ptr()->make_oopptr()) { |
181 if (trace) {tty->print_cr("Non oop");} |
181 if (trace) {tty->print_cr("Non oop");} |
182 } else if (t == ShenandoahLoad && ShenandoahOptimizeStableFinals && |
|
183 in->bottom_type()->make_ptr()->isa_aryptr() && |
|
184 in->bottom_type()->make_ptr()->is_aryptr()->is_stable()) { |
|
185 if (trace) {tty->print_cr("Stable array load");} |
|
186 } else { |
182 } else { |
187 if (in->is_ConstraintCast()) { |
183 if (in->is_ConstraintCast()) { |
188 in = in->in(1); |
184 in = in->in(1); |
189 continue; |
185 continue; |
190 } else if (in->is_AddP()) { |
186 } else if (in->is_AddP()) { |
321 if (trace) {tty->print_cr("Mark load");} |
317 if (trace) {tty->print_cr("Mark load");} |
322 } else if (adr_type->isa_instptr() && |
318 } else if (adr_type->isa_instptr() && |
323 adr_type->is_instptr()->klass()->is_subtype_of(Compile::current()->env()->Reference_klass()) && |
319 adr_type->is_instptr()->klass()->is_subtype_of(Compile::current()->env()->Reference_klass()) && |
324 adr_type->is_instptr()->offset() == java_lang_ref_Reference::referent_offset) { |
320 adr_type->is_instptr()->offset() == java_lang_ref_Reference::referent_offset) { |
325 if (trace) {tty->print_cr("Reference.get()");} |
321 if (trace) {tty->print_cr("Reference.get()");} |
326 } else { |
322 } else if (!verify_helper(n->in(MemNode::Address), phis, visited, ShenandoahLoad, trace, barriers_used)) { |
327 bool verify = true; |
323 report_verify_failure("Shenandoah verification: Load should have barriers", n); |
328 if (adr_type->isa_instptr()) { |
|
329 const TypeInstPtr* tinst = adr_type->is_instptr(); |
|
330 ciKlass* k = tinst->klass(); |
|
331 assert(k->is_instance_klass(), ""); |
|
332 ciInstanceKlass* ik = (ciInstanceKlass*)k; |
|
333 int offset = adr_type->offset(); |
|
334 |
|
335 if ((ik->debug_final_field_at(offset) && ShenandoahOptimizeInstanceFinals) || |
|
336 (ik->debug_stable_field_at(offset) && ShenandoahOptimizeStableFinals)) { |
|
337 if (trace) {tty->print_cr("Final/stable");} |
|
338 verify = false; |
|
339 } else if (k == ciEnv::current()->Class_klass() && |
|
340 tinst->const_oop() != NULL && |
|
341 tinst->offset() >= (ik->size_helper() * wordSize)) { |
|
342 ciInstanceKlass* k = tinst->const_oop()->as_instance()->java_lang_Class_klass()->as_instance_klass(); |
|
343 ciField* field = k->get_field_by_offset(tinst->offset(), true); |
|
344 if ((ShenandoahOptimizeStaticFinals && field->is_final()) || |
|
345 (ShenandoahOptimizeStableFinals && field->is_stable())) { |
|
346 verify = false; |
|
347 } |
|
348 } |
|
349 } |
|
350 |
|
351 if (verify && !verify_helper(n->in(MemNode::Address), phis, visited, ShenandoahLoad, trace, barriers_used)) { |
|
352 report_verify_failure("Shenandoah verification: Load should have barriers", n); |
|
353 } |
|
354 } |
324 } |
355 } |
325 } |
356 } else if (n->is_Store()) { |
326 } else if (n->is_Store()) { |
357 const bool trace = false; |
327 const bool trace = false; |
358 |
328 |
3213 int alias_idx = Compile::current()->get_alias_index(adr_type); |
3183 int alias_idx = Compile::current()->get_alias_index(adr_type); |
3214 Compile::AliasType* alias_type = Compile::current()->alias_type(alias_idx); |
3184 Compile::AliasType* alias_type = Compile::current()->alias_type(alias_idx); |
3215 ciField* field = alias_type->field(); |
3185 ciField* field = alias_type->field(); |
3216 bool is_static = field != NULL && field->is_static(); |
3186 bool is_static = field != NULL && field->is_static(); |
3217 bool is_final = field != NULL && field->is_final(); |
3187 bool is_final = field != NULL && field->is_final(); |
3218 bool is_stable = field != NULL && field->is_stable(); |
|
3219 if (ShenandoahOptimizeStaticFinals && is_static && is_final) { |
3188 if (ShenandoahOptimizeStaticFinals && is_static && is_final) { |
3220 // Leave strength as is. |
|
3221 } else if (ShenandoahOptimizeInstanceFinals && !is_static && is_final) { |
|
3222 // Leave strength as is. |
|
3223 } else if (ShenandoahOptimizeStableFinals && (is_stable || (adr_type->isa_aryptr() && adr_type->isa_aryptr()->is_stable()))) { |
|
3224 // Leave strength as is. |
3189 // Leave strength as is. |
3225 } else { |
3190 } else { |
3226 strength = WEAK; |
3191 strength = WEAK; |
3227 } |
3192 } |
3228 break; |
3193 break; |
3229 } |
3194 } |
3230 case Op_AryEq: { |
3195 case Op_AryEq: |
3231 Node* n1 = n->in(2); |
|
3232 Node* n2 = n->in(3); |
|
3233 if (!ShenandoahOptimizeStableFinals || |
|
3234 !n1->bottom_type()->isa_aryptr() || !n1->bottom_type()->isa_aryptr()->is_stable() || |
|
3235 !n2->bottom_type()->isa_aryptr() || !n2->bottom_type()->isa_aryptr()->is_stable()) { |
|
3236 strength = WEAK; |
|
3237 } |
|
3238 break; |
|
3239 } |
|
3240 case Op_StrEquals: |
3196 case Op_StrEquals: |
3241 case Op_StrComp: |
3197 case Op_StrComp: |
3242 case Op_StrIndexOf: |
3198 case Op_StrIndexOf: |
3243 case Op_StrIndexOfChar: |
3199 case Op_StrIndexOfChar: |
3244 case Op_HasNegatives: |
3200 case Op_HasNegatives: |
3245 if (!ShenandoahOptimizeStableFinals) { |
3201 strength = WEAK; |
3246 strength = WEAK; |
|
3247 } |
|
3248 break; |
3202 break; |
3249 case Op_Conv2B: |
3203 case Op_Conv2B: |
3250 case Op_LoadRange: |
3204 case Op_LoadRange: |
3251 case Op_LoadKlass: |
3205 case Op_LoadKlass: |
3252 case Op_LoadNKlass: |
3206 case Op_LoadNKlass: |