Skip to content

Commit 9927ec0

Browse files
kuaiweiwenshao
authored andcommitted
8356328: Some C2 IR nodes miss size_of() function
Reviewed-by: thartmann, chagedorn
1 parent 6c42856 commit 9927ec0

4 files changed

Lines changed: 24 additions & 8 deletions

File tree

src/hotspot/share/opto/intrinsicnode.hpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ class VectorizedHashCodeNode: public Node {
184184
//------------------------------EncodeISOArray--------------------------------
185185
// encode char[] to byte[] in ISO_8859_1 or ASCII
186186
class EncodeISOArrayNode: public Node {
187-
bool ascii;
187+
bool _ascii;
188188
public:
189189
EncodeISOArrayNode(Node* control, Node* arymem, Node* s1, Node* s2, Node* c, bool ascii)
190-
: Node(control, arymem, s1, s2, c), ascii(ascii) {}
190+
: Node(control, arymem, s1, s2, c), _ascii(ascii) {}
191191

192-
bool is_ascii() { return ascii; }
192+
bool is_ascii() { return _ascii; }
193193
virtual int Opcode() const;
194194
virtual bool depends_only_on_test() const { return false; }
195195
virtual const Type* bottom_type() const { return TypeInt::INT; }
@@ -198,6 +198,11 @@ class EncodeISOArrayNode: public Node {
198198
virtual uint ideal_reg() const { return Op_RegI; }
199199
virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
200200
virtual const Type* Value(PhaseGVN* phase) const;
201+
virtual uint size_of() const { return sizeof(EncodeISOArrayNode); }
202+
virtual uint hash() const { return Node::hash() + _ascii; }
203+
virtual bool cmp(const Node& n) const {
204+
return Node::cmp(n) && _ascii == ((EncodeISOArrayNode&)n).is_ascii();
205+
}
201206
};
202207

203208
//-------------------------------DigitNode----------------------------------------

src/hotspot/share/opto/machnode.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ class MachConstantNode : public MachTypeNode {
499499
int constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); }
500500
// Unchecked version to avoid assertions in debug output.
501501
int constant_offset_unchecked() const;
502+
virtual uint size_of() const { return sizeof(MachConstantNode); }
502503
};
503504

504505
//------------------------------MachUEPNode-----------------------------------
@@ -533,17 +534,15 @@ class MachPrologNode : public MachIdealNode {
533534
//------------------------------MachEpilogNode--------------------------------
534535
// Machine function Epilog Node
535536
class MachEpilogNode : public MachIdealNode {
537+
private:
538+
bool _do_polling;
536539
public:
537540
MachEpilogNode(bool do_poll = false) : _do_polling(do_poll) {}
538541
virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
539542
virtual uint size(PhaseRegAlloc *ra_) const;
540543
virtual int reloc() const;
541544
virtual const Pipeline *pipeline() const;
542-
543-
private:
544-
bool _do_polling;
545-
546-
public:
545+
virtual uint size_of() const { return sizeof(MachEpilogNode); }
547546
bool do_polling() const { return _do_polling; }
548547

549548
#ifndef PRODUCT
@@ -567,6 +566,7 @@ class MachNopNode : public MachIdealNode {
567566

568567
virtual int ideal_Opcode() const { return Op_Con; } // bogus; see output.cpp
569568
virtual const Pipeline *pipeline() const;
569+
virtual uint size_of() const { return sizeof(MachNopNode); }
570570
#ifndef PRODUCT
571571
virtual const char *Name() const { return "Nop"; }
572572
virtual void format( PhaseRegAlloc *, outputStream *st ) const;
@@ -794,6 +794,7 @@ class MachJumpNode : public MachConstantNode {
794794
MachJumpNode() : MachConstantNode() {
795795
init_class_id(Class_MachJump);
796796
}
797+
virtual uint size_of() const { return sizeof(MachJumpNode); }
797798
};
798799

799800
//------------------------------MachGotoNode-----------------------------------
@@ -892,6 +893,7 @@ class MachSafePointNode : public MachReturnNode {
892893
assert(verify_jvms(jvms), "jvms must match");
893894
set_req(_jvmadj + jvms->monoff() + idx, c);
894895
}
896+
virtual uint size_of() const { return sizeof(MachSafePointNode); }
895897
};
896898

897899
//------------------------------MachCallNode----------------------------------
@@ -1006,6 +1008,7 @@ class MachCallDynamicJavaNode : public MachCallJavaNode {
10061008
#ifndef PRODUCT
10071009
virtual void dump_spec(outputStream *st) const;
10081010
#endif
1011+
virtual uint size_of() const { return sizeof(MachCallDynamicJavaNode); }
10091012
};
10101013

10111014
//------------------------------MachCallRuntimeNode----------------------------
@@ -1039,6 +1042,7 @@ class MachHaltNode : public MachReturnNode {
10391042
bool _reachable;
10401043
const char* _halt_reason;
10411044
virtual JVMState* jvms() const;
1045+
virtual uint size_of() const { return sizeof(MachHaltNode); }
10421046
bool is_reachable() const {
10431047
return _reachable;
10441048
}

src/hotspot/share/opto/memnode.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,11 @@ class ClearArrayNode: public Node {
10891089
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
10901090
virtual uint match_edge(uint idx) const;
10911091
bool is_large() const { return _is_large; }
1092+
virtual uint size_of() const { return sizeof(ClearArrayNode); }
1093+
virtual uint hash() const { return Node::hash() + _is_large; }
1094+
virtual bool cmp(const Node& n) const {
1095+
return Node::cmp(n) && _is_large == ((ClearArrayNode&)n).is_large();
1096+
}
10921097

10931098
// Clear the given area of an object or array.
10941099
// The start offset must always be aligned mod BytesPerInt.

src/hotspot/share/opto/opaquenode.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class OpaqueMultiversioningNode : public Opaque1Node {
124124

125125
void mark_useless(PhaseIterGVN& igvn);
126126
NOT_PRODUCT(virtual void dump_spec(outputStream* st) const;)
127+
virtual uint size_of() const { return sizeof(OpaqueMultiversioningNode); }
127128
};
128129

129130
// 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 {
267268
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
268269
virtual Node* Identity(PhaseGVN* phase);
269270
virtual const Type *bottom_type() const { return TypeInt::BOOL; }
271+
virtual uint size_of() const { return sizeof(ProfileBooleanNode); }
270272
};
271273

272274
#endif // SHARE_OPTO_OPAQUENODE_HPP

0 commit comments

Comments
 (0)