src/share/vm/opto/graphKit.cpp

Print this page
rev 6132 : 6653795: C2 intrinsic for Unsafe.getAddress performs pointer sign extension on 32-bit systems
Summary: Native pointers less than 64 bits wide should be extended as an unsigned number.
Reviewed-by: kvn, kevinw, roland


1108   return true;
1109 }
1110 
1111 
1112 
1113 //------------------------------basic_plus_adr---------------------------------
1114 Node* GraphKit::basic_plus_adr(Node* base, Node* ptr, Node* offset) {
1115   // short-circuit a common case
1116   if (offset == intcon(0))  return ptr;
1117   return _gvn.transform( new (C) AddPNode(base, ptr, offset) );
1118 }
1119 
1120 Node* GraphKit::ConvI2L(Node* offset) {
1121   // short-circuit a common case
1122   jint offset_con = find_int_con(offset, Type::OffsetBot);
1123   if (offset_con != Type::OffsetBot) {
1124     return longcon((jlong) offset_con);
1125   }
1126   return _gvn.transform( new (C) ConvI2LNode(offset));
1127 }











1128 Node* GraphKit::ConvL2I(Node* offset) {
1129   // short-circuit a common case
1130   jlong offset_con = find_long_con(offset, (jlong)Type::OffsetBot);
1131   if (offset_con != (jlong)Type::OffsetBot) {
1132     return intcon((int) offset_con);
1133   }
1134   return _gvn.transform( new (C) ConvL2INode(offset));
1135 }
1136 
1137 //-------------------------load_object_klass-----------------------------------
1138 Node* GraphKit::load_object_klass(Node* obj) {
1139   // Special-case a fresh allocation to avoid building nodes:
1140   Node* akls = AllocateNode::Ideal_klass(obj, &_gvn);
1141   if (akls != NULL)  return akls;
1142   Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
1143   return _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), k_adr, TypeInstPtr::KLASS) );
1144 }
1145 
1146 //-------------------------load_array_length-----------------------------------
1147 Node* GraphKit::load_array_length(Node* array) {




1108   return true;
1109 }
1110 
1111 
1112 
1113 //------------------------------basic_plus_adr---------------------------------
1114 Node* GraphKit::basic_plus_adr(Node* base, Node* ptr, Node* offset) {
1115   // short-circuit a common case
1116   if (offset == intcon(0))  return ptr;
1117   return _gvn.transform( new (C) AddPNode(base, ptr, offset) );
1118 }
1119 
1120 Node* GraphKit::ConvI2L(Node* offset) {
1121   // short-circuit a common case
1122   jint offset_con = find_int_con(offset, Type::OffsetBot);
1123   if (offset_con != Type::OffsetBot) {
1124     return longcon((jlong) offset_con);
1125   }
1126   return _gvn.transform( new (C) ConvI2LNode(offset));
1127 }
1128 
1129 Node* GraphKit::ConvI2UL(Node* offset) {
1130   juint offset_con = (juint) find_int_con(offset, Type::OffsetBot);
1131   if (offset_con != (juint) Type::OffsetBot) {
1132     return longcon((julong) offset_con);
1133   }
1134   Node* conv = _gvn.transform( new (C) ConvI2LNode(offset));
1135   Node* mask = _gvn.transform( ConLNode::make(C, (julong) max_juint) );
1136   return _gvn.transform( new (C) AndLNode(conv, mask) );
1137 }
1138 
1139 Node* GraphKit::ConvL2I(Node* offset) {
1140   // short-circuit a common case
1141   jlong offset_con = find_long_con(offset, (jlong)Type::OffsetBot);
1142   if (offset_con != (jlong)Type::OffsetBot) {
1143     return intcon((int) offset_con);
1144   }
1145   return _gvn.transform( new (C) ConvL2INode(offset));
1146 }
1147 
1148 //-------------------------load_object_klass-----------------------------------
1149 Node* GraphKit::load_object_klass(Node* obj) {
1150   // Special-case a fresh allocation to avoid building nodes:
1151   Node* akls = AllocateNode::Ideal_klass(obj, &_gvn);
1152   if (akls != NULL)  return akls;
1153   Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
1154   return _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), k_adr, TypeInstPtr::KLASS) );
1155 }
1156 
1157 //-------------------------load_array_length-----------------------------------
1158 Node* GraphKit::load_array_length(Node* array) {