Skip to content

Commit 52c2a86

Browse files
committed
[GR-20380] Make final fields of CoreLibrary public and remove getters.
PullRequest: truffleruby/1224
2 parents aa7f039 + f4fb62f commit 52c2a86

File tree

131 files changed

+467
-915
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+467
-915
lines changed

src/main/java/org/truffleruby/RubyContext.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ public RubyContext(RubyLanguage language, TruffleLanguage.Env env) {
202202
valueWrapperManager = new ValueWrapperManager(this);
203203
Metrics.printTime("after-create-core-library");
204204

205-
symbolTable = new SymbolTable(ropeCache, coreLibrary.getSymbolFactory(), this);
206-
rootLexicalScope = new LexicalScope(null, coreLibrary.getObjectClass());
205+
symbolTable = new SymbolTable(ropeCache, coreLibrary.symbolFactory, this);
206+
rootLexicalScope = new LexicalScope(null, coreLibrary.objectClass);
207207

208208
// Create objects that need core classes
209209

@@ -304,7 +304,7 @@ protected boolean patch(Env newEnv) {
304304

305305
Metrics.printTime("before-run-delayed-initialization");
306306
final Object toRunAtInit = Layouts.MODULE
307-
.getFields(coreLibrary.getTruffleBootModule())
307+
.getFields(coreLibrary.truffleBootModule)
308308
.getConstant("TO_RUN_AT_INIT")
309309
.getValue();
310310
for (Object proc : ArrayOperations.toIterable((DynamicObject) toRunAtInit)) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ protected Object findExportedSymbol(RubyContext context, String symbolName, bool
176176
}
177177

178178
Object implicit = context.send(
179-
context.getCoreLibrary().getTruffleInteropModule(),
179+
context.getCoreLibrary().truffleInteropModule,
180180
"lookup_symbol",
181181
context.getSymbolTable().getSymbol(symbolName));
182182
if (implicit == NotProvided.INSTANCE) {
@@ -277,7 +277,7 @@ protected Iterable<Scope> findLocalScopes(RubyContext context, Node node, Frame
277277

278278
@Override
279279
protected Iterable<Scope> findTopScopes(RubyContext context) {
280-
return Collections.singletonList(GlobalScope.getGlobalScope(context.getCoreLibrary().getGlobalVariables()));
280+
return Collections.singletonList(GlobalScope.getGlobalScope(context.getCoreLibrary().globalVariables));
281281
}
282282

283283
public String getTruffleLanguageHome() {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ private DynamicObject getModule(String fullName, boolean isClass) {
107107
DynamicObject module;
108108

109109
if (fullName.equals("main")) {
110-
module = getSingletonClass(context.getCoreLibrary().getMainObject());
110+
module = getSingletonClass(context.getCoreLibrary().mainObject);
111111
} else {
112-
module = context.getCoreLibrary().getObjectClass();
112+
module = context.getCoreLibrary().objectClass;
113113

114114
for (String moduleName : fullName.split("::")) {
115115
final ConstantLookupResult constant = ModuleOperations.lookupConstant(context, module, moduleName);
@@ -232,7 +232,7 @@ private static void addMethod(RubyContext context, DynamicObject module,
232232
private static SharedMethodInfo makeSharedMethodInfo(RubyContext context, LexicalScope lexicalScope,
233233
DynamicObject module, String name, Arity arity) {
234234
return new SharedMethodInfo(
235-
context.getCoreLibrary().getSourceSection(),
235+
context.getCoreLibrary().sourceSection,
236236
lexicalScope,
237237
arity,
238238
module,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Object execute(VirtualFrame frame) {
4646

4747
final Object self = RubyArguments.getSelf(frame);
4848
return toEnumWithSize.call(
49-
coreLibrary().getTruffleKernelOperationsModule(),
49+
coreLibrary().truffleKernelOperationsModule,
5050
"to_enum_with_size",
5151
self,
5252
methodName,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ protected DynamicObject toNative(DynamicObject string,
10331033
final NativeRope nativeRope = stringToNativeNode.executeToNative(string);
10341034

10351035
return allocateObjectNode
1036-
.allocate(coreLibrary().getTruffleFFIPointerClass(), nativeRope.getNativePointer());
1036+
.allocate(coreLibrary().truffleFFIPointerClass, nativeRope.getNativePointer());
10371037
}
10381038

10391039
}
@@ -1102,7 +1102,7 @@ protected DynamicObject classNew(DynamicObject superclass) {
11021102
}
11031103

11041104
DynamicObject klass = (DynamicObject) allocateNode
1105-
.call(getContext().getCoreLibrary().getClassClass(), "__allocate__");
1105+
.call(getContext().getCoreLibrary().classClass, "__allocate__");
11061106
return initializeClassNode.executeInitialize(klass, superclass, NotProvided.INSTANCE);
11071107
}
11081108

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected NotProvided unwrapUndef(long handle) {
7070
@Specialization(guards = "handle == NIL_HANDLE")
7171
protected DynamicObject unwrapNil(long handle,
7272
@CachedContext(RubyLanguage.class) RubyContext context) {
73-
return context.getCoreLibrary().getNil();
73+
return context.getCoreLibrary().nil;
7474
}
7575

7676
@Specialization(guards = "isTaggedLong(handle)")
@@ -132,7 +132,7 @@ protected ValueWrapper unwrapUndef(long handle) {
132132
@Specialization(guards = "handle == NIL_HANDLE")
133133
protected ValueWrapper unwrapNil(long handle,
134134
@CachedContext(RubyLanguage.class) RubyContext context) {
135-
return new ValueWrapper(context.getCoreLibrary().getNil(), NIL_HANDLE, null);
135+
return new ValueWrapper(context.getCoreLibrary().nil, NIL_HANDLE, null);
136136
}
137137

138138
@Specialization(guards = "isTaggedLong(handle)")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class ValueWrapperManager {
6565
public ValueWrapperManager(RubyContext context) {
6666
this.context = context;
6767
this.threadBlocks = ThreadLocal.withInitial((this::makeThreadData));
68-
nilWrapper = new ValueWrapper(context.getCoreLibrary().getNil(), NIL_HANDLE, null);
68+
nilWrapper = new ValueWrapper(context.getCoreLibrary().nil, NIL_HANDLE, null);
6969
}
7070

7171
public HandleThreadData makeThreadData() {

0 commit comments

Comments
 (0)