Skip to content

Commit 82b2918

Browse files
committed
Truffle.getRuntime().createAssumption() -> Assumption.create()
* It's much shorter.
1 parent 4d044c5 commit 82b2918

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public static final class ThreadLocalState {
230230
private final LanguageArray<Assumption> globalVariableNeverAliasedAssumptions = new LanguageArray<>(
231231
globalVariablesMap,
232232
Assumption[]::new,
233-
() -> Truffle.getRuntime().createAssumption("global variable was never aliased: "));
233+
() -> Assumption.create("global variable was never aliased: "));
234234

235235
private static final RubyObjectType objectType = new RubyObjectType();
236236

src/main/java/org/truffleruby/core/inlined/CoreMethodAssumptions.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.util.function.Consumer;
1515

1616
import com.oracle.truffle.api.Assumption;
17-
import com.oracle.truffle.api.Truffle;
1817

1918
import org.truffleruby.RubyLanguage;
2019
import org.truffleruby.core.CoreLibrary;
@@ -139,7 +138,7 @@ public interface ContextGetClass {
139138
}
140139

141140
private Assumption registerAssumption(ContextGetClass classGetter, String className, String methodName) {
142-
final Assumption assumption = Truffle.getRuntime().createAssumption("inlined " + className + "#" + methodName);
141+
final Assumption assumption = Assumption.create("inlined " + className + "#" + methodName);
143142
classAssumptionsToRegister.add((cl) -> classGetter.apply(cl).fields.registerAssumption(methodName, assumption));
144143
return assumption;
145144
}

src/main/java/org/truffleruby/core/method/MethodEntry.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.truffleruby.language.methods.InternalMethod;
1414

1515
import com.oracle.truffle.api.Assumption;
16-
import com.oracle.truffle.api.Truffle;
1716
import org.truffleruby.language.methods.SharedMethodInfo;
1817

1918
public final class MethodEntry {
@@ -23,12 +22,12 @@ public final class MethodEntry {
2322

2423
public MethodEntry(InternalMethod method) {
2524
assert method != null;
26-
this.assumption = Truffle.getRuntime().createAssumption("method is not overridden:");
25+
this.assumption = Assumption.create("method is not overridden:");
2726
this.method = method;
2827
}
2928

3029
public MethodEntry() {
31-
this.assumption = Truffle.getRuntime().createAssumption("method is not defined:");
30+
this.assumption = Assumption.create("method is not defined:");
3231
this.method = null;
3332
}
3433

src/main/java/org/truffleruby/language/constants/ConstantEntry.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package org.truffleruby.language.constants;
1111

1212
import com.oracle.truffle.api.Assumption;
13-
import com.oracle.truffle.api.Truffle;
1413
import org.truffleruby.core.module.RubyModule;
1514
import org.truffleruby.language.RubyConstant;
1615
import org.truffleruby.language.methods.SharedMethodInfo;
@@ -21,12 +20,12 @@ public class ConstantEntry {
2120
private final RubyConstant constant;
2221

2322
public ConstantEntry(RubyConstant constant) {
24-
this.assumption = Truffle.getRuntime().createAssumption("constant is not overridden:");
23+
this.assumption = Assumption.create("constant is not overridden:");
2524
this.constant = constant;
2625
}
2726

2827
public ConstantEntry() {
29-
this.assumption = Truffle.getRuntime().createAssumption("constant is not defined:");
28+
this.assumption = Assumption.create("constant is not defined:");
3029
this.constant = null;
3130
}
3231

src/main/java/org/truffleruby/parser/TranslatorEnvironment.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import java.util.concurrent.atomic.AtomicInteger;
1616

1717
import com.oracle.truffle.api.Assumption;
18-
import com.oracle.truffle.api.Truffle;
1918
import org.truffleruby.Layouts;
2019
import com.oracle.truffle.api.CompilerDirectives;
2120
import com.oracle.truffle.api.frame.FrameSlotKind;
@@ -159,8 +158,8 @@ public static FrameDescriptor.Builder newFrameDescriptorBuilder(ParentFrameDescr
159158
// We need to access this Assumption from the FrameDescriptor,
160159
// and there is no way to get a RootNode from a FrameDescriptor, so we store it in the descriptor info.
161160
// We do not store it as slot info for footprint, to avoid needing an info array per FrameDescriptor.
162-
final Assumption doesNotNeedSpecialVariableStorageAssumption = Truffle.getRuntime()
163-
.createAssumption(SpecialVariableStorage.ASSUMPTION_NAME);
161+
final Assumption doesNotNeedSpecialVariableStorageAssumption = Assumption
162+
.create(SpecialVariableStorage.ASSUMPTION_NAME);
164163
builder.info(doesNotNeedSpecialVariableStorageAssumption);
165164
}
166165

0 commit comments

Comments
 (0)