14
14
import com .oracle .truffle .api .dsl .Cached ;
15
15
import com .oracle .truffle .api .dsl .GenerateInline ;
16
16
import com .oracle .truffle .api .dsl .GenerateUncached ;
17
+ import com .oracle .truffle .api .dsl .ImportStatic ;
17
18
import com .oracle .truffle .api .dsl .Specialization ;
18
19
import com .oracle .truffle .api .frame .Frame ;
19
20
import com .oracle .truffle .api .nodes .Node ;
22
23
import org .truffleruby .core .exception .ExceptionOperations ;
23
24
import org .truffleruby .core .symbol .RubySymbol ;
24
25
import org .truffleruby .language .RubyBaseNode ;
25
- import org .truffleruby .language .RubyGuards ;
26
26
import org .truffleruby .language .arguments .RubyArguments ;
27
27
import org .truffleruby .language .control .RaiseException ;
28
28
import org .truffleruby .language .methods .CallForeignMethodNode ;
31
31
32
32
@ GenerateInline (false )
33
33
@ GenerateUncached
34
+ @ ImportStatic (MissingBehavior .class )
34
35
public abstract class DispatchMethodMissingNode extends RubyBaseNode {
35
36
36
37
37
38
public abstract Object execute (Frame frame , Object receiver , String methodName , Object [] rubyArgs ,
38
39
DispatchConfiguration config , LiteralCallNode literalCallNode );
39
40
40
41
41
- @ Specialization (guards = "isReturnMissing( config) " )
42
+ @ Specialization (guards = "config.missingBehavior == RETURN_MISSING " )
42
43
protected static Object dispatchReturnMissing (
43
44
Frame frame ,
44
45
Object receiver ,
@@ -50,7 +51,7 @@ protected static Object dispatchReturnMissing(
50
51
}
51
52
52
53
@ InliningCutoff
53
- @ Specialization (guards = "isForeignObject( config, receiver)" )
54
+ @ Specialization (guards = { " config.missingBehavior == CALL_METHOD_MISSING" , "isForeignObject( receiver)" } )
54
55
protected static Object dispatchForeign (
55
56
Frame frame ,
56
57
Object receiver ,
@@ -65,7 +66,7 @@ protected static Object dispatchForeign(
65
66
}
66
67
67
68
@ InliningCutoff
68
- @ Specialization (guards = "isMethodMissing( config, receiver)" )
69
+ @ Specialization (guards = { " config.missingBehavior == CALL_METHOD_MISSING" , "!isForeignObject( receiver)" } )
69
70
protected static Object dispatchMissingMethod (
70
71
Frame frame ,
71
72
Object receiver ,
@@ -97,16 +98,4 @@ protected static Object dispatchMissingMethod(
97
98
98
99
return result ;
99
100
}
100
-
101
- protected static boolean isReturnMissing (DispatchConfiguration config ) {
102
- return config .missingBehavior == MissingBehavior .RETURN_MISSING ;
103
- }
104
-
105
- protected static boolean isForeignObject (DispatchConfiguration config , Object receiver ) {
106
- return config .missingBehavior == MissingBehavior .CALL_METHOD_MISSING && RubyGuards .isForeignObject (receiver );
107
- }
108
-
109
- protected static boolean isMethodMissing (DispatchConfiguration config , Object receiver ) {
110
- return config .missingBehavior == MissingBehavior .CALL_METHOD_MISSING && !RubyGuards .isForeignObject (receiver );
111
- }
112
101
}
0 commit comments