From 9927ec0b91775db342b2bbc1937253325c367a19 Mon Sep 17 00:00:00 2001 From: Kuai Wei Date: Sun, 18 May 2025 23:28:01 +0000 Subject: [PATCH] 8356328: Some C2 IR nodes miss size_of() function Reviewed-by: thartmann, chagedorn --- src/hotspot/share/opto/intrinsicnode.hpp | 11 ++++++++--- src/hotspot/share/opto/machnode.hpp | 14 +++++++++----- src/hotspot/share/opto/memnode.hpp | 5 +++++ src/hotspot/share/opto/opaquenode.hpp | 2 ++ 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/hotspot/share/opto/intrinsicnode.hpp b/src/hotspot/share/opto/intrinsicnode.hpp index bfb200b5e96..3c204f88bc6 100644 --- a/src/hotspot/share/opto/intrinsicnode.hpp +++ b/src/hotspot/share/opto/intrinsicnode.hpp @@ -184,12 +184,12 @@ class VectorizedHashCodeNode: public Node { //------------------------------EncodeISOArray-------------------------------- // encode char[] to byte[] in ISO_8859_1 or ASCII class EncodeISOArrayNode: public Node { - bool ascii; + bool _ascii; public: EncodeISOArrayNode(Node* control, Node* arymem, Node* s1, Node* s2, Node* c, bool ascii) - : Node(control, arymem, s1, s2, c), ascii(ascii) {} + : Node(control, arymem, s1, s2, c), _ascii(ascii) {} - bool is_ascii() { return ascii; } + bool is_ascii() { return _ascii; } virtual int Opcode() const; virtual bool depends_only_on_test() const { return false; } virtual const Type* bottom_type() const { return TypeInt::INT; } @@ -198,6 +198,11 @@ class EncodeISOArrayNode: public Node { virtual uint ideal_reg() const { return Op_RegI; } virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); virtual const Type* Value(PhaseGVN* phase) const; + virtual uint size_of() const { return sizeof(EncodeISOArrayNode); } + virtual uint hash() const { return Node::hash() + _ascii; } + virtual bool cmp(const Node& n) const { + return Node::cmp(n) && _ascii == ((EncodeISOArrayNode&)n).is_ascii(); + } }; //-------------------------------DigitNode---------------------------------------- diff --git a/src/hotspot/share/opto/machnode.hpp b/src/hotspot/share/opto/machnode.hpp index ac60e7b7312..5fd262d54e1 100644 --- a/src/hotspot/share/opto/machnode.hpp +++ b/src/hotspot/share/opto/machnode.hpp @@ -499,6 +499,7 @@ public: int constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); } // Unchecked version to avoid assertions in debug output. int constant_offset_unchecked() const; + virtual uint size_of() const { return sizeof(MachConstantNode); } }; //------------------------------MachUEPNode----------------------------------- @@ -533,17 +534,15 @@ public: //------------------------------MachEpilogNode-------------------------------- // Machine function Epilog Node class MachEpilogNode : public MachIdealNode { +private: + bool _do_polling; public: MachEpilogNode(bool do_poll = false) : _do_polling(do_poll) {} virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const; virtual uint size(PhaseRegAlloc *ra_) const; virtual int reloc() const; virtual const Pipeline *pipeline() const; - -private: - bool _do_polling; - -public: + virtual uint size_of() const { return sizeof(MachEpilogNode); } bool do_polling() const { return _do_polling; } #ifndef PRODUCT @@ -567,6 +566,7 @@ public: virtual int ideal_Opcode() const { return Op_Con; } // bogus; see output.cpp virtual const Pipeline *pipeline() const; + virtual uint size_of() const { return sizeof(MachNopNode); } #ifndef PRODUCT virtual const char *Name() const { return "Nop"; } virtual void format( PhaseRegAlloc *, outputStream *st ) const; @@ -794,6 +794,7 @@ public: MachJumpNode() : MachConstantNode() { init_class_id(Class_MachJump); } + virtual uint size_of() const { return sizeof(MachJumpNode); } }; //------------------------------MachGotoNode----------------------------------- @@ -892,6 +893,7 @@ public: assert(verify_jvms(jvms), "jvms must match"); set_req(_jvmadj + jvms->monoff() + idx, c); } + virtual uint size_of() const { return sizeof(MachSafePointNode); } }; //------------------------------MachCallNode---------------------------------- @@ -1006,6 +1008,7 @@ public: #ifndef PRODUCT virtual void dump_spec(outputStream *st) const; #endif + virtual uint size_of() const { return sizeof(MachCallDynamicJavaNode); } }; //------------------------------MachCallRuntimeNode---------------------------- @@ -1039,6 +1042,7 @@ public: bool _reachable; const char* _halt_reason; virtual JVMState* jvms() const; + virtual uint size_of() const { return sizeof(MachHaltNode); } bool is_reachable() const { return _reachable; } diff --git a/src/hotspot/share/opto/memnode.hpp b/src/hotspot/share/opto/memnode.hpp index a751022f752..810a9fe9445 100644 --- a/src/hotspot/share/opto/memnode.hpp +++ b/src/hotspot/share/opto/memnode.hpp @@ -1089,6 +1089,11 @@ public: virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual uint match_edge(uint idx) const; bool is_large() const { return _is_large; } + virtual uint size_of() const { return sizeof(ClearArrayNode); } + virtual uint hash() const { return Node::hash() + _is_large; } + virtual bool cmp(const Node& n) const { + return Node::cmp(n) && _is_large == ((ClearArrayNode&)n).is_large(); + } // Clear the given area of an object or array. // The start offset must always be aligned mod BytesPerInt. diff --git a/src/hotspot/share/opto/opaquenode.hpp b/src/hotspot/share/opto/opaquenode.hpp index d3cbbcfafbe..9edfe2a7258 100644 --- a/src/hotspot/share/opto/opaquenode.hpp +++ b/src/hotspot/share/opto/opaquenode.hpp @@ -124,6 +124,7 @@ public: void mark_useless(PhaseIterGVN& igvn); NOT_PRODUCT(virtual void dump_spec(outputStream* st) const;) + virtual uint size_of() const { return sizeof(OpaqueMultiversioningNode); } }; // This node is used in the context of intrinsics. We sometimes implicitly know that an object is non-null even though @@ -267,6 +268,7 @@ class ProfileBooleanNode : public Node { virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual Node* Identity(PhaseGVN* phase); virtual const Type *bottom_type() const { return TypeInt::BOOL; } + virtual uint size_of() const { return sizeof(ProfileBooleanNode); } }; #endif // SHARE_OPTO_OPAQUENODE_HPP