Skip to content

Commit 0e4c8b3

Browse files
committed
Remove the old Translator
1 parent b851101 commit 0e4c8b3

22 files changed

+91
-5302
lines changed

src/main/java/org/truffleruby/builtins/CoreMethodNodeManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848
import org.truffleruby.language.methods.InternalMethod;
4949
import org.truffleruby.language.methods.SharedMethodInfo;
5050
import org.truffleruby.language.objects.SingletonClassNode;
51-
import org.truffleruby.parser.Translator;
5251

5352
import com.oracle.truffle.api.RootCallTarget;
5453
import com.oracle.truffle.api.TruffleOptions;
5554
import com.oracle.truffle.api.dsl.NodeFactory;
55+
import org.truffleruby.parser.YARPTranslator;
5656

5757
public final class CoreMethodNodeManager {
5858

@@ -369,7 +369,7 @@ public static RubyCoreMethodRootNode createCoreMethodRootNode(NodeFactory<? exte
369369
final boolean needsSelf = needsSelf(method);
370370

371371
if (needsSelf) {
372-
RubyNode readSelfNode = Translator.profileArgument(language, new ReadSelfNode());
372+
RubyNode readSelfNode = YARPTranslator.profileArgument(language, new ReadSelfNode());
373373
argumentsNodes[i++] = transformArgument(method, readSelfNode, 0);
374374
}
375375

@@ -378,7 +378,7 @@ public static RubyCoreMethodRootNode createCoreMethodRootNode(NodeFactory<? exte
378378
final int nArgs = required + optional;
379379

380380
for (int n = 0; n < nArgs; n++) {
381-
RubyNode readArgumentNode = Translator
381+
RubyNode readArgumentNode = YARPTranslator
382382
.profileArgument(language, new ReadPreArgumentNode(n, false, MissingArgumentBehavior.NOT_PROVIDED));
383383
argumentsNodes[i++] = transformArgument(method, readArgumentNode, n + 1);
384384
}

src/main/java/org/truffleruby/builtins/PrimitiveNodeConstructor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.truffleruby.language.RubyBaseNode;
1818
import org.truffleruby.language.RubyNode;
1919
import org.truffleruby.language.SourceIndexLength;
20-
import org.truffleruby.parser.Translator;
2120

2221
import com.oracle.truffle.api.dsl.NodeFactory;
2322
import com.oracle.truffle.api.source.Source;
@@ -60,7 +59,8 @@ public RubyNode createInvokePrimitiveNode(Source source, SourceIndexLength sourc
6059
}
6160

6261
final RubyNode primitiveNode = (RubyNode) CoreMethodNodeManager.createNodeFromFactory(factory, arguments);
63-
return Translator.withSourceSection(sourceSection, primitiveNode);
62+
primitiveNode.unsafeSetSourceSection(sourceSection);
63+
return primitiveNode;
6464
}
6565

6666
}

src/main/java/org/truffleruby/core/inlined/LambdaToProcNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
import org.truffleruby.language.RubyContextSourceNode;
1717
import org.truffleruby.language.RubyNode;
1818
import org.truffleruby.language.methods.BlockDefinitionNode;
19-
import org.truffleruby.parser.MethodTranslator;
19+
import org.truffleruby.parser.YARPBlockNodeTranslator;
2020

2121
/** Wraps a {@link BlockDefinitionNode} to convert the returned block (which should be a {@link ProcType#LAMBDA}) to be
2222
* a proc.
2323
*
2424
* <p>
2525
* When we encounter a function named {@code lambda} which is called with a block, we speculatively create a lambda call
26-
* target for that block in {@link MethodTranslator}. But if that method does not refer to {@code Kernel#lambda}, then a
27-
* proc call target is needed instead. This node is thus needed to "deoptimize" such cases. */
26+
* target for that block in {@link YARPBlockNodeTranslator}. But if that method does not refer to {@code Kernel#lambda},
27+
* then a proc call target is needed instead. This node is thus needed to "deoptimize" such cases. */
2828
public final class LambdaToProcNode extends RubyContextSourceNode {
2929

3030
/** A {@link BlockDefinitionNode}, possibly wrapped in a RubyNodeWrapper by instrumentation */

src/main/java/org/truffleruby/core/proc/ProcCallTargets.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
import org.truffleruby.language.RubyProcRootNode;
1919
import org.truffleruby.language.RubyRootNode;
2020
import org.truffleruby.language.methods.BlockDefinitionNode;
21-
import org.truffleruby.parser.MethodTranslator;
21+
import org.truffleruby.parser.YARPBlockNodeTranslator;
2222

2323
import java.util.function.Supplier;
2424

2525
/** Holds compiled call target for a {@link BlockDefinitionNode} (one instance per node). Each {@link RubyProc} created
2626
* by evaluating the definition has a reference to one of these. The point is that there are two possible call targets
27-
* for blocks: the proc and the lambda one. We only eagerly compile one in {@link MethodTranslator#compileBlockNode},
28-
* but we might need to later compile the other, given a {@link RubyProc} instance. This class thus acts as a shared
29-
* cache for the call targets. */
27+
* for blocks: the proc and the lambda one. We only eagerly compile one in
28+
* {@link YARPBlockNodeTranslator#compileBlockNode}, but we might need to later compile the other, given a
29+
* {@link RubyProc} instance. This class thus acts as a shared cache for the call targets. */
3030
public final class ProcCallTargets {
3131

3232
// At least one of those two call targets won't be null.

src/main/java/org/truffleruby/language/methods/BlockDefinitionNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.truffleruby.language.control.FrameOnStackMarker;
2424

2525
import com.oracle.truffle.api.frame.VirtualFrame;
26-
import org.truffleruby.parser.Translator;
26+
import org.truffleruby.parser.YARPTranslator;
2727

2828
/** Create a Ruby Proc to pass as a block to the called method. The literal block is represented as call targets and a
2929
* SharedMethodInfo. This is executed at the call site just before dispatch. */
@@ -41,7 +41,7 @@ public BlockDefinitionNode(
4141
ProcCallTargets callTargets,
4242
BreakID breakID,
4343
int frameOnStackMarkerSlot) {
44-
assert (type == ProcType.PROC) == (frameOnStackMarkerSlot != Translator.NO_FRAME_ON_STACK_MARKER);
44+
assert (type == ProcType.PROC) == (frameOnStackMarkerSlot != YARPTranslator.NO_FRAME_ON_STACK_MARKER);
4545
this.type = type;
4646
this.sharedMethodInfo = sharedMethodInfo;
4747
this.callTargets = callTargets;
@@ -62,7 +62,7 @@ RubyProc doBlockDefinition(VirtualFrame frame,
6262
@Cached GetSpecialVariableStorage readSpecialVariableStorageNode,
6363
@Cached WithoutVisibilityNode withoutVisibilityNode) {
6464
final FrameOnStackMarker frameOnStackMarker;
65-
if (frameOnStackMarkerSlot != Translator.NO_FRAME_ON_STACK_MARKER) {
65+
if (frameOnStackMarkerSlot != YARPTranslator.NO_FRAME_ON_STACK_MARKER) {
6666
frameOnStackMarker = (FrameOnStackMarker) frame.getObject(frameOnStackMarkerSlot);
6767
assert frameOnStackMarker != null;
6868
} else {

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

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)