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_INTRINSICNODE_HPP 26 #define SHARE_VM_OPTO_INTRINSICNODE_HPP 27 28 #include "opto/node.hpp" 29 #include "opto/opcodes.hpp" 30 31 32 //----------------------PartialSubtypeCheckNode-------------------------------- 33 // The 2nd slow-half of a subtype check. Scan the subklass's 2ndary superklass 34 // array for an instance of the superklass. Set a hidden internal cache on a 35 // hit (cache is checked with exposed code in gen_subtype_check()). Return 36 // not zero for a miss or zero for a hit. 37 class PartialSubtypeCheckNode : public Node { 38 public: 39 PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {} 40 virtual int Opcode() const; 41 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } 42 virtual uint ideal_reg() const { return Op_RegP; } 43 }; 44 45 //------------------------------StrIntrinsic------------------------------- 46 // Base class for Ideal nodes used in String instrinsic code. 47 class StrIntrinsicNode: public Node { 48 public: 49 StrIntrinsicNode(Node* control, Node* char_array_mem, 50 Node* s1, Node* c1, Node* s2, Node* c2): 51 Node(control, char_array_mem, s1, c1, s2, c2) { 52 } 53 54 StrIntrinsicNode(Node* control, Node* char_array_mem, 55 Node* s1, Node* s2, Node* c): 56 Node(control, char_array_mem, s1, s2, c) { 57 } 58 59 StrIntrinsicNode(Node* control, Node* char_array_mem, 60 Node* s1, Node* s2): 61 Node(control, char_array_mem, s1, s2) { 62 } 63 64 virtual bool depends_only_on_test() const { return false; } 65 virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; } 66 virtual uint match_edge(uint idx) const; 67 virtual uint ideal_reg() const { return Op_RegI; } 68 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 69 virtual const Type *Value(PhaseTransform *phase) const; 70 }; 71 72 //------------------------------StrComp------------------------------------- 73 class StrCompNode: public StrIntrinsicNode { 74 public: 75 StrCompNode(Node* control, Node* char_array_mem, 76 Node* s1, Node* c1, Node* s2, Node* c2): 77 StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {}; 78 virtual int Opcode() const; 79 virtual const Type* bottom_type() const { return TypeInt::INT; } 80 }; 81 82 //------------------------------StrEquals------------------------------------- 83 class StrEqualsNode: public StrIntrinsicNode { 84 public: 85 StrEqualsNode(Node* control, Node* char_array_mem, 86 Node* s1, Node* s2, Node* c): 87 StrIntrinsicNode(control, char_array_mem, s1, s2, c) {}; 88 virtual int Opcode() const; 89 virtual const Type* bottom_type() const { return TypeInt::BOOL; } 90 }; 91 92 //------------------------------StrIndexOf------------------------------------- 93 class StrIndexOfNode: public StrIntrinsicNode { 94 public: 95 StrIndexOfNode(Node* control, Node* char_array_mem, 96 Node* s1, Node* c1, Node* s2, Node* c2): 97 StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {}; 98 virtual int Opcode() const; 99 virtual const Type* bottom_type() const { return TypeInt::INT; } 100 }; 101 102 //------------------------------AryEq--------------------------------------- 103 class AryEqNode: public StrIntrinsicNode { 104 public: 105 AryEqNode(Node* control, Node* char_array_mem, Node* s1, Node* s2): 106 StrIntrinsicNode(control, char_array_mem, s1, s2) {}; 107 virtual int Opcode() const; 108 virtual const Type* bottom_type() const { return TypeInt::BOOL; } 109 }; 110 111 112 //------------------------------EncodeISOArray-------------------------------- 113 // encode char[] to byte[] in ISO_8859_1 114 class EncodeISOArrayNode: public Node { 115 public: 116 EncodeISOArrayNode(Node *control, Node* arymem, Node* s1, Node* s2, Node* c): Node(control, arymem, s1, s2, c) {}; 117 virtual int Opcode() const; 118 virtual bool depends_only_on_test() const { return false; } 119 virtual const Type* bottom_type() const { return TypeInt::INT; } 120 virtual const TypePtr* adr_type() const { return TypePtr::BOTTOM; } 121 virtual uint match_edge(uint idx) const; 122 virtual uint ideal_reg() const { return Op_RegI; } 123 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 124 virtual const Type *Value(PhaseTransform *phase) const; 125 }; 126 127 #endif // SHARE_VM_OPTO_INTRINSICNODE_HPP