comparison src/share/vm/opto/graphKit.hpp @ 14429:2113136690bc

8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering Summary: Add a field to C2 LoadNode and StoreNode classes which indicates whether the load/store should do an acquire/release on platforms which support it. Reviewed-by: kvn
author goetz
date Fri, 15 Nov 2013 11:05:32 -0800
parents b2ee5dc63353
children abec000618bf
comparison
equal deleted inserted replaced
14427:eb178e97560c 14429:2113136690bc
508 // Create a memory projection from the call, then set_all_memory. 508 // Create a memory projection from the call, then set_all_memory.
509 void set_all_memory_call(Node* call, bool separate_io_proj = false); 509 void set_all_memory_call(Node* call, bool separate_io_proj = false);
510 510
511 // Create a LoadNode, reading from the parser's memory state. 511 // Create a LoadNode, reading from the parser's memory state.
512 // (Note: require_atomic_access is useful only with T_LONG.) 512 // (Note: require_atomic_access is useful only with T_LONG.)
513 //
514 // We choose the unordered semantics by default because we have
515 // adapted the `do_put_xxx' and `do_get_xxx' procedures for the case
516 // of volatile fields.
513 Node* make_load(Node* ctl, Node* adr, const Type* t, BasicType bt, 517 Node* make_load(Node* ctl, Node* adr, const Type* t, BasicType bt,
514 bool require_atomic_access = false) { 518 MemNode::MemOrd mo, bool require_atomic_access = false) {
515 // This version computes alias_index from bottom_type 519 // This version computes alias_index from bottom_type
516 return make_load(ctl, adr, t, bt, adr->bottom_type()->is_ptr(), 520 return make_load(ctl, adr, t, bt, adr->bottom_type()->is_ptr(),
517 require_atomic_access); 521 mo, require_atomic_access);
518 } 522 }
519 Node* make_load(Node* ctl, Node* adr, const Type* t, BasicType bt, const TypePtr* adr_type, bool require_atomic_access = false) { 523 Node* make_load(Node* ctl, Node* adr, const Type* t, BasicType bt, const TypePtr* adr_type,
524 MemNode::MemOrd mo, bool require_atomic_access = false) {
520 // This version computes alias_index from an address type 525 // This version computes alias_index from an address type
521 assert(adr_type != NULL, "use other make_load factory"); 526 assert(adr_type != NULL, "use other make_load factory");
522 return make_load(ctl, adr, t, bt, C->get_alias_index(adr_type), 527 return make_load(ctl, adr, t, bt, C->get_alias_index(adr_type),
523 require_atomic_access); 528 mo, require_atomic_access);
524 } 529 }
525 // This is the base version which is given an alias index. 530 // This is the base version which is given an alias index.
526 Node* make_load(Node* ctl, Node* adr, const Type* t, BasicType bt, int adr_idx, bool require_atomic_access = false); 531 Node* make_load(Node* ctl, Node* adr, const Type* t, BasicType bt, int adr_idx,
532 MemNode::MemOrd mo, bool require_atomic_access = false);
527 533
528 // Create & transform a StoreNode and store the effect into the 534 // Create & transform a StoreNode and store the effect into the
529 // parser's memory state. 535 // parser's memory state.
536 //
537 // We must ensure that stores of object references will be visible
538 // only after the object's initialization. So the clients of this
539 // procedure must indicate that the store requires `release'
540 // semantics, if the stored value is an object reference that might
541 // point to a new object and may become externally visible.
530 Node* store_to_memory(Node* ctl, Node* adr, Node* val, BasicType bt, 542 Node* store_to_memory(Node* ctl, Node* adr, Node* val, BasicType bt,
531 const TypePtr* adr_type, 543 const TypePtr* adr_type,
544 MemNode::MemOrd mo,
532 bool require_atomic_access = false) { 545 bool require_atomic_access = false) {
533 // This version computes alias_index from an address type 546 // This version computes alias_index from an address type
534 assert(adr_type != NULL, "use other store_to_memory factory"); 547 assert(adr_type != NULL, "use other store_to_memory factory");
535 return store_to_memory(ctl, adr, val, bt, 548 return store_to_memory(ctl, adr, val, bt,
536 C->get_alias_index(adr_type), 549 C->get_alias_index(adr_type),
537 require_atomic_access); 550 mo, require_atomic_access);
538 } 551 }
539 // This is the base version which is given alias index 552 // This is the base version which is given alias index
540 // Return the new StoreXNode 553 // Return the new StoreXNode
541 Node* store_to_memory(Node* ctl, Node* adr, Node* val, BasicType bt, 554 Node* store_to_memory(Node* ctl, Node* adr, Node* val, BasicType bt,
542 int adr_idx, 555 int adr_idx,
556 MemNode::MemOrd,
543 bool require_atomic_access = false); 557 bool require_atomic_access = false);
544 558
545 559
546 // All in one pre-barrier, store, post_barrier 560 // All in one pre-barrier, store, post_barrier
547 // Insert a write-barrier'd store. This is to let generational GC 561 // Insert a write-barrier'd store. This is to let generational GC
555 // 569 //
556 // If val==NULL, it is taken to be a completely unknown value. QQQ 570 // If val==NULL, it is taken to be a completely unknown value. QQQ
557 571
558 Node* store_oop(Node* ctl, 572 Node* store_oop(Node* ctl,
559 Node* obj, // containing obj 573 Node* obj, // containing obj
560 Node* adr, // actual adress to store val at 574 Node* adr, // actual adress to store val at
561 const TypePtr* adr_type, 575 const TypePtr* adr_type,
562 Node* val, 576 Node* val,
563 const TypeOopPtr* val_type, 577 const TypeOopPtr* val_type,
564 BasicType bt, 578 BasicType bt,
565 bool use_precise); 579 bool use_precise,
580 MemNode::MemOrd mo);
566 581
567 Node* store_oop_to_object(Node* ctl, 582 Node* store_oop_to_object(Node* ctl,
568 Node* obj, // containing obj 583 Node* obj, // containing obj
569 Node* adr, // actual adress to store val at 584 Node* adr, // actual adress to store val at
570 const TypePtr* adr_type, 585 const TypePtr* adr_type,
571 Node* val, 586 Node* val,
572 const TypeOopPtr* val_type, 587 const TypeOopPtr* val_type,
573 BasicType bt) { 588 BasicType bt,
574 return store_oop(ctl, obj, adr, adr_type, val, val_type, bt, false); 589 MemNode::MemOrd mo) {
590 return store_oop(ctl, obj, adr, adr_type, val, val_type, bt, false, mo);
575 } 591 }
576 592
577 Node* store_oop_to_array(Node* ctl, 593 Node* store_oop_to_array(Node* ctl,
578 Node* obj, // containing obj 594 Node* obj, // containing obj
579 Node* adr, // actual adress to store val at 595 Node* adr, // actual adress to store val at
580 const TypePtr* adr_type, 596 const TypePtr* adr_type,
581 Node* val, 597 Node* val,
582 const TypeOopPtr* val_type, 598 const TypeOopPtr* val_type,
583 BasicType bt) { 599 BasicType bt,
584 return store_oop(ctl, obj, adr, adr_type, val, val_type, bt, true); 600 MemNode::MemOrd mo) {
601 return store_oop(ctl, obj, adr, adr_type, val, val_type, bt, true, mo);
585 } 602 }
586 603
587 // Could be an array or object we don't know at compile time (unsafe ref.) 604 // Could be an array or object we don't know at compile time (unsafe ref.)
588 Node* store_oop_to_unknown(Node* ctl, 605 Node* store_oop_to_unknown(Node* ctl,
589 Node* obj, // containing obj 606 Node* obj, // containing obj
590 Node* adr, // actual adress to store val at 607 Node* adr, // actual adress to store val at
591 const TypePtr* adr_type, 608 const TypePtr* adr_type,
592 Node* val, 609 Node* val,
593 BasicType bt); 610 BasicType bt,
611 MemNode::MemOrd mo);
594 612
595 // For the few case where the barriers need special help 613 // For the few case where the barriers need special help
596 void pre_barrier(bool do_load, Node* ctl, 614 void pre_barrier(bool do_load, Node* ctl,
597 Node* obj, Node* adr, uint adr_idx, Node* val, const TypeOopPtr* val_type, 615 Node* obj, Node* adr, uint adr_idx, Node* val, const TypeOopPtr* val_type,
598 Node* pre_val, 616 Node* pre_val,