187 188 // Do not match memory edge 189 virtual uint match_edge(uint idx) const; 190 191 // Map a load opcode to its corresponding store opcode. 192 virtual int store_Opcode() const = 0; 193 194 // Check if the load's memory input is a Phi node with the same control. 195 bool is_instance_field_load_with_local_phi(Node* ctrl); 196 197 #ifndef PRODUCT 198 virtual void dump_spec(outputStream *st) const; 199 #endif 200 #ifdef ASSERT 201 // Helper function to allow a raw load without control edge for some cases 202 static bool is_immutable_value(Node* adr); 203 #endif 204 protected: 205 const Type* load_array_final_field(const TypeKlassPtr *tkls, 206 ciKlass* klass) const; 207 }; 208 209 //------------------------------LoadBNode-------------------------------------- 210 // Load a byte (8bits signed) from memory 211 class LoadBNode : public LoadNode { 212 public: 213 LoadBNode( Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti = TypeInt::BYTE ) 214 : LoadNode(c,mem,adr,at,ti) {} 215 virtual int Opcode() const; 216 virtual uint ideal_reg() const { return Op_RegI; } 217 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 218 virtual const Type *Value(PhaseTransform *phase) const; 219 virtual int store_Opcode() const { return Op_StoreB; } 220 virtual BasicType memory_type() const { return T_BYTE; } 221 }; 222 223 //------------------------------LoadUBNode------------------------------------- 224 // Load a unsigned byte (8bits unsigned) from memory 225 class LoadUBNode : public LoadNode { 226 public: 353 354 //------------------------------LoadD_unalignedNode---------------------------- 355 // Load a double from unaligned memory 356 class LoadD_unalignedNode : public LoadDNode { 357 public: 358 LoadD_unalignedNode( Node *c, Node *mem, Node *adr, const TypePtr* at ) 359 : LoadDNode(c,mem,adr,at) {} 360 virtual int Opcode() const; 361 }; 362 363 //------------------------------LoadPNode-------------------------------------- 364 // Load a pointer from memory (either object or array) 365 class LoadPNode : public LoadNode { 366 public: 367 LoadPNode( Node *c, Node *mem, Node *adr, const TypePtr *at, const TypePtr* t ) 368 : LoadNode(c,mem,adr,at,t) {} 369 virtual int Opcode() const; 370 virtual uint ideal_reg() const { return Op_RegP; } 371 virtual int store_Opcode() const { return Op_StoreP; } 372 virtual BasicType memory_type() const { return T_ADDRESS; } 373 // depends_only_on_test is almost always true, and needs to be almost always 374 // true to enable key hoisting & commoning optimizations. However, for the 375 // special case of RawPtr loads from TLS top & end, the control edge carries 376 // the dependence preventing hoisting past a Safepoint instead of the memory 377 // edge. (An unfortunate consequence of having Safepoints not set Raw 378 // Memory; itself an unfortunate consequence of having Nodes which produce 379 // results (new raw memory state) inside of loops preventing all manner of 380 // other optimizations). Basically, it's ugly but so is the alternative. 381 // See comment in macro.cpp, around line 125 expand_allocate_common(). 382 virtual bool depends_only_on_test() const { return adr_type() != TypeRawPtr::BOTTOM; } 383 }; 384 385 386 //------------------------------LoadNNode-------------------------------------- 387 // Load a narrow oop from memory (either object or array) 388 class LoadNNode : public LoadNode { 389 public: 390 LoadNNode( Node *c, Node *mem, Node *adr, const TypePtr *at, const Type* t ) 391 : LoadNode(c,mem,adr,at,t) {} 392 virtual int Opcode() const; 393 virtual uint ideal_reg() const { return Op_RegN; } 394 virtual int store_Opcode() const { return Op_StoreN; } 395 virtual BasicType memory_type() const { return T_NARROWOOP; } 396 // depends_only_on_test is almost always true, and needs to be almost always 397 // true to enable key hoisting & commoning optimizations. However, for the 398 // special case of RawPtr loads from TLS top & end, the control edge carries 399 // the dependence preventing hoisting past a Safepoint instead of the memory 400 // edge. (An unfortunate consequence of having Safepoints not set Raw 401 // Memory; itself an unfortunate consequence of having Nodes which produce 402 // results (new raw memory state) inside of loops preventing all manner of 403 // other optimizations). Basically, it's ugly but so is the alternative. 404 // See comment in macro.cpp, around line 125 expand_allocate_common(). 405 virtual bool depends_only_on_test() const { return adr_type() != TypeRawPtr::BOTTOM; } 406 }; 407 408 //------------------------------LoadKlassNode---------------------------------- 409 // Load a Klass from an object 410 class LoadKlassNode : public LoadPNode { 411 public: 412 LoadKlassNode( Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeKlassPtr *tk ) 413 : LoadPNode(c,mem,adr,at,tk) {} 414 virtual int Opcode() const; 415 virtual const Type *Value( PhaseTransform *phase ) const; 416 virtual Node *Identity( PhaseTransform *phase ); 417 virtual bool depends_only_on_test() const { return true; } 418 419 // Polymorphic factory method: 420 static Node* make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, 421 const TypeKlassPtr *tk = TypeKlassPtr::OBJECT ); 422 }; 423 424 //------------------------------LoadNKlassNode--------------------------------- 425 // Load a narrow Klass from an object. | 187 188 // Do not match memory edge 189 virtual uint match_edge(uint idx) const; 190 191 // Map a load opcode to its corresponding store opcode. 192 virtual int store_Opcode() const = 0; 193 194 // Check if the load's memory input is a Phi node with the same control. 195 bool is_instance_field_load_with_local_phi(Node* ctrl); 196 197 #ifndef PRODUCT 198 virtual void dump_spec(outputStream *st) const; 199 #endif 200 #ifdef ASSERT 201 // Helper function to allow a raw load without control edge for some cases 202 static bool is_immutable_value(Node* adr); 203 #endif 204 protected: 205 const Type* load_array_final_field(const TypeKlassPtr *tkls, 206 ciKlass* klass) const; 207 // depends_only_on_test is almost always true, and needs to be almost always 208 // true to enable key hoisting & commoning optimizations. However, for the 209 // special case of RawPtr loads from TLS top & end, and other loads performed by 210 // GC barriers, the control edge carries the dependence preventing hoisting past 211 // a Safepoint instead of the memory edge. (An unfortunate consequence of having 212 // Safepoints not set Raw Memory; itself an unfortunate consequence of having Nodes 213 // which produce results (new raw memory state) inside of loops preventing all 214 // manner of other optimizations). Basically, it's ugly but so is the alternative. 215 // See comment in macro.cpp, around line 125 expand_allocate_common(). 216 virtual bool depends_only_on_test() const { return adr_type() != TypeRawPtr::BOTTOM; } 217 218 }; 219 220 //------------------------------LoadBNode-------------------------------------- 221 // Load a byte (8bits signed) from memory 222 class LoadBNode : public LoadNode { 223 public: 224 LoadBNode( Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti = TypeInt::BYTE ) 225 : LoadNode(c,mem,adr,at,ti) {} 226 virtual int Opcode() const; 227 virtual uint ideal_reg() const { return Op_RegI; } 228 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 229 virtual const Type *Value(PhaseTransform *phase) const; 230 virtual int store_Opcode() const { return Op_StoreB; } 231 virtual BasicType memory_type() const { return T_BYTE; } 232 }; 233 234 //------------------------------LoadUBNode------------------------------------- 235 // Load a unsigned byte (8bits unsigned) from memory 236 class LoadUBNode : public LoadNode { 237 public: 364 365 //------------------------------LoadD_unalignedNode---------------------------- 366 // Load a double from unaligned memory 367 class LoadD_unalignedNode : public LoadDNode { 368 public: 369 LoadD_unalignedNode( Node *c, Node *mem, Node *adr, const TypePtr* at ) 370 : LoadDNode(c,mem,adr,at) {} 371 virtual int Opcode() const; 372 }; 373 374 //------------------------------LoadPNode-------------------------------------- 375 // Load a pointer from memory (either object or array) 376 class LoadPNode : public LoadNode { 377 public: 378 LoadPNode( Node *c, Node *mem, Node *adr, const TypePtr *at, const TypePtr* t ) 379 : LoadNode(c,mem,adr,at,t) {} 380 virtual int Opcode() const; 381 virtual uint ideal_reg() const { return Op_RegP; } 382 virtual int store_Opcode() const { return Op_StoreP; } 383 virtual BasicType memory_type() const { return T_ADDRESS; } 384 }; 385 386 387 //------------------------------LoadNNode-------------------------------------- 388 // Load a narrow oop from memory (either object or array) 389 class LoadNNode : public LoadNode { 390 public: 391 LoadNNode( Node *c, Node *mem, Node *adr, const TypePtr *at, const Type* t ) 392 : LoadNode(c,mem,adr,at,t) {} 393 virtual int Opcode() const; 394 virtual uint ideal_reg() const { return Op_RegN; } 395 virtual int store_Opcode() const { return Op_StoreN; } 396 virtual BasicType memory_type() const { return T_NARROWOOP; } 397 }; 398 399 //------------------------------LoadKlassNode---------------------------------- 400 // Load a Klass from an object 401 class LoadKlassNode : public LoadPNode { 402 public: 403 LoadKlassNode( Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeKlassPtr *tk ) 404 : LoadPNode(c,mem,adr,at,tk) {} 405 virtual int Opcode() const; 406 virtual const Type *Value( PhaseTransform *phase ) const; 407 virtual Node *Identity( PhaseTransform *phase ); 408 virtual bool depends_only_on_test() const { return true; } 409 410 // Polymorphic factory method: 411 static Node* make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, 412 const TypeKlassPtr *tk = TypeKlassPtr::OBJECT ); 413 }; 414 415 //------------------------------LoadNKlassNode--------------------------------- 416 // Load a narrow Klass from an object. |