Skip to content

Commit 9d931e1

Browse files
committed
It is no longer needed to maintain a map of aliases for global variables
* Since the GlobalVariableStorage can be invalidated and looked up again.
1 parent 307e8c5 commit 9d931e1

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/main/java/org/truffleruby/language/globals/GlobalVariables.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,11 @@ public class GlobalVariables {
2424

2525
private final DynamicObject defaultValue;
2626
private final ConcurrentMap<String, GlobalVariableStorage> variables = new ConcurrentHashMap<>();
27-
private final Map<String, String> aliases = new ConcurrentHashMap<>();
2827

2928
public GlobalVariables(DynamicObject defaultValue) {
3029
this.defaultValue = defaultValue;
3130
}
3231

33-
private String getOriginalName(String name) {
34-
return aliases.getOrDefault(name, name);
35-
}
36-
3732
/**
3833
* The returned storage must be checked if it is still valid with
3934
* {@link GlobalVariableStorage#getValidAssumption()}. A storage
@@ -42,8 +37,7 @@ private String getOriginalName(String name) {
4237
*/
4338
@TruffleBoundary
4439
public GlobalVariableStorage getStorage(String name) {
45-
final String originalName = getOriginalName(name);
46-
return ConcurrentOperations.getOrCompute(variables, originalName,
40+
return ConcurrentOperations.getOrCompute(variables, name,
4741
k -> new GlobalVariableStorage(defaultValue, null, null, null));
4842
}
4943

@@ -67,10 +61,6 @@ public GlobalVariableStorage put(String name, DynamicObject getter, DynamicObjec
6761

6862
@TruffleBoundary
6963
public void alias(String oldName, String newName) {
70-
// Record an alias of an alias against the original.
71-
oldName = getOriginalName(oldName);
72-
aliases.put(newName, oldName);
73-
7464
final GlobalVariableStorage storage = getStorage(oldName);
7565

7666
GlobalVariableStorage previousStorage;

0 commit comments

Comments
 (0)