Skip to content

Commit 350e8d3

Browse files
Rename STATIC_SUBSTITUTIONS to GLOBAL_SUBSTITUTIONS
The term "static" in susbstitution is a bit confusing because in this case it's completely unrelated to the "static" keyword for methods.
1 parent 4a28b0b commit 350e8d3

File tree

1 file changed

+10
-10
lines changed
  • espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions

1 file changed

+10
-10
lines changed

espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Substitutions.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
/**
5454
* Substitutions/intrinsics for Espresso.
5555
* <p>
56-
* Some substitutions are statically defined, others runtime-dependent. The static ones are loaded
57-
* via {@link ServiceLoader}. Iterating over the collection in this class allows to register them
56+
* Some substitutions are globally defined, others runtime-dependent. The global ones are loaded via
57+
* {@link ServiceLoader}. Iterating over the collection in this class allows to register them
5858
* directly, and assign to each of them a node, which will dispatch them directly, without the need
5959
* for reflection. In practice, this allows inlining.
6060
* <p>
@@ -136,7 +136,7 @@ default EspressoRootNode createNodeIfValid(Method method) {
136136
}
137137
}
138138

139-
private static final EconomicMap<MethodKey, JavaSubstitution.Factory> STATIC_SUBSTITUTIONS = EconomicMap.create();
139+
private static final EconomicMap<MethodKey, JavaSubstitution.Factory> GLOBAL_SUBSTITUTIONS = EconomicMap.create();
140140

141141
private final ConcurrentHashMap<MethodKey, EspressoRootNodeFactory> runtimeSubstitutions = new ConcurrentHashMap<>();
142142

@@ -176,17 +176,17 @@ private static void registerStaticSubstitution(JavaSubstitution.Factory substitu
176176

177177
private static void registerStaticSubstitution(Symbol<Type> type, Symbol<Name> methodName, Symbol<Signature> signature, JavaSubstitution.Factory factory, boolean throwIfPresent) {
178178
MethodKey key = new MethodKey(type, methodName, signature, !factory.hasReceiver());
179-
if (throwIfPresent && STATIC_SUBSTITUTIONS.containsKey(key)) {
179+
if (throwIfPresent && GLOBAL_SUBSTITUTIONS.containsKey(key)) {
180180
throw EspressoError.shouldNotReachHere("substitution already registered" + key);
181181
}
182-
STATIC_SUBSTITUTIONS.put(key, factory);
182+
GLOBAL_SUBSTITUTIONS.put(key, factory);
183183
}
184184

185185
public void registerRuntimeSubstitution(Symbol<Type> type, Symbol<Name> methodName, Symbol<Signature> signature, boolean isStatic, EspressoRootNodeFactory factory, boolean throwIfPresent) {
186186
MethodKey key = new MethodKey(type, methodName, signature, isStatic);
187187

188-
if (STATIC_SUBSTITUTIONS.containsKey(key)) {
189-
getLogger().log(Level.FINE, "Runtime substitution shadowed by static one: " + key);
188+
if (GLOBAL_SUBSTITUTIONS.containsKey(key)) {
189+
getLogger().log(Level.FINE, "Runtime substitution shadowed by global one: " + key);
190190
}
191191

192192
if (throwIfPresent && runtimeSubstitutions.containsKey(key)) {
@@ -201,7 +201,7 @@ public void removeRuntimeSubstitution(Method method) {
201201
}
202202

203203
public static JavaSubstitution.Factory lookupSubstitution(Method m) {
204-
return STATIC_SUBSTITUTIONS.get(getMethodKey(m));
204+
return GLOBAL_SUBSTITUTIONS.get(getMethodKey(m));
205205
}
206206

207207
/**
@@ -211,7 +211,7 @@ public static JavaSubstitution.Factory lookupSubstitution(Method m) {
211211
public EspressoRootNode get(Method method) {
212212
// Look into the static substitutions.
213213
MethodKey key = getMethodKey(method);
214-
JavaSubstitution.Factory staticSubstitutionFactory = STATIC_SUBSTITUTIONS.get(key);
214+
JavaSubstitution.Factory staticSubstitutionFactory = GLOBAL_SUBSTITUTIONS.get(key);
215215
if (staticSubstitutionFactory != null && staticSubstitutionFactory.isValidFor(method.getLanguage())) {
216216
EspressoRootNode root = createRootNodeFromSubstitution(method, staticSubstitutionFactory);
217217
if (root != null) {
@@ -250,6 +250,6 @@ public String get() {
250250
@TruffleBoundary
251251
public boolean hasSubstitutionFor(Method method) {
252252
MethodKey key = getMethodKey(method);
253-
return STATIC_SUBSTITUTIONS.containsKey(key) || runtimeSubstitutions.containsKey(key);
253+
return GLOBAL_SUBSTITUTIONS.containsKey(key) || runtimeSubstitutions.containsKey(key);
254254
}
255255
}

0 commit comments

Comments
 (0)