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
|
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 Node* Identity(PhaseGVN* phase);
331 virtual const Type* Value(PhaseGVN* phase) const;
332 virtual int Opcode() const;
333 virtual uint ideal_reg() const { return Op_RegP; }
334
335 private:
336 virtual bool depends_only_on_test_impl() const { return !type()->isa_rawptr() && ConstraintCastNode::depends_only_on_test_impl(); }
337 virtual Node* pin_node_under_control_impl() const;
338 };
339
340
341 //------------------------------CastX2PNode-------------------------------------
342 // convert a machine-pointer-sized integer to a raw pointer
343 class CastX2PNode : public Node {
344 public:
345 CastX2PNode( Node *n ) : Node(nullptr, n) {}
346 virtual int Opcode() const;
347 virtual const Type* Value(PhaseGVN* phase) const;
348 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
349 virtual Node* Identity(PhaseGVN* phase);
350 virtual uint ideal_reg() const { return Op_RegP; }
351 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
352 };
353
354 // Cast an integer to a narrow oop
355 class CastI2NNode : public TypeNode {
356 public:
357 CastI2NNode(Node* ctrl, Node* n, const Type* t) : TypeNode(t, 2) {
358 init_req(0, ctrl);
359 init_req(1, n);
360 }
361 virtual int Opcode() const;
362 virtual uint ideal_reg() const { return Op_RegN; }
363
364 private:
365 virtual bool depends_only_on_test_impl() const { return false; }
366 };
367
368 //------------------------------CastP2XNode-------------------------------------
369 // Used in both 32-bit and 64-bit land.
370 // Used for card-marks and unsafe pointer math.
371 class CastP2XNode : public Node {
372 public:
373 CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {}
374 virtual int Opcode() const;
375 virtual const Type* Value(PhaseGVN* phase) const;
376 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
377 virtual Node* Identity(PhaseGVN* phase);
378 virtual uint ideal_reg() const { return Op_RegX; }
379 virtual const Type *bottom_type() const { return TypeX_X; }
380
381 private:
382 // Return false to keep node from moving away from an associated card mark.
383 virtual bool depends_only_on_test_impl() const { return false; }
384 };
385
386 #endif // SHARE_OPTO_CASTNODE_HPP
|