Skip to content

Commit a9dc560

Browse files
committed
Reduce usages of RubyLanguage#getCurrentLanguage()
1 parent 7afe792 commit a9dc560

23 files changed

+30
-50
lines changed

src/main/java/org/truffleruby/cext/UnwrapNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
1919
import com.oracle.truffle.api.nodes.ExplodeLoop;
2020
import com.oracle.truffle.api.profiles.LoopConditionProfile;
21-
import org.truffleruby.RubyLanguage;
2221
import org.truffleruby.cext.UnwrapNodeGen.NativeToWrapperNodeGen;
2322
import org.truffleruby.cext.UnwrapNodeGen.ToWrapperNodeGen;
2423
import org.truffleruby.cext.UnwrapNodeGen.UnwrapNativeNodeGen;
@@ -287,6 +286,6 @@ protected Object unwrapGeneric(Object value,
287286
}
288287

289288
protected int getCacheLimit() {
290-
return RubyLanguage.getCurrentLanguage().options.DISPATCH_CACHE;
289+
return getLanguage().options.DISPATCH_CACHE;
291290
}
292291
}

src/main/java/org/truffleruby/cext/ValueWrapperManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ protected static Thread currentJavaThread(ValueWrapper wrapper) {
347347
}
348348

349349
public int getCacheLimit() {
350-
return RubyLanguage.getCurrentLanguage().options.THREAD_CACHE;
350+
return getLanguage().options.THREAD_CACHE;
351351
}
352352

353353
public static GetHandleBlockHolderNode create() {

src/main/java/org/truffleruby/core/MarkingServiceNodes.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import java.util.ArrayList;
1313

14-
import org.truffleruby.RubyLanguage;
1514
import org.truffleruby.core.MarkingService.MarkerThreadLocalData;
1615
import org.truffleruby.language.RubyBaseNode;
1716

@@ -70,7 +69,7 @@ protected static Thread currentJavaThread(Object dynamicParameter) {
7069
}
7170

7271
public int getCacheLimit() {
73-
return RubyLanguage.getCurrentLanguage().options.THREAD_CACHE;
72+
return getLanguage().options.THREAD_CACHE;
7473
}
7574

7675
public static GetMarkerThreadLocalDataNode create() {

src/main/java/org/truffleruby/core/basicobject/BasicObjectNodes.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import com.oracle.truffle.api.dsl.Fallback;
1414
import com.oracle.truffle.api.object.Shape;
1515
import org.truffleruby.Layouts;
16-
import org.truffleruby.RubyLanguage;
1716
import org.truffleruby.builtins.CoreMethod;
1817
import org.truffleruby.builtins.CoreMethodArrayArgumentsNode;
1918
import org.truffleruby.builtins.CoreModule;
@@ -273,7 +272,7 @@ private int hashCode(Object object) {
273272
}
274273

275274
protected int getCacheLimit() {
276-
return RubyLanguage.getCurrentLanguage().options.INSTANCE_VARIABLE_CACHE;
275+
return getLanguage().options.INSTANCE_VARIABLE_CACHE;
277276
}
278277
}
279278

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ protected boolean localVariableDefinedUncached(RubyBinding binding, String name)
192192
}
193193

194194
protected int getCacheLimit() {
195-
return RubyLanguage.getCurrentLanguage().options.BINDING_LOCAL_VARIABLE_CACHE;
195+
return getLanguage().options.BINDING_LOCAL_VARIABLE_CACHE;
196196
}
197197

198198
}
@@ -240,7 +240,7 @@ protected Object localVariableDefinedLastLine(RubyBinding binding, String name)
240240
}
241241

242242
protected int getCacheLimit() {
243-
return RubyLanguage.getCurrentLanguage().options.BINDING_LOCAL_VARIABLE_CACHE;
243+
return getLanguage().options.BINDING_LOCAL_VARIABLE_CACHE;
244244
}
245245

246246
}
@@ -286,7 +286,7 @@ protected Object localVariableGetLastLine(RubyBinding binding, String name) {
286286
}
287287

288288
protected int getCacheLimit() {
289-
return RubyLanguage.getCurrentLanguage().options.BINDING_LOCAL_VARIABLE_CACHE;
289+
return getLanguage().options.BINDING_LOCAL_VARIABLE_CACHE;
290290
}
291291

292292
}
@@ -381,7 +381,7 @@ protected WriteFrameSlotNode createWriteNode(FrameSlotAndDepth frameSlot) {
381381
}
382382

383383
protected int getCacheLimit() {
384-
return RubyLanguage.getCurrentLanguage().options.BINDING_LOCAL_VARIABLE_CACHE;
384+
return getLanguage().options.BINDING_LOCAL_VARIABLE_CACHE;
385385
}
386386
}
387387

src/main/java/org/truffleruby/core/cast/BooleanCastNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
package org.truffleruby.core.cast;
1111

12-
import org.truffleruby.RubyLanguage;
1312
import org.truffleruby.language.ImmutableRubyObject;
1413
import org.truffleruby.language.Nil;
1514
import org.truffleruby.language.RubyBaseNode;
@@ -102,6 +101,6 @@ protected boolean doForeignObject(Object object,
102101
}
103102

104103
protected int getCacheLimit() {
105-
return RubyLanguage.getCurrentLanguage().options.METHOD_LOOKUP_CACHE;
104+
return getLanguage().options.METHOD_LOOKUP_CACHE;
106105
}
107106
}

src/main/java/org/truffleruby/core/cast/ToSymbolNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import com.oracle.truffle.api.dsl.Cached;
1313
import com.oracle.truffle.api.library.CachedLibrary;
14-
import org.truffleruby.RubyLanguage;
1514
import org.truffleruby.core.encoding.RubyEncoding;
1615
import org.truffleruby.core.rope.Rope;
1716
import org.truffleruby.core.rope.RopeNodes;
@@ -74,6 +73,6 @@ protected RubySymbol toSymbolRubyStringUncached(Object str,
7473
}
7574

7675
protected int getCacheLimit() {
77-
return RubyLanguage.getCurrentLanguage().options.DISPATCH_CACHE;
76+
return getLanguage().options.DISPATCH_CACHE;
7877
}
7978
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.oracle.truffle.api.frame.Frame;
2121
import com.oracle.truffle.api.utilities.AssumedValue;
2222
import org.truffleruby.RubyContext;
23-
import org.truffleruby.RubyLanguage;
2423
import org.truffleruby.builtins.CoreMethod;
2524
import org.truffleruby.builtins.CoreMethodArrayArgumentsNode;
2625
import org.truffleruby.builtins.CoreMethodNode;
@@ -920,7 +919,7 @@ protected static boolean assignsNewUserVariables(FrameDescriptor descriptor) {
920919
}
921920

922921
protected int getCacheLimit() {
923-
return RubyLanguage.getCurrentLanguage().options.EVAL_CACHE;
922+
return getLanguage().options.EVAL_CACHE;
924923
}
925924
}
926925

src/main/java/org/truffleruby/interop/ForeignToRubyArgumentsNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
package org.truffleruby.interop;
1111

12-
import org.truffleruby.RubyLanguage;
1312
import org.truffleruby.language.RubyBaseNode;
1413

1514
import com.oracle.truffle.api.dsl.Cached;
@@ -63,7 +62,7 @@ protected static ForeignToRubyNode[] foreignToRubyNodes(int size) {
6362
}
6463

6564
protected int getLimit() {
66-
return RubyLanguage.getCurrentLanguage().options.INTEROP_CONVERT_CACHE;
65+
return getLanguage().options.INTEROP_CONVERT_CACHE;
6766
}
6867

6968
}

src/main/java/org/truffleruby/interop/FromJavaStringNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.truffleruby.interop;
1111

1212
import org.jcodings.specific.UTF8Encoding;
13-
import org.truffleruby.RubyLanguage;
1413
import org.truffleruby.core.encoding.Encodings;
1514
import org.truffleruby.core.rope.CodeRange;
1615
import org.truffleruby.core.rope.Rope;
@@ -58,7 +57,7 @@ protected Rope getRope(String value) {
5857
}
5958

6059
protected int getLimit() {
61-
return RubyLanguage.getCurrentLanguage().options.INTEROP_CONVERT_CACHE;
60+
return getLanguage().options.INTEROP_CONVERT_CACHE;
6261
}
6362

6463
}

0 commit comments

Comments
 (0)