17
17
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
18
18
import com .oracle .truffle .api .dsl .Cached ;
19
19
import com .oracle .truffle .api .dsl .Specialization ;
20
- import com .oracle .truffle .api .frame .Frame ;
21
20
import com .oracle .truffle .api .frame .FrameDescriptor ;
22
21
import com .oracle .truffle .api .frame .FrameSlot ;
23
22
import com .oracle .truffle .api .frame .FrameSlotKind ;
@@ -64,7 +63,7 @@ protected StorageInFrameFinder(FrameDescriptor fd, FrameSlot fs, Object defaultV
64
63
this .depth = depth ;
65
64
}
66
65
67
- public boolean matches (Frame callerFrame ) {
66
+ public boolean matches (MaterializedFrame callerFrame ) {
68
67
return callerFrame != null && callerFrame .getFrameDescriptor () == descriptor ;
69
68
}
70
69
@@ -73,8 +72,7 @@ public ThreadAndFrameLocalStorage getStorage(RubyContext context, MaterializedFr
73
72
return getStorageFromFrame (context , frame , slot , defaultValue , true );
74
73
}
75
74
76
- public static StorageInFrameFinder of (RubyContext context , Frame aFrame , String variableName ) {
77
- MaterializedFrame callerFrame = aFrame .materialize ();
75
+ public static StorageInFrameFinder of (RubyContext context , MaterializedFrame callerFrame , String variableName ) {
78
76
FrameDescriptor descriptor = callerFrame .getFrameDescriptor ();
79
77
80
78
int depth = getVariableDeclarationFrameDepth (callerFrame , variableName );
@@ -86,7 +84,7 @@ public static StorageInFrameFinder of(RubyContext context, Frame aFrame, String
86
84
}
87
85
88
86
private static int getVariableDeclarationFrameDepth (MaterializedFrame topFrame , String variableName ) {
89
- Frame frame = topFrame ;
87
+ MaterializedFrame frame = topFrame ;
90
88
int count = 0 ;
91
89
92
90
while (true ) {
@@ -95,7 +93,7 @@ private static int getVariableDeclarationFrameDepth(MaterializedFrame topFrame,
95
93
return count ;
96
94
}
97
95
98
- final Frame nextFrame = RubyArguments .getDeclarationFrame (frame );
96
+ final MaterializedFrame nextFrame = RubyArguments .getDeclarationFrame (frame );
99
97
if (nextFrame != null ) {
100
98
frame = nextFrame ;
101
99
count ++;
@@ -105,16 +103,16 @@ private static int getVariableDeclarationFrameDepth(MaterializedFrame topFrame,
105
103
}
106
104
}
107
105
108
- private static Frame getVariableDeclarationFrame (Frame topFrame , String variableName ) {
109
- Frame frame = topFrame ;
106
+ private static MaterializedFrame getVariableDeclarationFrame (MaterializedFrame topFrame , String variableName ) {
107
+ MaterializedFrame frame = topFrame ;
110
108
111
109
while (true ) {
112
110
final FrameSlot slot = getVariableSlot (frame , variableName );
113
111
if (slot != null ) {
114
112
return frame ;
115
113
}
116
114
117
- final Frame nextFrame = RubyArguments .getDeclarationFrame (frame );
115
+ final MaterializedFrame nextFrame = RubyArguments .getDeclarationFrame (frame );
118
116
if (nextFrame != null ) {
119
117
frame = nextFrame ;
120
118
} else {
@@ -123,7 +121,7 @@ private static Frame getVariableDeclarationFrame(Frame topFrame, String variable
123
121
}
124
122
}
125
123
126
- private static FrameSlot getVariableSlot (Frame frame , String variableName ) {
124
+ private static FrameSlot getVariableSlot (MaterializedFrame frame , String variableName ) {
127
125
final FrameDescriptor descriptor = frame .getFrameDescriptor ();
128
126
synchronized (descriptor ) {
129
127
return descriptor .findFrameSlot (variableName );
@@ -139,16 +137,16 @@ private static FrameSlot getVariableFrameSlotWrite(MaterializedFrame frame, Stri
139
137
}
140
138
141
139
@ TruffleBoundary
142
- private static ThreadAndFrameLocalStorage getStorageSearchingDeclarations (RubyContext context , Frame topFrame , String variableName ) {
143
- final Frame frame = getVariableDeclarationFrame (topFrame , variableName );
140
+ private static ThreadAndFrameLocalStorage getStorageSearchingDeclarations (RubyContext context , MaterializedFrame topFrame , String variableName ) {
141
+ final MaterializedFrame frame = getVariableDeclarationFrame (topFrame , variableName );
144
142
if (frame == null ) {
145
143
return null ;
146
144
}
147
145
FrameSlot slot = getVariableFrameSlotWrite (frame .materialize (), variableName );
148
146
return getStorageFromFrame (context , frame , slot , frame .getFrameDescriptor ().getDefaultValue (), true );
149
147
}
150
148
151
- private static ThreadAndFrameLocalStorage getStorageFromFrame (RubyContext context , Frame frame , FrameSlot slot , Object defaultValue , boolean add ) {
149
+ private static ThreadAndFrameLocalStorage getStorageFromFrame (RubyContext context , MaterializedFrame frame , FrameSlot slot , Object defaultValue , boolean add ) {
152
150
final Object previousMatchData = frame .getValue (slot );
153
151
154
152
if (previousMatchData == defaultValue ) { // Never written to
0 commit comments