10
10
package org .truffleruby .language .locals ;
11
11
12
12
import com .oracle .truffle .api .CompilerAsserts ;
13
+ import com .oracle .truffle .api .dsl .GenerateCached ;
14
+ import com .oracle .truffle .api .dsl .GenerateInline ;
13
15
import com .oracle .truffle .api .dsl .GenerateUncached ;
14
16
import com .oracle .truffle .api .frame .Frame ;
15
17
import com .oracle .truffle .api .frame .MaterializedFrame ;
18
+ import com .oracle .truffle .api .nodes .Node ;
16
19
import org .truffleruby .language .RubyBaseNode ;
17
20
import org .truffleruby .language .arguments .RubyArguments ;
18
21
@@ -76,14 +79,16 @@ public static FrameSlotAndDepth findFrameSlotOrNull(String identifier, Frame fra
76
79
@ ReportPolymorphism
77
80
@ GenerateUncached
78
81
@ ImportStatic (FindDeclarationVariableNodes .class )
82
+ @ GenerateInline
83
+ @ GenerateCached (false )
79
84
public abstract static class FindAndReadDeclarationVariableNode extends RubyBaseNode {
80
85
81
- public abstract Object execute (Frame frame , String name , Object defaultValue );
86
+ public abstract Object execute (Frame frame , Node node , String name , Object defaultValue );
82
87
83
88
@ Specialization (
84
89
guards = { "name == cachedName" , "frame.getFrameDescriptor() == cachedDescriptor" },
85
90
limit = "getDefaultCacheLimit()" )
86
- protected Object getVariable (Frame frame , String name , Object defaultValue ,
91
+ protected static Object getVariable (Frame frame , String name , Object defaultValue ,
87
92
@ Cached ("name" ) String cachedName ,
88
93
@ Cached ("frame.getFrameDescriptor()" ) FrameDescriptor cachedDescriptor ,
89
94
@ Cached ("findFrameSlotOrNull(name, frame)" ) FrameSlotAndDepth slotAndDepth ,
@@ -97,12 +102,12 @@ protected Object getVariable(Frame frame, String name, Object defaultValue,
97
102
}
98
103
99
104
@ Specialization (replaces = "getVariable" )
100
- protected Object getVariableSlow (Frame frame , String name , Object defaultValue ) {
105
+ protected static Object getVariableSlow (Frame frame , String name , Object defaultValue ) {
101
106
return getVariableSlowBoundary (frame .materialize (), name , defaultValue );
102
107
}
103
108
104
109
@ TruffleBoundary
105
- private Object getVariableSlowBoundary (MaterializedFrame frame , String name , Object defaultValue ) {
110
+ private static Object getVariableSlowBoundary (MaterializedFrame frame , String name , Object defaultValue ) {
106
111
final FrameSlotAndDepth slotAndDepth = findFrameSlotOrNull (name , frame );
107
112
if (slotAndDepth == null ) {
108
113
return defaultValue ;
@@ -112,7 +117,7 @@ private Object getVariableSlowBoundary(MaterializedFrame frame, String name, Obj
112
117
}
113
118
}
114
119
115
- protected ReadFrameSlotNode createReadNode (FrameSlotAndDepth frameSlot ) {
120
+ protected static ReadFrameSlotNode createReadNode (FrameSlotAndDepth frameSlot ) {
116
121
if (frameSlot == null ) {
117
122
return null ;
118
123
} else {
0 commit comments