Skip to content

Commit 59f7505

Browse files
committed
Simplify and just use Map#put which returns the previous value
1 parent 9d931e1 commit 59f7505

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ public GlobalVariableStorage put(String name, DynamicObject getter, DynamicObjec
6363
public void alias(String oldName, String newName) {
6464
final GlobalVariableStorage storage = getStorage(oldName);
6565

66-
GlobalVariableStorage previousStorage;
67-
do {
68-
previousStorage = variables.get(newName);
69-
} while (!ConcurrentOperations.replace(variables, newName, previousStorage, storage));
70-
66+
final GlobalVariableStorage previousStorage = variables.put(newName, storage);
7167
if (previousStorage != null) {
7268
previousStorage.getValidAssumption().invalidate();
7369
}

0 commit comments

Comments
 (0)