Skip to content

Commit be521f1

Browse files
committed
BlockFrameDescriptorInfo -> BlockDescriptorInfo
* The Frame part is redundant and makes the class name quite long.
1 parent bf9900c commit be521f1

File tree

9 files changed

+29
-29
lines changed

9 files changed

+29
-29
lines changed

src/main/java/org/truffleruby/RubyLanguage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
import org.truffleruby.language.objects.classvariables.ClassVariableStorage;
111111
import org.truffleruby.language.threadlocal.SpecialVariableStorage;
112112
import org.truffleruby.options.LanguageOptions;
113-
import org.truffleruby.parser.BlockFrameDescriptorInfo;
113+
import org.truffleruby.parser.BlockDescriptorInfo;
114114
import org.truffleruby.parser.ParserContext;
115115
import org.truffleruby.parser.ParsingParameters;
116116
import org.truffleruby.parser.RubySource;
@@ -190,7 +190,7 @@ public final class RubyLanguage extends TruffleLanguage<RubyContext> {
190190

191191
/** This is a truly empty frame descriptor and should only by dummy root nodes which require no variables. Any other
192192
* root nodes should should use either {@link TranslatorEnvironment#newFrameDescriptorBuilderForMethod()} or
193-
* {@link TranslatorEnvironment#newFrameDescriptorBuilderForBlock(BlockFrameDescriptorInfo)}. */
193+
* {@link TranslatorEnvironment#newFrameDescriptorBuilderForBlock(BlockDescriptorInfo)}. */
194194
public static final FrameDescriptor EMPTY_FRAME_DESCRIPTOR = new FrameDescriptor(nil);
195195

196196
private RubyThread getOrCreateForeignThread(RubyContext context, Thread thread) {

src/main/java/org/truffleruby/core/binding/BindingNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
import com.oracle.truffle.api.source.SourceSection;
5858
import org.truffleruby.language.locals.WriteFrameSlotNode;
5959
import org.truffleruby.language.locals.WriteFrameSlotNodeGen;
60-
import org.truffleruby.parser.BlockFrameDescriptorInfo;
60+
import org.truffleruby.parser.BlockDescriptorInfo;
6161
import org.truffleruby.parser.TranslatorEnvironment;
6262

6363
@CoreModule(value = "Binding", isClass = true)
@@ -80,7 +80,7 @@ public static RubyBinding createBinding(RubyContext context, RubyLanguage langua
8080
@TruffleBoundary
8181
public static FrameDescriptor newFrameDescriptor(RubyBinding binding) {
8282
FrameDescriptor parentDescriptor = binding.getFrame().getFrameDescriptor();
83-
var ref = new BlockFrameDescriptorInfo(parentDescriptor);
83+
var ref = new BlockDescriptorInfo(parentDescriptor);
8484
return TranslatorEnvironment.newFrameDescriptorBuilderForBlock(ref).build();
8585
}
8686

@@ -90,7 +90,7 @@ public static FrameDescriptor newFrameDescriptor(RubyBinding binding) {
9090
public static FrameDescriptor newFrameDescriptor(FrameDescriptor parentDescriptor, String name) {
9191
assert name != null && !name.isEmpty();
9292

93-
var ref = new BlockFrameDescriptorInfo(parentDescriptor);
93+
var ref = new BlockDescriptorInfo(parentDescriptor);
9494
var builder = TranslatorEnvironment.newFrameDescriptorBuilderForBlock(ref);
9595
int index = builder.addSlot(FrameSlotKind.Illegal, name, null);
9696
if (index != NEW_VAR_INDEX) {

src/main/java/org/truffleruby/debug/DebugHelpers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.truffleruby.language.arguments.RubyArguments;
2323
import org.truffleruby.language.loader.CodeLoader;
2424
import org.truffleruby.language.methods.DeclarationContext;
25-
import org.truffleruby.parser.BlockFrameDescriptorInfo;
25+
import org.truffleruby.parser.BlockDescriptorInfo;
2626
import org.truffleruby.parser.ParserContext;
2727
import org.truffleruby.parser.RubySource;
2828
import org.truffleruby.parser.TranslatorEnvironment;
@@ -68,7 +68,7 @@ public static Object eval(RubyContext context, String code, Object... arguments)
6868

6969

7070
var builder = TranslatorEnvironment
71-
.newFrameDescriptorBuilderForBlock(new BlockFrameDescriptorInfo(currentFrameDescriptor));
71+
.newFrameDescriptorBuilderForBlock(new BlockDescriptorInfo(currentFrameDescriptor));
7272

7373
for (int i = 0; i < nArgs; i++) {
7474
final Object identifier = arguments[i * 2];

src/main/java/org/truffleruby/language/RubyRootNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import com.oracle.truffle.api.frame.VirtualFrame;
2626
import com.oracle.truffle.api.source.SourceSection;
2727
import org.truffleruby.annotations.Split;
28-
import org.truffleruby.parser.BlockFrameDescriptorInfo;
28+
import org.truffleruby.parser.BlockDescriptorInfo;
2929

3030
import java.util.ArrayList;
3131
import java.util.IdentityHashMap;
@@ -83,8 +83,8 @@ public Object execute(VirtualFrame frame) {
8383
@Override
8484
public FrameDescriptor getParentFrameDescriptor() {
8585
var info = getFrameDescriptor().getInfo();
86-
if (info instanceof BlockFrameDescriptorInfo) {
87-
return ((BlockFrameDescriptorInfo) info).getParentDescriptor();
86+
if (info instanceof BlockDescriptorInfo) {
87+
return ((BlockDescriptorInfo) info).getParentDescriptor();
8888
} else {
8989
return null;
9090
}

src/main/java/org/truffleruby/language/SpecialVariablesSendingNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.truffleruby.language.arguments.ReadCallerVariablesNode;
1818

1919
import org.truffleruby.language.threadlocal.SpecialVariableStorage;
20-
import org.truffleruby.parser.BlockFrameDescriptorInfo;
20+
import org.truffleruby.parser.BlockDescriptorInfo;
2121

2222
/** Some Ruby methods need access to the caller special variables: see usages of {@link ReadCallerVariablesNode}. This
2323
* is used for methods which need to access the last regexp MatchData or the last IO line.
@@ -49,8 +49,8 @@ protected Assumption getSpecialVariableAssumption(Frame frame) {
4949

5050
if (SpecialVariableStorage.hasSpecialVariableAssumption(descriptor)) {
5151
return SpecialVariableStorage.getAssumption(descriptor);
52-
} else if (descriptor.getInfo() instanceof BlockFrameDescriptorInfo blockFrameDescriptorInfo) {
53-
return blockFrameDescriptorInfo.getSpecialVariableAssumption();
52+
} else if (descriptor.getInfo() instanceof BlockDescriptorInfo blockDescriptorInfo) {
53+
return blockDescriptorInfo.getSpecialVariableAssumption();
5454
} else {
5555
return Assumption.ALWAYS_VALID;
5656
}

src/main/java/org/truffleruby/language/locals/ReadDeclarationVariableNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import com.oracle.truffle.api.CompilerDirectives;
1717
import com.oracle.truffle.api.frame.VirtualFrame;
18-
import org.truffleruby.parser.BlockFrameDescriptorInfo;
18+
import org.truffleruby.parser.BlockDescriptorInfo;
1919

2020
public final class ReadDeclarationVariableNode extends ReadLocalNode {
2121

@@ -57,7 +57,7 @@ public WriteLocalNode makeWriteNode(RubyNode rhs) {
5757

5858
@Override
5959
protected String getVariableName() {
60-
var descriptor = BlockFrameDescriptorInfo.getDeclarationFrameDescriptor(
60+
var descriptor = BlockDescriptorInfo.getDeclarationFrameDescriptor(
6161
getRootNode().getFrameDescriptor(), frameDepth);
6262
return descriptor.getSlotName(frameSlot).toString();
6363
}

src/main/java/org/truffleruby/language/locals/WriteDeclarationVariableNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import com.oracle.truffle.api.CompilerDirectives;
1818
import com.oracle.truffle.api.frame.VirtualFrame;
19-
import org.truffleruby.parser.BlockFrameDescriptorInfo;
19+
import org.truffleruby.parser.BlockDescriptorInfo;
2020

2121
public final class WriteDeclarationVariableNode extends WriteLocalNode {
2222

@@ -60,7 +60,7 @@ public AssignableNode cloneUninitializedAssignable() {
6060

6161
@Override
6262
protected String getVariableName() {
63-
var descriptor = BlockFrameDescriptorInfo.getDeclarationFrameDescriptor(
63+
var descriptor = BlockDescriptorInfo.getDeclarationFrameDescriptor(
6464
getRootNode().getFrameDescriptor(), frameDepth);
6565
return descriptor.getSlotName(frameSlot).toString();
6666
}

src/main/java/org/truffleruby/parser/BlockFrameDescriptorInfo.java renamed to src/main/java/org/truffleruby/parser/BlockDescriptorInfo.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,34 @@
1717

1818
/** This is the {@link FrameDescriptor#getInfo() descriptor info} for blocks. The descriptor info for methods is an
1919
* {@link SpecialVariableStorage#getAssumption(FrameDescriptor) Assumption}. */
20-
public final class BlockFrameDescriptorInfo {
20+
public final class BlockDescriptorInfo {
2121

2222
@ExplodeLoop
2323
public static FrameDescriptor getDeclarationFrameDescriptor(FrameDescriptor topDescriptor, int depth) {
2424
assert depth > 0;
2525
FrameDescriptor descriptor = topDescriptor;
2626
for (int i = 0; i < depth; i++) {
27-
descriptor = ((BlockFrameDescriptorInfo) descriptor.getInfo()).getParentDescriptor();
27+
descriptor = ((BlockDescriptorInfo) descriptor.getInfo()).getParentDescriptor();
2828
}
2929
return descriptor;
3030
}
3131

3232
@CompilationFinal private FrameDescriptor parentDescriptor;
3333
private final Assumption specialVariableAssumption;
3434

35-
public BlockFrameDescriptorInfo(Assumption specialVariableAssumption) {
35+
public BlockDescriptorInfo(Assumption specialVariableAssumption) {
3636
assert SpecialVariableStorage.isSpecialVariableAssumption(specialVariableAssumption);
3737
this.specialVariableAssumption = specialVariableAssumption;
3838
}
3939

40-
public BlockFrameDescriptorInfo(FrameDescriptor parentDescriptor) {
40+
public BlockDescriptorInfo(FrameDescriptor parentDescriptor) {
4141
this.parentDescriptor = parentDescriptor;
4242
this.specialVariableAssumption = getSpecialVariableAssumptionFromDescriptor(parentDescriptor);
4343
}
4444

4545
private Assumption getSpecialVariableAssumptionFromDescriptor(FrameDescriptor descriptor) {
46-
if (descriptor.getInfo() instanceof BlockFrameDescriptorInfo blockFrameDescriptorInfo) {
47-
return blockFrameDescriptorInfo.getSpecialVariableAssumption();
46+
if (descriptor.getInfo() instanceof BlockDescriptorInfo blockDescriptorInfo) {
47+
return blockDescriptorInfo.getSpecialVariableAssumption();
4848
} else {
4949
return SpecialVariableStorage.getAssumption(descriptor);
5050
}

src/main/java/org/truffleruby/parser/TranslatorEnvironment.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public final class TranslatorEnvironment {
4949
/** The descriptor info is shared for all blocks at the same level (i.e., for TranslatorEnvironment direct
5050
* children), in order to save footprint. It is therefore created in the parent TranslatorEnvironment of those
5151
* blocks using that descriptor info. */
52-
private final BlockFrameDescriptorInfo descriptorInfoForChildren;
52+
private final BlockDescriptorInfo descriptorInfoForChildren;
5353

5454
private final List<Integer> flipFlopStates = new ArrayList<>();
5555

@@ -85,18 +85,18 @@ public TranslatorEnvironment(
8585

8686
if (descriptor == null) {
8787
if (blockDepth > 0) {
88-
BlockFrameDescriptorInfo descriptorInfo = Objects.requireNonNull(parent.descriptorInfoForChildren);
88+
BlockDescriptorInfo descriptorInfo = Objects.requireNonNull(parent.descriptorInfoForChildren);
8989
this.frameDescriptorBuilder = newFrameDescriptorBuilderForBlock(descriptorInfo);
90-
this.descriptorInfoForChildren = new BlockFrameDescriptorInfo(
90+
this.descriptorInfoForChildren = new BlockDescriptorInfo(
9191
descriptorInfo.getSpecialVariableAssumption());
9292
} else {
9393
var specialVariableAssumption = createSpecialVariableAssumption();
9494
this.frameDescriptorBuilder = newFrameDescriptorBuilderForMethod(specialVariableAssumption);
95-
this.descriptorInfoForChildren = new BlockFrameDescriptorInfo(specialVariableAssumption);
95+
this.descriptorInfoForChildren = new BlockDescriptorInfo(specialVariableAssumption);
9696
}
9797
} else {
9898
this.frameDescriptor = descriptor;
99-
this.descriptorInfoForChildren = new BlockFrameDescriptorInfo(descriptor);
99+
this.descriptorInfoForChildren = new BlockDescriptorInfo(descriptor);
100100

101101
assert descriptor.getNumberOfAuxiliarySlots() == 0;
102102
int slots = descriptor.getNumberOfSlots();
@@ -151,7 +151,7 @@ public boolean isTopLevelObjectScope() {
151151
}
152152

153153
// region frame descriptor
154-
public static FrameDescriptor.Builder newFrameDescriptorBuilderForBlock(BlockFrameDescriptorInfo descriptorInfo) {
154+
public static FrameDescriptor.Builder newFrameDescriptorBuilderForBlock(BlockDescriptorInfo descriptorInfo) {
155155
var builder = FrameDescriptor.newBuilder().defaultValue(Nil.INSTANCE);
156156
builder.info(Objects.requireNonNull(descriptorInfo));
157157

0 commit comments

Comments
 (0)