517 static Node* make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at, 518 const TypeKlassPtr* tk = TypeKlassPtr::OBJECT); 519 }; 520 521 //------------------------------LoadNKlassNode--------------------------------- 522 // Load a narrow Klass from an object. 523 class LoadNKlassNode : public LoadNNode { 524 public: 525 LoadNKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeNarrowKlass *tk, MemOrd mo) 526 : LoadNNode(c, mem, adr, at, tk, mo) {} 527 virtual int Opcode() const; 528 virtual uint ideal_reg() const { return Op_RegN; } 529 virtual int store_Opcode() const { return Op_StoreNKlass; } 530 virtual BasicType memory_type() const { return T_NARROWKLASS; } 531 532 virtual const Type* Value(PhaseGVN* phase) const; 533 virtual Node* Identity(PhaseGVN* phase); 534 virtual bool depends_only_on_test() const { return true; } 535 }; 536 537 // Retrieve the null free property from an array klass. This is 538 // treated a bit like a field that would be read from the klass 539 // structure at runtime except, the implementation encodes the 540 // property as a bit in the klass header field of the array. This 541 // implementation detail is hidden under this node so it doesn't make 542 // a difference for high level optimizations. At final graph reshaping 543 // time, this node is turned into the actual logical operations that 544 // extract the property from the klass pointer. For this to work 545 // correctly, GetNullFreePropertyNode must take a LoadKlass/LoadNKlass 546 // input. The Ideal transformation splits the GetNullFreePropertyNode 547 // through phis, Value returns a constant if the node's input is a 548 // constant. These 2 should guarantee GetNullFreePropertyNode does 549 // indeed have a LoadKlass/LoadNKlass input at final graph reshaping 550 // time. 551 class GetNullFreePropertyNode : public Node { 552 public: 553 GetNullFreePropertyNode(Node* klass) : Node(NULL, klass) {} 554 virtual int Opcode() const; 555 virtual const Type* Value(PhaseGVN* phase) const; 556 virtual Node* Ideal(PhaseGVN *phase, bool can_reshape); 557 virtual const Type* bottom_type() const { 558 if (in(1)->bottom_type()->isa_klassptr()) { 559 return TypeLong::LONG; 560 } 561 return TypeInt::INT; 562 } 563 }; 564 565 //------------------------------StoreNode-------------------------------------- 566 // Store value; requires Store, Address and Value 567 class StoreNode : public MemNode { 568 private: 569 // On platforms with weak memory ordering (e.g., PPC, Ia64) we distinguish 570 // stores that can be reordered, and such requiring release semantics to 571 // adhere to the Java specification. The required behaviour is stored in 572 // this field. 573 const MemOrd _mo; 574 // Needed for proper cloning. 575 virtual uint size_of() const { return sizeof(*this); } 576 protected: 577 virtual bool cmp( const Node &n ) const; 578 virtual bool depends_only_on_test() const { return false; } 579 580 Node *Ideal_masked_input (PhaseGVN *phase, uint mask); 581 Node *Ideal_sign_extended_input(PhaseGVN *phase, int num_bits); 582 583 public: 584 // We must ensure that stores of object references will be visible | 517 static Node* make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at, 518 const TypeKlassPtr* tk = TypeKlassPtr::OBJECT); 519 }; 520 521 //------------------------------LoadNKlassNode--------------------------------- 522 // Load a narrow Klass from an object. 523 class LoadNKlassNode : public LoadNNode { 524 public: 525 LoadNKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeNarrowKlass *tk, MemOrd mo) 526 : LoadNNode(c, mem, adr, at, tk, mo) {} 527 virtual int Opcode() const; 528 virtual uint ideal_reg() const { return Op_RegN; } 529 virtual int store_Opcode() const { return Op_StoreNKlass; } 530 virtual BasicType memory_type() const { return T_NARROWKLASS; } 531 532 virtual const Type* Value(PhaseGVN* phase) const; 533 virtual Node* Identity(PhaseGVN* phase); 534 virtual bool depends_only_on_test() const { return true; } 535 }; 536 537 // Retrieve the null free/flattened property from an array klass. This 538 // is treated a bit like a field that would be read from the klass 539 // structure at runtime except, the implementation encodes the 540 // property as a bit in the klass header field of the array. This 541 // implementation detail is hidden under this node so it doesn't make 542 // a difference for high level optimizations. At final graph reshaping 543 // time, this node is turned into the actual logical operations that 544 // extract the property from the klass pointer. For this to work 545 // correctly, GeStoragePropertyNodes must take a LoadKlass/LoadNKlass 546 // input. The Ideal transformation splits the GetStoragePropertyNode 547 // through phis, Value returns a constant if the node's input is a 548 // constant. These 2 should guarantee GetStoragePropertyNode does 549 // indeed have a LoadKlass/LoadNKlass input at final graph reshaping 550 // time. 551 class GetStoragePropertyNode : public Node { 552 protected: 553 GetStoragePropertyNode(Node* klass) : Node(NULL, klass) {} 554 public: 555 virtual const Type* Value(PhaseGVN* phase) const; 556 virtual Node* Ideal(PhaseGVN *phase, bool can_reshape); 557 virtual const Type* bottom_type() const { 558 if (in(1)->bottom_type()->isa_klassptr()) { 559 return TypeLong::LONG; 560 } 561 return TypeInt::INT; 562 } 563 }; 564 565 566 class GetNullFreePropertyNode : public GetStoragePropertyNode { 567 public: 568 GetNullFreePropertyNode(Node* klass) : GetStoragePropertyNode(klass) {} 569 virtual int Opcode() const; 570 }; 571 572 class GetFlattenedPropertyNode : public GetStoragePropertyNode { 573 public: 574 GetFlattenedPropertyNode(Node* klass) : GetStoragePropertyNode(klass) {} 575 virtual int Opcode() const; 576 }; 577 578 //------------------------------StoreNode-------------------------------------- 579 // Store value; requires Store, Address and Value 580 class StoreNode : public MemNode { 581 private: 582 // On platforms with weak memory ordering (e.g., PPC, Ia64) we distinguish 583 // stores that can be reordered, and such requiring release semantics to 584 // adhere to the Java specification. The required behaviour is stored in 585 // this field. 586 const MemOrd _mo; 587 // Needed for proper cloning. 588 virtual uint size_of() const { return sizeof(*this); } 589 protected: 590 virtual bool cmp( const Node &n ) const; 591 virtual bool depends_only_on_test() const { return false; } 592 593 Node *Ideal_masked_input (PhaseGVN *phase, uint mask); 594 Node *Ideal_sign_extended_input(PhaseGVN *phase, int num_bits); 595 596 public: 597 // We must ensure that stores of object references will be visible |