283 284 // If reference is volatile, prevent following volatiles ops from 285 // floating up before the volatile write. 286 if (is_vol) { 287 // If not multiple copy atomic, we do the MemBarVolatile before the load. 288 if (!support_IRIW_for_not_multiple_copy_atomic_cpu) { 289 insert_mem_bar(Op_MemBarVolatile); // Use fat membar 290 } 291 // Remember we wrote a volatile field. 292 // For not multiple copy atomic cpu (ppc64) a barrier should be issued 293 // in constructors which have such stores. See do_exits() in parse1.cpp. 294 if (is_field) { 295 set_wrote_volatile(true); 296 } 297 } 298 299 if (is_field) { 300 set_wrote_fields(true); 301 } 302 303 // If the field is final, the rules of Java say we are in <init> or <clinit>. 304 // Note the presence of writes to final non-static fields, so that we 305 // can insert a memory barrier later on to keep the writes from floating 306 // out of the constructor. 307 // Any method can write a @Stable field; insert memory barriers after those also. 308 if (is_field && (field->is_final() || field->is_stable())) { 309 if (field->is_final()) { 310 set_wrote_final(true); 311 } 312 if (field->is_stable()) { 313 set_wrote_stable(true); 314 } 315 316 // Preserve allocation ptr to create precedent edge to it in membar 317 // generated on exit from constructor. 318 // Can't bind stable with its allocation, only record allocation for final field. 319 if (field->is_final() && AllocateNode::Ideal_allocation(obj, &_gvn) != NULL) { 320 set_alloc_with_final(obj); 321 } 322 } | 283 284 // If reference is volatile, prevent following volatiles ops from 285 // floating up before the volatile write. 286 if (is_vol) { 287 // If not multiple copy atomic, we do the MemBarVolatile before the load. 288 if (!support_IRIW_for_not_multiple_copy_atomic_cpu) { 289 insert_mem_bar(Op_MemBarVolatile); // Use fat membar 290 } 291 // Remember we wrote a volatile field. 292 // For not multiple copy atomic cpu (ppc64) a barrier should be issued 293 // in constructors which have such stores. See do_exits() in parse1.cpp. 294 if (is_field) { 295 set_wrote_volatile(true); 296 } 297 } 298 299 if (is_field) { 300 set_wrote_fields(true); 301 } 302 303 // Check if modification of a static final field is attempted outside of 304 // the class/interface initializer method. 305 if (!is_field && field->is_constant() && 306 strcmp(method()->name()->as_quoted_ascii(), "<clinit>") != 0) { 307 C->record_failure("The current method sets a static final field but " 308 "it is not the class or interface initializer method <clinit>."); 309 return; 310 } 311 312 // Check if modification of a static final field is attempted outside of 313 // the instance initializer method. 314 if (is_field && field->is_final() && 315 strcmp(method()->name()->as_quoted_ascii(), "<init>") != 0) { 316 C->record_failure("The current method sets a final field but " 317 "it is not the instance initializer method <init>."); 318 return; 319 } 320 321 // If the field is final, the rules of Java say we are in <init> or <clinit>. 322 // Note the presence of writes to final non-static fields, so that we 323 // can insert a memory barrier later on to keep the writes from floating 324 // out of the constructor. 325 // Any method can write a @Stable field; insert memory barriers after those also. 326 if (is_field && (field->is_final() || field->is_stable())) { 327 if (field->is_final()) { 328 set_wrote_final(true); 329 } 330 if (field->is_stable()) { 331 set_wrote_stable(true); 332 } 333 334 // Preserve allocation ptr to create precedent edge to it in membar 335 // generated on exit from constructor. 336 // Can't bind stable with its allocation, only record allocation for final field. 337 if (field->is_final() && AllocateNode::Ideal_allocation(obj, &_gvn) != NULL) { 338 set_alloc_with_final(obj); 339 } 340 } |