@@ -94,6 +94,7 @@ public abstract class InvokeSite extends MutableCallSite {
9494 public final Signature fullSignature ;
9595 public final int arity ;
9696 protected final String methodName ;
97+ protected final CallType visibilityCallType ;
9798 final MethodHandle fallback ;
9899 private final SiteTracker tracker = new SiteTracker ();
99100 private final long siteID = SITE_ID .getAndIncrement ();
@@ -695,25 +696,27 @@ public String name() {
695696 return methodName ;
696697 }
697698
698- public final CallType callType ;
699-
700699 public InvokeSite (MethodType type , String name , CallType callType , boolean literalClosure , int flags , String file , int line ) {
700+ this (type , name , callType , callType , literalClosure , flags , file , line );
701+ }
702+
703+ protected InvokeSite (MethodType type , String name , CallType structuralCallType , CallType visibilityCallType , boolean literalClosure , int flags , String file , int line ) {
701704 super (type );
702705 this .methodName = name ;
703- this .callType = callType ;
706+ this .visibilityCallType = visibilityCallType ;
704707 this .literalClosure = literalClosure ;
705708 this .file = file ;
706709 this .line = line ;
707710 this .flags = flags ;
708711
709712 Signature startSig ;
710713
711- if (callType == CallType .SUPER ) {
714+ if (structuralCallType == CallType .SUPER ) {
712715 // super calls receive current class argument, so offsets and signature are different
713716 startSig = JRubyCallSite .STANDARD_SUPER_SIG ;
714717 functional = false ;
715718 argOffset = 4 ;
716- } else if (callType == CallType .FUNCTIONAL || callType == CallType .VARIABLE ) {
719+ } else if (structuralCallType == CallType .FUNCTIONAL || structuralCallType == CallType .VARIABLE ) {
717720 startSig = JRubyCallSite .STANDARD_FSITE_SIG ;
718721 functional = true ;
719722 argOffset = 2 ;
@@ -818,7 +821,7 @@ private CacheEntry methodMissingEntry(ThreadContext context, RubyClass selfClass
818821 logMethodMissing ();
819822 }
820823 Visibility visibility = entry .method .getVisibility ();
821- return Helpers .createMethodMissingEntry (context , selfClass , callType , visibility , entry .token , methodName );
824+ return Helpers .createMethodMissingEntry (context , selfClass , visibilityCallType , visibility , entry .token , methodName );
822825 }
823826
824827 private void finishBinding (CacheEntry entry , MethodHandle mh , IRubyObject self , RubyClass selfClass , SwitchPoint switchPoint ) {
@@ -916,7 +919,7 @@ public IRubyObject fail(ThreadContext context, IRubyObject caller, IRubyObject s
916919 entry = selfClass .searchWithCache (name );
917920
918921 if (methodMissing (entry , caller )) {
919- return callMethodMissing (entry , callType , context , self , selfClass , name , args , block );
922+ return callMethodMissing (entry , visibilityCallType , context , self , selfClass , name , args , block );
920923 }
921924
922925 cache = entry ;
@@ -941,7 +944,7 @@ public IRubyObject failf(ThreadContext context, IRubyObject self, IRubyObject[]
941944 entry = selfClass .searchWithCache (name );
942945
943946 if (methodMissing (entry )) {
944- return callMethodMissing (entry , callType , context , self , selfClass , name , args , block );
947+ return callMethodMissing (entry , visibilityCallType , context , self , selfClass , name , args , block );
945948 }
946949
947950 cache = entry ;
@@ -980,7 +983,7 @@ public IRubyObject fail(ThreadContext context, IRubyObject caller, IRubyObject s
980983 entry = selfClass .searchWithCache (name );
981984
982985 if (methodMissing (entry , caller )) {
983- return callMethodMissing (entry , callType , context , self , selfClass , name , arg0 , block );
986+ return callMethodMissing (entry , visibilityCallType , context , self , selfClass , name , arg0 , block );
984987 }
985988
986989 cache = entry ;
@@ -1005,7 +1008,7 @@ public IRubyObject failf(ThreadContext context, IRubyObject self, IRubyObject ar
10051008 entry = selfClass .searchWithCache (name );
10061009
10071010 if (methodMissing (entry )) {
1008- return callMethodMissing (entry , callType , context , self , selfClass , name , arg0 , block );
1011+ return callMethodMissing (entry , visibilityCallType , context , self , selfClass , name , arg0 , block );
10091012 }
10101013
10111014 cache = entry ;
@@ -1030,7 +1033,7 @@ public IRubyObject fail(ThreadContext context, IRubyObject caller, IRubyObject s
10301033 entry = selfClass .searchWithCache (name );
10311034
10321035 if (methodMissing (entry , caller )) {
1033- return callMethodMissing (entry , callType , context , self , selfClass , name , arg0 , arg1 , block );
1036+ return callMethodMissing (entry , visibilityCallType , context , self , selfClass , name , arg0 , arg1 , block );
10341037 }
10351038
10361039 cache = entry ;
@@ -1055,7 +1058,7 @@ public IRubyObject failf(ThreadContext context, IRubyObject self, IRubyObject ar
10551058 entry = selfClass .searchWithCache (name );
10561059
10571060 if (methodMissing (entry )) {
1058- return callMethodMissing (entry , callType , context , self , selfClass , name , arg0 , arg1 , block );
1061+ return callMethodMissing (entry , visibilityCallType , context , self , selfClass , name , arg0 , arg1 , block );
10591062 }
10601063
10611064 cache = entry ;
@@ -1080,7 +1083,7 @@ public IRubyObject fail(ThreadContext context, IRubyObject caller, IRubyObject s
10801083 entry = selfClass .searchWithCache (name );
10811084
10821085 if (methodMissing (entry , caller )) {
1083- return callMethodMissing (entry , callType , context , self , selfClass , name , arg0 , arg1 , arg2 , block );
1086+ return callMethodMissing (entry , visibilityCallType , context , self , selfClass , name , arg0 , arg1 , arg2 , block );
10841087 }
10851088
10861089 cache = entry ;
@@ -1105,7 +1108,7 @@ public IRubyObject failf(ThreadContext context, IRubyObject self, IRubyObject ar
11051108 entry = selfClass .searchWithCache (name );
11061109
11071110 if (methodMissing (entry )) {
1108- return callMethodMissing (entry , callType , context , self , selfClass , name , arg0 , arg1 , arg2 , block );
1111+ return callMethodMissing (entry , visibilityCallType , context , self , selfClass , name , arg0 , arg1 , arg2 , block );
11091112 }
11101113
11111114 cache = entry ;
@@ -1537,7 +1540,7 @@ public void setInitialTarget(MethodHandle target) {
15371540 public boolean methodMissing (CacheEntry entry , IRubyObject caller ) {
15381541 DynamicMethod method = entry .method ;
15391542
1540- return method .isUndefined () || (!methodName .equals ("method_missing" ) && !method .isCallableFrom (caller , callType ));
1543+ return method .isUndefined () || (!methodName .equals ("method_missing" ) && !method .isCallableFrom (caller , visibilityCallType ));
15411544 }
15421545
15431546 public boolean methodMissing (CacheEntry entry ) {
0 commit comments