< prev index next >

src/hotspot/share/opto/castnode.hpp

Print this page

178                                   const TypeTuple* types);
179 
180   Node* optimize_integer_cast_of_add(PhaseGVN* phase, BasicType bt);
181   Node* optimize_integer_cast(PhaseGVN* phase, BasicType bt);
182 
183   bool higher_equal_types(PhaseGVN* phase, const Node* other) const;
184 
185   int extra_types_count() const {
186     return _extra_types == nullptr ? 0 : _extra_types->cnt();
187   }
188 
189   const Type* extra_type_at(int i) const {
190     return _extra_types->field_at(i);
191   }
192 
193 protected:
194   virtual bool depends_only_on_test_impl() const { return _dependency.is_floating(); }
195 
196 private:
197   virtual Node* pin_node_under_control_impl() const;

198 };
199 
200 //------------------------------CastIINode-------------------------------------
201 // cast integer to integer (different range)
202 class CastIINode: public ConstraintCastNode {
203   protected:
204   // Is this node dependent on a range check?
205   const bool _range_check_dependency;
206   virtual bool cmp(const Node &n) const;
207   virtual uint size_of() const;
208 
209   public:
210   CastIINode(Node* ctrl, Node* n, const Type* t, const DependencyType& dependency = DependencyType::FloatingNarrowing, bool range_check_dependency = false, const TypeTuple* types = nullptr)
211     : ConstraintCastNode(ctrl, n, t, dependency, types), _range_check_dependency(range_check_dependency) {
212     assert(ctrl != nullptr, "control must be set");
213     init_class_id(Class_CastII);
214   }
215   virtual int Opcode() const;
216   virtual uint ideal_reg() const { return Op_RegI; }
217   virtual Node* Identity(PhaseGVN* phase);

310     init_class_id(Class_CastPP);
311     verify_type(n->bottom_type(), t);
312   }
313   virtual int Opcode() const;
314   virtual uint ideal_reg() const { return Op_RegP; }
315 
316 private:
317   static void verify_type(const Type* in_type, const Type* out_type);
318 };
319 
320 //------------------------------CheckCastPPNode--------------------------------
321 // for _checkcast, cast pointer to pointer (different type), without JOIN,
322 class CheckCastPPNode: public ConstraintCastNode {
323   public:
324   CheckCastPPNode(Node* ctrl, Node* n, const Type* t, const DependencyType& dependency = DependencyType::FloatingNarrowing, const TypeTuple* types = nullptr)
325     : ConstraintCastNode(ctrl, n, t, dependency, types) {
326     assert(ctrl != nullptr, "control must be set");
327     init_class_id(Class_CheckCastPP);
328   }
329 

330   virtual const Type* Value(PhaseGVN* phase) const;
331   virtual int   Opcode() const;
332   virtual uint  ideal_reg() const { return Op_RegP; }
333 
334 private:
335   virtual bool depends_only_on_test_impl() const { return !type()->isa_rawptr() && ConstraintCastNode::depends_only_on_test_impl(); }
336   virtual Node* pin_node_under_control_impl() const;
337 };
338 
339 
340 //------------------------------CastX2PNode-------------------------------------
341 // convert a machine-pointer-sized integer to a raw pointer
342 class CastX2PNode : public Node {
343   public:
344   CastX2PNode( Node *n ) : Node(nullptr, n) {}
345   virtual int Opcode() const;
346   virtual const Type* Value(PhaseGVN* phase) const;
347   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
348   virtual Node* Identity(PhaseGVN* phase);
349   virtual uint ideal_reg() const { return Op_RegP; }
350   virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
351 };
352 














353 //------------------------------CastP2XNode-------------------------------------
354 // Used in both 32-bit and 64-bit land.
355 // Used for card-marks and unsafe pointer math.
356 class CastP2XNode : public Node {
357   public:
358   CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {}
359   virtual int Opcode() const;
360   virtual const Type* Value(PhaseGVN* phase) const;
361   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
362   virtual Node* Identity(PhaseGVN* phase);
363   virtual uint ideal_reg() const { return Op_RegX; }
364   virtual const Type *bottom_type() const { return TypeX_X; }
365 
366 private:
367   // Return false to keep node from moving away from an associated card mark.
368   virtual bool depends_only_on_test_impl() const { return false; }
369 };
370 
371 
372 
373 #endif // SHARE_OPTO_CASTNODE_HPP

178                                   const TypeTuple* types);
179 
180   Node* optimize_integer_cast_of_add(PhaseGVN* phase, BasicType bt);
181   Node* optimize_integer_cast(PhaseGVN* phase, BasicType bt);
182 
183   bool higher_equal_types(PhaseGVN* phase, const Node* other) const;
184 
185   int extra_types_count() const {
186     return _extra_types == nullptr ? 0 : _extra_types->cnt();
187   }
188 
189   const Type* extra_type_at(int i) const {
190     return _extra_types->field_at(i);
191   }
192 
193 protected:
194   virtual bool depends_only_on_test_impl() const { return _dependency.is_floating(); }
195 
196 private:
197   virtual Node* pin_node_under_control_impl() const;
198   Node* ideal_cast_of_inline_type_node(PhaseGVN* phase);
199 };
200 
201 //------------------------------CastIINode-------------------------------------
202 // cast integer to integer (different range)
203 class CastIINode: public ConstraintCastNode {
204   protected:
205   // Is this node dependent on a range check?
206   const bool _range_check_dependency;
207   virtual bool cmp(const Node &n) const;
208   virtual uint size_of() const;
209 
210   public:
211   CastIINode(Node* ctrl, Node* n, const Type* t, const DependencyType& dependency = DependencyType::FloatingNarrowing, bool range_check_dependency = false, const TypeTuple* types = nullptr)
212     : ConstraintCastNode(ctrl, n, t, dependency, types), _range_check_dependency(range_check_dependency) {
213     assert(ctrl != nullptr, "control must be set");
214     init_class_id(Class_CastII);
215   }
216   virtual int Opcode() const;
217   virtual uint ideal_reg() const { return Op_RegI; }
218   virtual Node* Identity(PhaseGVN* phase);

311     init_class_id(Class_CastPP);
312     verify_type(n->bottom_type(), t);
313   }
314   virtual int Opcode() const;
315   virtual uint ideal_reg() const { return Op_RegP; }
316 
317 private:
318   static void verify_type(const Type* in_type, const Type* out_type);
319 };
320 
321 //------------------------------CheckCastPPNode--------------------------------
322 // for _checkcast, cast pointer to pointer (different type), without JOIN,
323 class CheckCastPPNode: public ConstraintCastNode {
324   public:
325   CheckCastPPNode(Node* ctrl, Node* n, const Type* t, const DependencyType& dependency = DependencyType::FloatingNarrowing, const TypeTuple* types = nullptr)
326     : ConstraintCastNode(ctrl, n, t, dependency, types) {
327     assert(ctrl != nullptr, "control must be set");
328     init_class_id(Class_CheckCastPP);
329   }
330 
331   virtual Node* Identity(PhaseGVN* phase);
332   virtual const Type* Value(PhaseGVN* phase) const;
333   virtual int   Opcode() const;
334   virtual uint  ideal_reg() const { return Op_RegP; }
335 
336 private:
337   virtual bool depends_only_on_test_impl() const { return !type()->isa_rawptr() && ConstraintCastNode::depends_only_on_test_impl(); }
338   virtual Node* pin_node_under_control_impl() const;
339 };
340 
341 
342 //------------------------------CastX2PNode-------------------------------------
343 // convert a machine-pointer-sized integer to a raw pointer
344 class CastX2PNode : public Node {
345   public:
346   CastX2PNode( Node *n ) : Node(nullptr, n) {}
347   virtual int Opcode() const;
348   virtual const Type* Value(PhaseGVN* phase) const;
349   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
350   virtual Node* Identity(PhaseGVN* phase);
351   virtual uint ideal_reg() const { return Op_RegP; }
352   virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
353 };
354 
355 // Cast an integer to a narrow oop
356 class CastI2NNode : public TypeNode {
357   public:
358   CastI2NNode(Node* ctrl, Node* n, const Type* t) : TypeNode(t, 2) {
359     init_req(0, ctrl);
360     init_req(1, n);
361   }
362   virtual int Opcode() const;
363   virtual uint ideal_reg() const { return Op_RegN; }
364 
365 private:
366   virtual bool depends_only_on_test_impl() const { return false; }
367 };
368 
369 //------------------------------CastP2XNode-------------------------------------
370 // Used in both 32-bit and 64-bit land.
371 // Used for card-marks and unsafe pointer math.
372 class CastP2XNode : public Node {
373   public:
374   CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {}
375   virtual int Opcode() const;
376   virtual const Type* Value(PhaseGVN* phase) const;
377   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
378   virtual Node* Identity(PhaseGVN* phase);
379   virtual uint ideal_reg() const { return Op_RegX; }
380   virtual const Type *bottom_type() const { return TypeX_X; }
381 
382 private:
383   // Return false to keep node from moving away from an associated card mark.
384   virtual bool depends_only_on_test_impl() const { return false; }
385 };
386 


387 #endif // SHARE_OPTO_CASTNODE_HPP
< prev index next >