23528
|
1 |
/*
|
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*
|
|
23 |
*/
|
|
24 |
|
|
25 |
#ifndef SHARE_VM_OPTO_NARROWPTRNODE_HPP
|
|
26 |
#define SHARE_VM_OPTO_NARROWPTRNODE_HPP
|
|
27 |
|
|
28 |
#include "opto/node.hpp"
|
|
29 |
#include "opto/opcodes.hpp"
|
|
30 |
|
|
31 |
//------------------------------EncodeNarrowPtr--------------------------------
|
|
32 |
class EncodeNarrowPtrNode : public TypeNode {
|
|
33 |
protected:
|
|
34 |
EncodeNarrowPtrNode(Node* value, const Type* type):
|
|
35 |
TypeNode(type, 2) {
|
|
36 |
init_class_id(Class_EncodeNarrowPtr);
|
|
37 |
init_req(0, NULL);
|
|
38 |
init_req(1, value);
|
|
39 |
}
|
|
40 |
public:
|
|
41 |
virtual uint ideal_reg() const { return Op_RegN; }
|
|
42 |
virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp );
|
|
43 |
};
|
|
44 |
|
|
45 |
//------------------------------EncodeP--------------------------------
|
|
46 |
// Encodes an oop pointers into its compressed form
|
|
47 |
// Takes an extra argument which is the real heap base as a long which
|
|
48 |
// may be useful for code generation in the backend.
|
|
49 |
class EncodePNode : public EncodeNarrowPtrNode {
|
|
50 |
public:
|
|
51 |
EncodePNode(Node* value, const Type* type):
|
|
52 |
EncodeNarrowPtrNode(value, type) {
|
|
53 |
init_class_id(Class_EncodeP);
|
|
54 |
}
|
|
55 |
virtual int Opcode() const;
|
|
56 |
virtual Node *Identity( PhaseTransform *phase );
|
|
57 |
virtual const Type *Value( PhaseTransform *phase ) const;
|
|
58 |
};
|
|
59 |
|
|
60 |
//------------------------------EncodePKlass--------------------------------
|
|
61 |
// Encodes a klass pointer into its compressed form
|
|
62 |
// Takes an extra argument which is the real heap base as a long which
|
|
63 |
// may be useful for code generation in the backend.
|
|
64 |
class EncodePKlassNode : public EncodeNarrowPtrNode {
|
|
65 |
public:
|
|
66 |
EncodePKlassNode(Node* value, const Type* type):
|
|
67 |
EncodeNarrowPtrNode(value, type) {
|
|
68 |
init_class_id(Class_EncodePKlass);
|
|
69 |
}
|
|
70 |
virtual int Opcode() const;
|
|
71 |
virtual Node *Identity( PhaseTransform *phase );
|
|
72 |
virtual const Type *Value( PhaseTransform *phase ) const;
|
|
73 |
};
|
|
74 |
|
|
75 |
//------------------------------DecodeNarrowPtr--------------------------------
|
|
76 |
class DecodeNarrowPtrNode : public TypeNode {
|
|
77 |
protected:
|
|
78 |
DecodeNarrowPtrNode(Node* value, const Type* type):
|
|
79 |
TypeNode(type, 2) {
|
|
80 |
init_class_id(Class_DecodeNarrowPtr);
|
|
81 |
init_req(0, NULL);
|
|
82 |
init_req(1, value);
|
|
83 |
}
|
|
84 |
public:
|
|
85 |
virtual uint ideal_reg() const { return Op_RegP; }
|
|
86 |
};
|
|
87 |
|
|
88 |
//------------------------------DecodeN--------------------------------
|
|
89 |
// Converts a narrow oop into a real oop ptr.
|
|
90 |
// Takes an extra argument which is the real heap base as a long which
|
|
91 |
// may be useful for code generation in the backend.
|
|
92 |
class DecodeNNode : public DecodeNarrowPtrNode {
|
|
93 |
public:
|
|
94 |
DecodeNNode(Node* value, const Type* type):
|
|
95 |
DecodeNarrowPtrNode(value, type) {
|
|
96 |
init_class_id(Class_DecodeN);
|
|
97 |
}
|
|
98 |
virtual int Opcode() const;
|
|
99 |
virtual const Type *Value( PhaseTransform *phase ) const;
|
|
100 |
virtual Node *Identity( PhaseTransform *phase );
|
|
101 |
};
|
|
102 |
|
|
103 |
//------------------------------DecodeNKlass--------------------------------
|
|
104 |
// Converts a narrow klass pointer into a real klass ptr.
|
|
105 |
// Takes an extra argument which is the real heap base as a long which
|
|
106 |
// may be useful for code generation in the backend.
|
|
107 |
class DecodeNKlassNode : public DecodeNarrowPtrNode {
|
|
108 |
public:
|
|
109 |
DecodeNKlassNode(Node* value, const Type* type):
|
|
110 |
DecodeNarrowPtrNode(value, type) {
|
|
111 |
init_class_id(Class_DecodeNKlass);
|
|
112 |
}
|
|
113 |
virtual int Opcode() const;
|
|
114 |
virtual const Type *Value( PhaseTransform *phase ) const;
|
|
115 |
virtual Node *Identity( PhaseTransform *phase );
|
|
116 |
};
|
|
117 |
|
|
118 |
#endif // SHARE_VM_OPTO_NARROWPTRNODE_HPP
|
|
119 |
|