< prev index next >

src/hotspot/share/opto/subnode.cpp

Print this page

1081 
1082   // Known constants can be compared exactly
1083   // Null can be distinguished from any NotNull pointers
1084   // Unknown inputs makes an unknown result
1085   if( r0->singleton() ) {
1086     intptr_t bits0 = r0->get_con();
1087     if( r1->singleton() )
1088       return bits0 == r1->get_con() ? TypeInt::CC_EQ : TypeInt::CC_GT;
1089     return ( r1->_ptr == TypePtr::NotNull && bits0==0 ) ? TypeInt::CC_GT : TypeInt::CC;
1090   } else if( r1->singleton() ) {
1091     intptr_t bits1 = r1->get_con();
1092     return ( r0->_ptr == TypePtr::NotNull && bits1==0 ) ? TypeInt::CC_GT : TypeInt::CC;
1093   } else
1094     return TypeInt::CC;
1095 }
1096 
1097 static inline Node* isa_java_mirror_load(PhaseGVN* phase, Node* n) {
1098   // Return the klass node for (indirect load from OopHandle)
1099   //   LoadBarrier?(LoadP(LoadP(AddP(foo:Klass, #java_mirror))))
1100   //   or null if not matching.
1101   BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
1102     n = bs->step_over_gc_barrier(n);
1103 
1104   if (n->Opcode() != Op_LoadP) return nullptr;
1105 
1106   const TypeInstPtr* tp = phase->type(n)->isa_instptr();
1107   if (!tp || tp->instance_klass() != phase->C->env()->Class_klass()) return nullptr;
1108 
1109   Node* adr = n->in(MemNode::Address);
1110   // First load from OopHandle: ((OopHandle)mirror)->resolve(); may need barrier.
1111   if (adr->Opcode() != Op_LoadP || !phase->type(adr)->isa_rawptr()) return nullptr;
1112   adr = adr->in(MemNode::Address);
1113 
1114   intptr_t off = 0;
1115   Node* k = AddPNode::Ideal_base_and_offset(adr, phase, off);
1116   if (k == nullptr)  return nullptr;
1117   const TypeKlassPtr* tkp = phase->type(k)->isa_klassptr();
1118   if (!tkp || off != in_bytes(Klass::java_mirror_offset())) return nullptr;
1119 
1120   // We've found the klass node of a Java mirror load.
1121   return k;
1122 }
1123 

1081 
1082   // Known constants can be compared exactly
1083   // Null can be distinguished from any NotNull pointers
1084   // Unknown inputs makes an unknown result
1085   if( r0->singleton() ) {
1086     intptr_t bits0 = r0->get_con();
1087     if( r1->singleton() )
1088       return bits0 == r1->get_con() ? TypeInt::CC_EQ : TypeInt::CC_GT;
1089     return ( r1->_ptr == TypePtr::NotNull && bits0==0 ) ? TypeInt::CC_GT : TypeInt::CC;
1090   } else if( r1->singleton() ) {
1091     intptr_t bits1 = r1->get_con();
1092     return ( r0->_ptr == TypePtr::NotNull && bits1==0 ) ? TypeInt::CC_GT : TypeInt::CC;
1093   } else
1094     return TypeInt::CC;
1095 }
1096 
1097 static inline Node* isa_java_mirror_load(PhaseGVN* phase, Node* n) {
1098   // Return the klass node for (indirect load from OopHandle)
1099   //   LoadBarrier?(LoadP(LoadP(AddP(foo:Klass, #java_mirror))))
1100   //   or null if not matching.



1101   if (n->Opcode() != Op_LoadP) return nullptr;
1102 
1103   const TypeInstPtr* tp = phase->type(n)->isa_instptr();
1104   if (!tp || tp->instance_klass() != phase->C->env()->Class_klass()) return nullptr;
1105 
1106   Node* adr = n->in(MemNode::Address);
1107   // First load from OopHandle: ((OopHandle)mirror)->resolve(); may need barrier.
1108   if (adr->Opcode() != Op_LoadP || !phase->type(adr)->isa_rawptr()) return nullptr;
1109   adr = adr->in(MemNode::Address);
1110 
1111   intptr_t off = 0;
1112   Node* k = AddPNode::Ideal_base_and_offset(adr, phase, off);
1113   if (k == nullptr)  return nullptr;
1114   const TypeKlassPtr* tkp = phase->type(k)->isa_klassptr();
1115   if (!tkp || off != in_bytes(Klass::java_mirror_offset())) return nullptr;
1116 
1117   // We've found the klass node of a Java mirror load.
1118   return k;
1119 }
1120 
< prev index next >