Skip to content

Commit d96ee38

Browse files
committed
Small changes to primitive implementations.
1 parent 8ebfd88 commit d96ee38

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/main/java/org/truffleruby/core/kernel/TruffleKernelNodes.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ public abstract static class GetSpecialVariableStorage extends RubyContextNode {
192192
assumptions = "frameAssumption")
193193
protected SpecialVariableStorage executeGetStorage(VirtualFrame frame,
194194
@Cached("frame.getFrameDescriptor()") FrameDescriptor descriptor,
195-
@Cached("frame.getFrameDescriptor().findFrameSlot(SPECIAL_VARIABLLE_STORAGE)") FrameSlot slot,
195+
@Cached("descriptor.findFrameSlot(SPECIAL_VARIABLLE_STORAGE)") FrameSlot slot,
196196
@Cached("declarationDescriptor(frame).getVersion()") Assumption frameAssumption) {
197197
Object storage = FrameUtil.getObjectSafe(frame, slot);
198-
if (storage == Nil.INSTANCE) {
198+
if (storage == nil) {
199199
CompilerDirectives.transferToInterpreterAndInvalidate();
200200
storage = new SpecialVariableStorage();
201201
frame.setObject(slot, storage);
@@ -209,18 +209,14 @@ protected SpecialVariableStorage executeGetStorage(VirtualFrame frame,
209209
limit = "1")
210210
protected SpecialVariableStorage executeGetStorageDeclarationFrame(VirtualFrame frame,
211211
@Cached("frame.getFrameDescriptor()") FrameDescriptor descriptor,
212-
@Cached("frame.getFrameDescriptor().findFrameSlot(SPECIAL_VARIABLLE_STORAGE)") FrameSlot slot,
212+
@Cached("descriptor.findFrameSlot(SPECIAL_VARIABLLE_STORAGE)") FrameSlot slot,
213213
@Cached("declarationDepth(frame)") int declarationFrameDepth,
214214
@Cached("declarationSlot(frame)") FrameSlot declarationFrameSlot,
215215
@Cached("declarationDescriptor(frame).getVersion()") Assumption frameAssumption) {
216-
VirtualFrame storageFrame = frame;
217-
218-
for (int i = 0; i < declarationFrameDepth; i++) {
219-
storageFrame = RubyArguments.getDeclarationFrame(storageFrame);
220-
}
216+
VirtualFrame storageFrame = RubyArguments.getDeclarationFrame(frame, declarationFrameDepth);
221217

222218
Object storage = FrameUtil.getObjectSafe(storageFrame, declarationFrameSlot);
223-
if (storage == Nil.INSTANCE) {
219+
if (storage == nil) {
224220
CompilerDirectives.transferToInterpreterAndInvalidate();
225221
storage = new SpecialVariableStorage();
226222
storageFrame.setObject(declarationFrameSlot, storage);
@@ -234,7 +230,7 @@ protected SpecialVariableStorage executeGetStorageDeclarationFrame(VirtualFrame
234230
limit = "1")
235231
protected SpecialVariableStorage executeGetStorageDeclarationFrame(VirtualFrame frame,
236232
@Cached("frame.getFrameDescriptor()") FrameDescriptor descriptor,
237-
@Cached("frame.getFrameDescriptor().findFrameSlot(SPECIAL_VARIABLLE_STORAGE)") FrameSlot slot,
233+
@Cached("descriptor.findFrameSlot(SPECIAL_VARIABLLE_STORAGE)") FrameSlot slot,
238234
@Cached("declarationSlot(frame)") FrameSlot declarationFrameSlot,
239235
@Cached("declarationDescriptor(frame).getVersion()") Assumption frameAssumption) {
240236
return getSlow(frame.materialize());
@@ -331,10 +327,7 @@ protected FrameSlot declarationSlot(VirtualFrame topFrame) {
331327
}
332328

333329
private static FrameSlot getVariableSlot(MaterializedFrame frame) {
334-
final FrameDescriptor descriptor = frame.getFrameDescriptor();
335-
synchronized (descriptor) {
336-
return descriptor.findFrameSlot(Layouts.SPECIAL_VARIABLLE_STORAGE);
337-
}
330+
return frame.getFrameDescriptor().findFrameSlot(Layouts.SPECIAL_VARIABLLE_STORAGE);
338331
}
339332

340333
public static GetSpecialVariableStorage create() {

0 commit comments

Comments
 (0)