67
67
import org .jruby .runtime .ThreadContext ;
68
68
import org .jruby .runtime .Visibility ;
69
69
import org .jruby .runtime .builtin .IRubyObject ;
70
+ import org .jruby .runtime .callsite .CacheEntry ;
70
71
import org .jruby .runtime .callsite .CachingCallSite ;
71
72
import org .jruby .runtime .callsite .FunctionalCachingCallSite ;
72
73
import org .jruby .runtime .callsite .NormalCachingCallSite ;
@@ -1074,11 +1075,12 @@ public static IRubyObject instanceSuperSplatArgs(ThreadContext context, IRubyObj
1074
1075
1075
1076
@ Interp
1076
1077
public static IRubyObject instanceSuper (ThreadContext context , IRubyObject self , String id , RubyModule definingModule , IRubyObject [] args , Block block ) {
1077
- RubyClass superClass = definingModule .getMethodLocation ().getSuperClass ();
1078
- DynamicMethod method = superClass != null ? superClass .searchMethod (id ) : UndefinedMethod .INSTANCE ;
1078
+ RubyClass superClass = definingModule .getSuperClass ();
1079
+ CacheEntry entry = superClass != null ? superClass .searchWithCache (id ) : CacheEntry .NULL_CACHE ;
1080
+ DynamicMethod method = entry .method ;
1079
1081
IRubyObject rVal = method .isUndefined () ?
1080
1082
Helpers .callMethodMissing (context , self , method .getVisibility (), id , CallType .SUPER , args , block )
1081
- : method .call (context , self , superClass , id , args , block );
1083
+ : method .call (context , self , entry . host , id , args , block );
1082
1084
return rVal ;
1083
1085
}
1084
1086
@@ -1090,10 +1092,11 @@ public static IRubyObject classSuperSplatArgs(ThreadContext context, IRubyObject
1090
1092
@ Interp
1091
1093
public static IRubyObject classSuper (ThreadContext context , IRubyObject self , String id , RubyModule definingModule , IRubyObject [] args , Block block ) {
1092
1094
RubyClass superClass = definingModule .getMetaClass ().getMethodLocation ().getSuperClass ();
1093
- DynamicMethod method = superClass != null ? superClass .searchMethod (id ) : UndefinedMethod .INSTANCE ;
1095
+ CacheEntry entry = superClass != null ? superClass .searchWithCache (id ) : CacheEntry .NULL_CACHE ;
1096
+ DynamicMethod method = entry .method ;
1094
1097
IRubyObject rVal = method .isUndefined () ?
1095
1098
Helpers .callMethodMissing (context , self , method .getVisibility (), id , CallType .SUPER , args , block )
1096
- : method .call (context , self , superClass , id , args , block );
1099
+ : method .call (context , self , entry . host , id , args , block );
1097
1100
return rVal ;
1098
1101
}
1099
1102
@@ -1103,18 +1106,19 @@ public static IRubyObject unresolvedSuperSplatArgs(ThreadContext context, IRubyO
1103
1106
1104
1107
public static IRubyObject unresolvedSuper (ThreadContext context , IRubyObject self , IRubyObject [] args , Block block ) {
1105
1108
// We have to rely on the frame stack to find the implementation class
1106
- RubyModule klazz = context .getFrameKlazz (). getMethodLocation () ;
1109
+ RubyModule klazz = context .getFrameKlazz ();
1107
1110
String methodName = context .getCurrentFrame ().getName ();
1108
1111
1109
1112
Helpers .checkSuperDisabledOrOutOfMethod (context , klazz , methodName );
1110
1113
RubyClass superClass = klazz .getSuperClass ();
1111
- DynamicMethod method = superClass != null ? superClass .searchMethod (methodName ) : UndefinedMethod .INSTANCE ;
1114
+ CacheEntry entry = superClass != null ? superClass .searchWithCache (methodName ) : CacheEntry .NULL_CACHE ;
1115
+ DynamicMethod method = entry .method ;
1112
1116
1113
1117
IRubyObject rVal ;
1114
1118
if (method .isUndefined ()) {
1115
1119
rVal = Helpers .callMethodMissing (context , self , method .getVisibility (), methodName , CallType .SUPER , args , block );
1116
1120
} else {
1117
- rVal = method .call (context , self , superClass , methodName , args , block );
1121
+ rVal = method .call (context , self , entry . host , methodName , args , block );
1118
1122
}
1119
1123
1120
1124
return rVal ;
0 commit comments