@@ -3780,50 +3780,8 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
3780
3780
case RawPtr: return TypePtr::BOTTOM;
3781
3781
3782
3782
case AryPtr: { // All arrays inherit from Object class
3783
- const TypeAryPtr *tp = t->is_aryptr ();
3784
- int offset = meet_offset (tp->offset ());
3785
- PTR ptr = meet_ptr (tp->ptr ());
3786
- int instance_id = meet_instance_id (tp->instance_id ());
3787
- const TypePtr* speculative = xmeet_speculative (tp);
3788
- int depth = meet_inline_depth (tp->inline_depth ());
3789
- switch (ptr) {
3790
- case TopPTR:
3791
- case AnyNull: // Fall 'down' to dual of object klass
3792
- // For instances when a subclass meets a superclass we fall
3793
- // below the centerline when the superclass is exact. We need to
3794
- // do the same here.
3795
- if (klass ()->equals (ciEnv::current ()->Object_klass ()) && !klass_is_exact ()) {
3796
- return TypeAryPtr::make (ptr, tp->ary (), tp->klass (), tp->klass_is_exact (), offset, instance_id, speculative, depth);
3797
- } else {
3798
- // cannot subclass, so the meet has to fall badly below the centerline
3799
- ptr = NotNull;
3800
- instance_id = InstanceBot;
3801
- return TypeInstPtr::make ( ptr, ciEnv::current ()->Object_klass (), false , NULL , offset, instance_id, speculative, depth);
3802
- }
3803
- case Constant:
3804
- case NotNull:
3805
- case BotPTR: // Fall down to object klass
3806
- // LCA is object_klass, but if we subclass from the top we can do better
3807
- if ( above_centerline (_ptr) ) { // if( _ptr == TopPTR || _ptr == AnyNull )
3808
- // If 'this' (InstPtr) is above the centerline and it is Object class
3809
- // then we can subclass in the Java class hierarchy.
3810
- // For instances when a subclass meets a superclass we fall
3811
- // below the centerline when the superclass is exact. We need
3812
- // to do the same here.
3813
- if (klass ()->equals (ciEnv::current ()->Object_klass ()) && !klass_is_exact ()) {
3814
- // that is, tp's array type is a subtype of my klass
3815
- return TypeAryPtr::make (ptr, (ptr == Constant ? tp->const_oop () : NULL ),
3816
- tp->ary (), tp->klass (), tp->klass_is_exact (), offset, instance_id, speculative, depth);
3817
- }
3818
- }
3819
- // The other case cannot happen, since I cannot be a subtype of an array.
3820
- // The meet falls down to Object class below centerline.
3821
- if ( ptr == Constant )
3822
- ptr = NotNull;
3823
- instance_id = InstanceBot;
3824
- return make (ptr, ciEnv::current ()->Object_klass (), false , NULL , offset, instance_id, speculative, depth);
3825
- default : typerr (t);
3826
- }
3783
+ // Call in reverse direction to avoid duplication
3784
+ return t->is_aryptr ()->xmeet_helper (this );
3827
3785
}
3828
3786
3829
3787
case OopPtr: { // Meeting to OopPtrs
@@ -3961,8 +3919,12 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
3961
3919
k = above_centerline (ptr) ? tinst_klass : ciEnv::current ()->Object_klass ();
3962
3920
xk = above_centerline (ptr) ? tinst_xk : false ;
3963
3921
// Watch out for Constant vs. AnyNull interface.
3964
- if (ptr == Constant) ptr = NotNull; // forget it was a constant
3965
- instance_id = InstanceBot;
3922
+ if (ptr == Constant) {
3923
+ ptr = NotNull; // forget it was a constant
3924
+ }
3925
+ if (instance_id > 0 ) {
3926
+ instance_id = InstanceBot;
3927
+ }
3966
3928
}
3967
3929
ciObject* o = NULL ; // the Constant value, if any
3968
3930
if (ptr == Constant) {
@@ -4051,9 +4013,9 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
4051
4013
4052
4014
// Since klasses are different, we require a LCA in the Java
4053
4015
// class hierarchy - which means we have to fall to at least NotNull.
4054
- if ( ptr == TopPTR || ptr == AnyNull || ptr == Constant )
4016
+ if ( ptr == TopPTR || ptr == AnyNull || ptr == Constant) {
4055
4017
ptr = NotNull;
4056
-
4018
+ }
4057
4019
instance_id = InstanceBot;
4058
4020
4059
4021
// Now we find the LCA of Java classes
@@ -4495,16 +4457,18 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
4495
4457
// Only precise for identical arrays
4496
4458
xk = this ->_klass_is_exact && (klass () == tap->klass ());
4497
4459
}
4498
- return TypeAryPtr:: make (ptr, o, tary, lazy_klass, xk, off, instance_id, speculative, depth);
4460
+ return make (ptr, o, tary, lazy_klass, xk, off, instance_id, speculative, depth);
4499
4461
}
4500
4462
case NotNull:
4501
4463
case BotPTR:
4502
4464
// Compute new klass on demand, do not use tap->_klass
4503
- if (above_centerline (this ->_ptr ))
4504
- xk = tap->_klass_is_exact ;
4505
- else xk = (tap->_klass_is_exact & this ->_klass_is_exact ) &&
4506
- (klass () == tap->klass ()); // Only precise for identical arrays
4507
- return TypeAryPtr::make (ptr, NULL , tary, lazy_klass, xk, off, instance_id, speculative, depth);
4465
+ if (above_centerline (this ->_ptr )) {
4466
+ xk = tap->_klass_is_exact ;
4467
+ } else {
4468
+ xk = (tap->_klass_is_exact & this ->_klass_is_exact ) &&
4469
+ (klass () == tap->klass ()); // Only precise for identical arrays
4470
+ }
4471
+ return make (ptr, NULL , tary, lazy_klass, xk, off, instance_id, speculative, depth);
4508
4472
default : ShouldNotReachHere ();
4509
4473
}
4510
4474
}
@@ -4524,7 +4488,7 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
4524
4488
// below the centerline when the superclass is exact. We need to
4525
4489
// do the same here.
4526
4490
if (tp->klass ()->equals (ciEnv::current ()->Object_klass ()) && !tp->klass_is_exact ()) {
4527
- return TypeAryPtr:: make (ptr, _ary, _klass, _klass_is_exact, offset, instance_id, speculative, depth);
4491
+ return make (ptr, _ary, _klass, _klass_is_exact, offset, instance_id, speculative, depth);
4528
4492
} else {
4529
4493
// cannot subclass, so the meet has to fall badly below the centerline
4530
4494
ptr = NotNull;
@@ -4549,10 +4513,13 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
4549
4513
}
4550
4514
// The other case cannot happen, since t cannot be a subtype of an array.
4551
4515
// The meet falls down to Object class below centerline.
4552
- if ( ptr == Constant )
4516
+ if ( ptr == Constant) {
4553
4517
ptr = NotNull;
4554
- instance_id = InstanceBot;
4555
- return TypeInstPtr::make (ptr, ciEnv::current ()->Object_klass (), false , NULL ,offset, instance_id, speculative, depth);
4518
+ }
4519
+ if (instance_id > 0 ) {
4520
+ instance_id = InstanceBot;
4521
+ }
4522
+ return TypeInstPtr::make (ptr, ciEnv::current ()->Object_klass (), false , NULL , offset, instance_id, speculative, depth);
4556
4523
default : typerr (t);
4557
4524
}
4558
4525
}
0 commit comments