18
18
import com .oracle .truffle .api .frame .MaterializedFrame ;
19
19
import com .oracle .truffle .api .frame .VirtualFrame ;
20
20
import com .oracle .truffle .api .object .DynamicObject ;
21
- import com .oracle .truffle .api .profiles .BranchProfile ;
22
21
import com .oracle .truffle .api .source .SourceSection ;
23
22
import org .truffleruby .Layouts ;
24
23
import org .truffleruby .builtins .CoreClass ;
28
27
import org .truffleruby .core .proc .ProcOperations ;
29
28
import org .truffleruby .core .proc .ProcType ;
30
29
import org .truffleruby .core .string .StringNodes ;
31
- import org .truffleruby .language .RubyNode ;
32
30
import org .truffleruby .language .RubyRootNode ;
33
- import org .truffleruby .language .SourceIndexLength ;
34
31
import org .truffleruby .language .Visibility ;
35
32
import org .truffleruby .language .arguments .ReadCallerFrameNode ;
36
33
import org .truffleruby .language .arguments .RubyArguments ;
41
38
import org .truffleruby .language .methods .SharedMethodInfo ;
42
39
import org .truffleruby .language .methods .SymbolProcNode ;
43
40
import org .truffleruby .parser .ArgumentDescriptor ;
44
- import org .truffleruby .parser .Translator ;
45
-
46
- import java .util .Arrays ;
47
41
48
42
@ CoreClass ("Symbol" )
49
43
public abstract class SymbolNodes {
@@ -122,7 +116,6 @@ public DynamicObject toProcUncached(VirtualFrame frame, DynamicObject symbol) {
122
116
protected DynamicObject createProc (DeclarationContext declarationContext , InternalMethod method , DynamicObject symbol ) {
123
117
final SourceSection sourceSection = getContext ().getCallStack ().getCallerFrameIgnoringSend ()
124
118
.getCallNode ().getEncapsulatingSourceSection ();
125
- final SourceIndexLength sourceIndexLength = new SourceIndexLength (sourceSection );
126
119
127
120
final SharedMethodInfo sharedMethodInfo = new SharedMethodInfo (
128
121
sourceSection ,
@@ -140,15 +133,17 @@ protected DynamicObject createProc(DeclarationContext declarationContext, Intern
140
133
// binding as this simplifies the logic elsewhere in the runtime.
141
134
final MaterializedFrame declarationFrame = Truffle .getRuntime ().createMaterializedFrame (args , coreLibrary ().getEmptyDescriptor ());
142
135
final RubyRootNode rootNode = new RubyRootNode (getContext (), sourceSection , new FrameDescriptor (nil ()), sharedMethodInfo ,
143
- Translator . sequence ( sourceIndexLength , Arrays . asList ( new CheckReceiverArgumentNode (), new SymbolProcNode (Layouts .SYMBOL .getString (symbol )) )));
136
+ new SymbolProcNode (Layouts .SYMBOL .getString (symbol )));
144
137
145
138
final CallTarget callTarget = Truffle .getRuntime ().createCallTarget (rootNode );
146
139
147
140
return ProcOperations .createRubyProc (
148
141
coreLibrary ().getProcFactory (),
149
142
ProcType .PROC ,
150
143
sharedMethodInfo ,
151
- callTarget , callTarget , declarationFrame ,
144
+ callTarget ,
145
+ callTarget ,
146
+ declarationFrame ,
152
147
method ,
153
148
null ,
154
149
null ,
@@ -171,29 +166,6 @@ protected FrameDescriptor getDescriptor(VirtualFrame frame) {
171
166
return frame .getFrameDescriptor ();
172
167
}
173
168
174
- /** Not using CheckArityNode as the message is different and arity is reported as -1. */
175
- private static class CheckReceiverArgumentNode extends RubyNode {
176
-
177
- private final BranchProfile noReceiverProfile = BranchProfile .create ();
178
-
179
- @ Override
180
- public void doExecuteVoid (VirtualFrame frame ) {
181
- final int given = RubyArguments .getArgumentsCount (frame );
182
-
183
- if (given == 0 ) {
184
- noReceiverProfile .enter ();
185
- throw new RaiseException (getContext (), coreExceptions ().argumentError ("no receiver given" , this ));
186
- }
187
- }
188
-
189
- @ Override
190
- public Object execute (VirtualFrame frame ) {
191
- doExecuteVoid (frame );
192
- return nil ();
193
- }
194
-
195
- }
196
-
197
169
}
198
170
199
171
@ CoreMethod (names = "to_s" )
0 commit comments