1020
1021 // Known constants can be compared exactly
1022 // Null can be distinguished from any NotNull pointers
1023 // Unknown inputs makes an unknown result
1024 if( r0->singleton() ) {
1025 intptr_t bits0 = r0->get_con();
1026 if( r1->singleton() )
1027 return bits0 == r1->get_con() ? TypeInt::CC_EQ : TypeInt::CC_GT;
1028 return ( r1->_ptr == TypePtr::NotNull && bits0==0 ) ? TypeInt::CC_GT : TypeInt::CC;
1029 } else if( r1->singleton() ) {
1030 intptr_t bits1 = r1->get_con();
1031 return ( r0->_ptr == TypePtr::NotNull && bits1==0 ) ? TypeInt::CC_GT : TypeInt::CC;
1032 } else
1033 return TypeInt::CC;
1034 }
1035
1036 static inline Node* isa_java_mirror_load(PhaseGVN* phase, Node* n) {
1037 // Return the klass node for (indirect load from OopHandle)
1038 // LoadBarrier?(LoadP(LoadP(AddP(foo:Klass, #java_mirror))))
1039 // or null if not matching.
1040 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
1041 n = bs->step_over_gc_barrier(n);
1042
1043 if (n->Opcode() != Op_LoadP) return nullptr;
1044
1045 const TypeInstPtr* tp = phase->type(n)->isa_instptr();
1046 if (!tp || tp->instance_klass() != phase->C->env()->Class_klass()) return nullptr;
1047
1048 Node* adr = n->in(MemNode::Address);
1049 // First load from OopHandle: ((OopHandle)mirror)->resolve(); may need barrier.
1050 if (adr->Opcode() != Op_LoadP || !phase->type(adr)->isa_rawptr()) return nullptr;
1051 adr = adr->in(MemNode::Address);
1052
1053 intptr_t off = 0;
1054 Node* k = AddPNode::Ideal_base_and_offset(adr, phase, off);
1055 if (k == nullptr) return nullptr;
1056 const TypeKlassPtr* tkp = phase->type(k)->isa_klassptr();
1057 if (!tkp || off != in_bytes(Klass::java_mirror_offset())) return nullptr;
1058
1059 // We've found the klass node of a Java mirror load.
1060 return k;
1061 }
1062
|
1020
1021 // Known constants can be compared exactly
1022 // Null can be distinguished from any NotNull pointers
1023 // Unknown inputs makes an unknown result
1024 if( r0->singleton() ) {
1025 intptr_t bits0 = r0->get_con();
1026 if( r1->singleton() )
1027 return bits0 == r1->get_con() ? TypeInt::CC_EQ : TypeInt::CC_GT;
1028 return ( r1->_ptr == TypePtr::NotNull && bits0==0 ) ? TypeInt::CC_GT : TypeInt::CC;
1029 } else if( r1->singleton() ) {
1030 intptr_t bits1 = r1->get_con();
1031 return ( r0->_ptr == TypePtr::NotNull && bits1==0 ) ? TypeInt::CC_GT : TypeInt::CC;
1032 } else
1033 return TypeInt::CC;
1034 }
1035
1036 static inline Node* isa_java_mirror_load(PhaseGVN* phase, Node* n) {
1037 // Return the klass node for (indirect load from OopHandle)
1038 // LoadBarrier?(LoadP(LoadP(AddP(foo:Klass, #java_mirror))))
1039 // or null if not matching.
1040 if (n->Opcode() != Op_LoadP) return nullptr;
1041
1042 const TypeInstPtr* tp = phase->type(n)->isa_instptr();
1043 if (!tp || tp->instance_klass() != phase->C->env()->Class_klass()) return nullptr;
1044
1045 Node* adr = n->in(MemNode::Address);
1046 // First load from OopHandle: ((OopHandle)mirror)->resolve(); may need barrier.
1047 if (adr->Opcode() != Op_LoadP || !phase->type(adr)->isa_rawptr()) return nullptr;
1048 adr = adr->in(MemNode::Address);
1049
1050 intptr_t off = 0;
1051 Node* k = AddPNode::Ideal_base_and_offset(adr, phase, off);
1052 if (k == nullptr) return nullptr;
1053 const TypeKlassPtr* tkp = phase->type(k)->isa_klassptr();
1054 if (!tkp || off != in_bytes(Klass::java_mirror_offset())) return nullptr;
1055
1056 // We've found the klass node of a Java mirror load.
1057 return k;
1058 }
1059
|