Mercurial > hg > truffle
comparison src/share/vm/opto/parse3.cpp @ 11164:fcf521c3fbc6
8007898: Incorrect optimization of Memory Barriers in Matcher::post_store_load_barrier()
Summary: generate one "fat" membar instead of set of barriers for volitile store
Reviewed-by: roland
author | kvn |
---|---|
date | Fri, 12 Jul 2013 14:03:10 -0700 |
parents | 6f3fd5150b67 |
children | edb5ab0f3fe5 |
comparison
equal
deleted
inserted
replaced
11163:c90c698831d7 | 11164:fcf521c3fbc6 |
---|---|
292 } | 292 } |
293 | 293 |
294 // If reference is volatile, prevent following volatiles ops from | 294 // If reference is volatile, prevent following volatiles ops from |
295 // floating up before the volatile write. | 295 // floating up before the volatile write. |
296 if (is_vol) { | 296 if (is_vol) { |
297 // First place the specific membar for THIS volatile index. This first | 297 insert_mem_bar(Op_MemBarVolatile); // Use fat membar |
298 // membar is dependent on the store, keeping any other membars generated | |
299 // below from floating up past the store. | |
300 int adr_idx = C->get_alias_index(adr_type); | |
301 insert_mem_bar_volatile(Op_MemBarVolatile, adr_idx, store); | |
302 | |
303 // Now place a membar for AliasIdxBot for the unknown yet-to-be-parsed | |
304 // volatile alias indices. Skip this if the membar is redundant. | |
305 if (adr_idx != Compile::AliasIdxBot) { | |
306 insert_mem_bar_volatile(Op_MemBarVolatile, Compile::AliasIdxBot, store); | |
307 } | |
308 | |
309 // Finally, place alias-index-specific membars for each volatile index | |
310 // that isn't the adr_idx membar. Typically there's only 1 or 2. | |
311 for( int i = Compile::AliasIdxRaw; i < C->num_alias_types(); i++ ) { | |
312 if (i != adr_idx && C->alias_type(i)->is_volatile()) { | |
313 insert_mem_bar_volatile(Op_MemBarVolatile, i, store); | |
314 } | |
315 } | |
316 } | 298 } |
317 | 299 |
318 // If the field is final, the rules of Java say we are in <init> or <clinit>. | 300 // If the field is final, the rules of Java say we are in <init> or <clinit>. |
319 // Note the presence of writes to final non-static fields, so that we | 301 // Note the presence of writes to final non-static fields, so that we |
320 // can insert a memory barrier later on to keep the writes from floating | 302 // can insert a memory barrier later on to keep the writes from floating |