src/share/vm/opto/idealKit.cpp

Print this page
rev 5661 : 8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering.


 342 }
 343 
 344 void IdealKit::set_memory(Node* mem, uint alias_idx) {
 345   merged_memory()->set_memory_at(alias_idx, mem);
 346 }
 347 
 348 //----------------------------- make_load ----------------------------
 349 Node* IdealKit::load(Node* ctl,
 350                      Node* adr,
 351                      const Type* t,
 352                      BasicType bt,
 353                      int adr_idx,
 354                      bool require_atomic_access) {
 355 
 356   assert(adr_idx != Compile::AliasIdxTop, "use other make_load factory" );
 357   const TypePtr* adr_type = NULL; // debug-mode-only argument
 358   debug_only(adr_type = C->get_adr_type(adr_idx));
 359   Node* mem = memory(adr_idx);
 360   Node* ld;
 361   if (require_atomic_access && bt == T_LONG) {
 362     ld = LoadLNode::make_atomic(C, ctl, mem, adr, adr_type, t);
 363   } else {
 364     ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt);
 365   }
 366   return transform(ld);
 367 }
 368 
 369 Node* IdealKit::store(Node* ctl, Node* adr, Node *val, BasicType bt,
 370                                 int adr_idx,
 371                                 bool require_atomic_access) {
 372   assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" );
 373   const TypePtr* adr_type = NULL;
 374   debug_only(adr_type = C->get_adr_type(adr_idx));
 375   Node *mem = memory(adr_idx);
 376   Node* st;
 377   if (require_atomic_access && bt == T_LONG) {
 378     st = StoreLNode::make_atomic(C, ctl, mem, adr, adr_type, val);
 379   } else {
 380     st = StoreNode::make(_gvn, ctl, mem, adr, adr_type, val, bt);
 381   }
 382   st = transform(st);
 383   set_memory(st, adr_idx);
 384 
 385   return st;
 386 }
 387 
 388 // Card mark store. Must be ordered so that it will come after the store of
 389 // the oop.
 390 Node* IdealKit::storeCM(Node* ctl, Node* adr, Node *val, Node* oop_store, int oop_adr_idx,
 391                         BasicType bt,
 392                         int adr_idx) {
 393   assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" );
 394   const TypePtr* adr_type = NULL;
 395   debug_only(adr_type = C->get_adr_type(adr_idx));
 396   Node *mem = memory(adr_idx);
 397 
 398   // Add required edge to oop_store, optimizer does not support precedence edges.
 399   // Convert required edge to precedence edge before allocation.
 400   Node* st = new (C) StoreCMNode(ctl, mem, adr, adr_type, val, oop_store, oop_adr_idx);




 342 }
 343 
 344 void IdealKit::set_memory(Node* mem, uint alias_idx) {
 345   merged_memory()->set_memory_at(alias_idx, mem);
 346 }
 347 
 348 //----------------------------- make_load ----------------------------
 349 Node* IdealKit::load(Node* ctl,
 350                      Node* adr,
 351                      const Type* t,
 352                      BasicType bt,
 353                      int adr_idx,
 354                      bool require_atomic_access) {
 355 
 356   assert(adr_idx != Compile::AliasIdxTop, "use other make_load factory" );
 357   const TypePtr* adr_type = NULL; // debug-mode-only argument
 358   debug_only(adr_type = C->get_adr_type(adr_idx));
 359   Node* mem = memory(adr_idx);
 360   Node* ld;
 361   if (require_atomic_access && bt == T_LONG) {
 362     ld = LoadLNode::make_atomic(C, ctl, mem, adr, adr_type, t, LoadNode::unordered);
 363   } else {
 364     ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt, LoadNode::unordered);
 365   }
 366   return transform(ld);
 367 }
 368 
 369 Node* IdealKit::store(Node* ctl, Node* adr, Node *val, BasicType bt,
 370                                 int adr_idx,
 371                                 bool require_atomic_access, StoreNode::Sem sem) {
 372   assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory");
 373   const TypePtr* adr_type = NULL;
 374   debug_only(adr_type = C->get_adr_type(adr_idx));
 375   Node *mem = memory(adr_idx);
 376   Node* st;
 377   if (require_atomic_access && bt == T_LONG) {
 378     st = StoreLNode::make_atomic(C, ctl, mem, adr, adr_type, val, sem);
 379   } else {
 380     st = StoreNode::make(_gvn, ctl, mem, adr, adr_type, val, bt, sem);
 381   }
 382   st = transform(st);
 383   set_memory(st, adr_idx);
 384 
 385   return st;
 386 }
 387 
 388 // Card mark store. Must be ordered so that it will come after the store of
 389 // the oop.
 390 Node* IdealKit::storeCM(Node* ctl, Node* adr, Node *val, Node* oop_store, int oop_adr_idx,
 391                         BasicType bt,
 392                         int adr_idx) {
 393   assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" );
 394   const TypePtr* adr_type = NULL;
 395   debug_only(adr_type = C->get_adr_type(adr_idx));
 396   Node *mem = memory(adr_idx);
 397 
 398   // Add required edge to oop_store, optimizer does not support precedence edges.
 399   // Convert required edge to precedence edge before allocation.
 400   Node* st = new (C) StoreCMNode(ctl, mem, adr, adr_type, val, oop_store, oop_adr_idx);