src/share/vm/opto/machnode.hpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/opto/machnode.hpp Fri Nov 12 05:56:58 2010
--- new/src/share/vm/opto/machnode.hpp Fri Nov 12 05:56:58 2010
*** 220,232 ****
--- 220,229 ----
virtual int compute_padding(int current_offset) const { return 0; }
// Return number of relocatable values contained in this instruction
virtual int reloc() const { return 0; }
// Return number of words used for double constants in this instruction
virtual int const_size() const { return 0; }
// Hash and compare over operands. Used to do GVN on machine Nodes.
virtual uint hash() const;
virtual uint cmp( const Node &n ) const;
// Expand method for MachNode, replaces nodes representing pseudo
*** 337,346 ****
--- 334,474 ----
virtual const char *Name() const { return "Breakpoint"; }
virtual void format( PhaseRegAlloc *, outputStream *st ) const;
#endif
};
+ //------------------------------MachConstantBaseNode--------------------------
+ // Machine node that represents the base address of the constant
+ // table.
+ class MachConstantBaseNode : public MachIdealNode {
+ public:
+ class Constant {
+ private:
+ BasicType _type;
+ jvalue _value;
+ int _offset; // offset of this constant (in bytes) relative to the constant table base.
+ bool _can_be_reused; // true (default) if the value can be shared with other users.
+
+ public:
+ Constant() : _type(T_ILLEGAL), _offset(-1), _can_be_reused(true) { _value.l = 0; }
+ Constant(BasicType type, jvalue value, bool can_be_reused = true) :
+ _type(type),
+ _value(value),
+ _offset(-1),
+ _can_be_reused(can_be_reused)
+ {}
+
+ bool operator==(const Constant& other);
+
+ BasicType type() const { return _type; }
+
+ jlong get_jlong() const { return _value.j; }
+ jfloat get_jfloat() const { return _value.f; }
+ jdouble get_jdouble() const { return _value.d; }
+ jobject get_jobject() const { return _value.l; }
+
+ int offset() const { return _offset; }
+ void set_offset(int offset) { _offset = offset; }
+
+ bool can_be_reused() const { return _can_be_reused; }
+ };
+
+ private:
+ GrowableArray<Constant> _constants; // Constant table of this node.
+ int _table_base_offset; // Offset of the table base that gets added to the constant offsets.
+ static const RegMask& _out_RegMask; // We need the out_RegMask statically in MachConstantNode::in_RegMask().
+
+ protected:
+ void set_table_base_offset(int x) { _table_base_offset = x; }
+ // MachConstantBaseNode::emit is const but we need to modify the object.
+ void set_table_base_offset(int x) const { ((MachConstantBaseNode*) this)->set_table_base_offset(x); }
+
+ void emit_constant_table(CodeBuffer& cb);
+ void emit_constant_table(CodeBuffer& cb) const { ((MachConstantBaseNode*) this)->emit_constant_table(cb); }
+
+ // Returns the offset of the last entry (the top) of the constant table.
+ int top_constant_offset() const { assert(_constants.top().offset() != -1, "constant not yet bound"); return _constants.top().offset(); }
+
+ public:
+ MachConstantBaseNode() :
+ MachIdealNode(),
+ _table_base_offset(-1) // We can use -1 here since the constant table is always bigger than 2 bytes (-(size / 2), see MachConstantBaseNode::emit).
+ {
+ init_class_id(Class_MachConstantBase);
+ add_req(NULL);
+ }
+ virtual const class Type* bottom_type() const { return TypeRawPtr::NOTNULL; }
+ virtual uint ideal_reg() const { return Op_RegP; }
+ virtual uint oper_input_base() const { return 1; }
+
+ virtual void emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const;
+ virtual uint size(PhaseRegAlloc* ra_) const;
+ virtual bool pinned() const { return true; }
+
+ static const RegMask& static_out_RegMask() { return _out_RegMask; }
+ virtual const RegMask& out_RegMask() const { return static_out_RegMask(); }
+
+ #ifndef PRODUCT
+ virtual const char* Name() const { return "MachConstantBaseNode"; }
+ virtual void format(PhaseRegAlloc*, outputStream* st) const;
+ #endif
+
+ int table_base_offset() const { assert(_table_base_offset != -1, "table base offset not yet set"); return _table_base_offset; }
+
+ int add_constant(Constant& con);
+ int calculate_constant_table_size();
+ int find_constant_offset(Constant& con) const;
+ };
+
+ //------------------------------MachConstantNode-------------------------------
+ // Machine node that holds a constant which is stored in the constant
+ // table.
+ class MachConstantNode : public MachNode {
+ private:
+ MachConstantBaseNode::Constant _constant;
+
+ public:
+ MachConstantNode() : MachNode() {
+ init_class_id(Class_MachConstant);
+ }
+
+ virtual void eval_constant() {
+ #ifdef ASSERT
+ tty->print("missing MachConstantNode eval_constant function: ");
+ dump();
+ #endif
+ ShouldNotCallThis();
+ }
+
+ virtual const RegMask &in_RegMask(uint idx) const {
+ if (idx == mach_constant_base_node_input())
+ return MachConstantBaseNode::static_out_RegMask();
+ return MachNode::in_RegMask(idx);
+ }
+
+ // Input edge of MachConstantBaseNode.
+ uint mach_constant_base_node_input() const { return req() - 1; }
+ int constant_offset();
+ int constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); }
+
+ protected:
+ void add_to_constant_table(BasicType type, jvalue value);
+ void add_to_constant_table(MachOper* oper);
+ void add_to_constant_table(jfloat f) {
+ jvalue value; value.f = f;
+ add_to_constant_table(T_FLOAT, value);
+ }
+ void add_to_constant_table(jdouble d) {
+ jvalue value; value.d = d;
+ add_to_constant_table(T_DOUBLE, value);
+ }
+
+ // Jump table
+ void allocate_jump_table_in_constant_table();
+ void fill_jump_table_in_constant_table(CodeBuffer& cb, GrowableArray<Label*> labels) const;
+ };
+
//------------------------------MachUEPNode-----------------------------------
// Machine Unvalidated Entry Point Node
class MachUEPNode : public MachIdealNode {
public:
MachUEPNode( ) {}
src/share/vm/opto/machnode.hpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File