223 Node* store; 224 if (bt == T_OBJECT) { 225 const TypeOopPtr* field_type; 226 if (!field->type()->is_loaded()) { 227 field_type = TypeInstPtr::BOTTOM; 228 } else { 229 field_type = TypeOopPtr::make_from_klass(field->type()->as_klass()); 230 } 231 store = store_oop_to_object( control(), obj, adr, adr_type, val, field_type, bt); 232 } else { 233 store = store_to_memory( control(), adr, val, bt, adr_type, is_vol ); 234 } 235 236 // If reference is volatile, prevent following volatiles ops from 237 // floating up before the volatile write. 238 if (is_vol) { 239 // First place the specific membar for THIS volatile index. This first 240 // membar is dependent on the store, keeping any other membars generated 241 // below from floating up past the store. 242 int adr_idx = C->get_alias_index(adr_type); 243 insert_mem_bar_volatile(Op_MemBarVolatile, adr_idx); 244 245 // Now place a membar for AliasIdxBot for the unknown yet-to-be-parsed 246 // volatile alias indices. Skip this if the membar is redundant. 247 if (adr_idx != Compile::AliasIdxBot) { 248 insert_mem_bar_volatile(Op_MemBarVolatile, Compile::AliasIdxBot); 249 } 250 251 // Finally, place alias-index-specific membars for each volatile index 252 // that isn't the adr_idx membar. Typically there's only 1 or 2. 253 for( int i = Compile::AliasIdxRaw; i < C->num_alias_types(); i++ ) { 254 if (i != adr_idx && C->alias_type(i)->is_volatile()) { 255 insert_mem_bar_volatile(Op_MemBarVolatile, i); 256 } 257 } 258 } 259 260 // If the field is final, the rules of Java say we are in <init> or <clinit>. 261 // Note the presence of writes to final non-static fields, so that we 262 // can insert a memory barrier later on to keep the writes from floating 263 // out of the constructor. 264 if (is_field && field->is_final()) { 265 set_wrote_final(true); 266 } 267 } 268 269 270 bool Parse::push_constant(ciConstant constant, bool require_constant) { 271 switch (constant.basic_type()) { 272 case T_BOOLEAN: push( intcon(constant.as_boolean()) ); break; 273 case T_INT: push( intcon(constant.as_int()) ); break; 274 case T_CHAR: push( intcon(constant.as_char()) ); break; 275 case T_BYTE: push( intcon(constant.as_byte()) ); break; | 223 Node* store; 224 if (bt == T_OBJECT) { 225 const TypeOopPtr* field_type; 226 if (!field->type()->is_loaded()) { 227 field_type = TypeInstPtr::BOTTOM; 228 } else { 229 field_type = TypeOopPtr::make_from_klass(field->type()->as_klass()); 230 } 231 store = store_oop_to_object( control(), obj, adr, adr_type, val, field_type, bt); 232 } else { 233 store = store_to_memory( control(), adr, val, bt, adr_type, is_vol ); 234 } 235 236 // If reference is volatile, prevent following volatiles ops from 237 // floating up before the volatile write. 238 if (is_vol) { 239 // First place the specific membar for THIS volatile index. This first 240 // membar is dependent on the store, keeping any other membars generated 241 // below from floating up past the store. 242 int adr_idx = C->get_alias_index(adr_type); 243 insert_mem_bar_volatile(Op_MemBarVolatile, adr_idx, store); 244 245 // Now place a membar for AliasIdxBot for the unknown yet-to-be-parsed 246 // volatile alias indices. Skip this if the membar is redundant. 247 if (adr_idx != Compile::AliasIdxBot) { 248 insert_mem_bar_volatile(Op_MemBarVolatile, Compile::AliasIdxBot, store); 249 } 250 251 // Finally, place alias-index-specific membars for each volatile index 252 // that isn't the adr_idx membar. Typically there's only 1 or 2. 253 for( int i = Compile::AliasIdxRaw; i < C->num_alias_types(); i++ ) { 254 if (i != adr_idx && C->alias_type(i)->is_volatile()) { 255 insert_mem_bar_volatile(Op_MemBarVolatile, i, store); 256 } 257 } 258 } 259 260 // If the field is final, the rules of Java say we are in <init> or <clinit>. 261 // Note the presence of writes to final non-static fields, so that we 262 // can insert a memory barrier later on to keep the writes from floating 263 // out of the constructor. 264 if (is_field && field->is_final()) { 265 set_wrote_final(true); 266 } 267 } 268 269 270 bool Parse::push_constant(ciConstant constant, bool require_constant) { 271 switch (constant.basic_type()) { 272 case T_BOOLEAN: push( intcon(constant.as_boolean()) ); break; 273 case T_INT: push( intcon(constant.as_int()) ); break; 274 case T_CHAR: push( intcon(constant.as_char()) ); break; 275 case T_BYTE: push( intcon(constant.as_byte()) ); break; |