Skip to content

Commit f9de5a0

Browse files
committed
Cleanup
1 parent 92cbcfa commit f9de5a0

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

src/main/java/org/truffleruby/core/cast/DurationToMillisecondsNode.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
package org.truffleruby.core.cast;
1111

12-
import com.oracle.truffle.api.CompilerDirectives;
1312
import com.oracle.truffle.api.dsl.Cached;
1413
import org.truffleruby.language.Nil;
1514
import org.truffleruby.language.RubyContextSourceNode;
@@ -26,8 +25,6 @@
2625
@NodeChild(value = "duration", type = RubyNode.class)
2726
public abstract class DurationToMillisecondsNode extends RubyContextSourceNode {
2827

29-
@Child private DispatchNode durationToMilliseconds;
30-
3128
private final ConditionProfile durationLessThanZeroProfile = ConditionProfile.create();
3229
private final boolean acceptsNil;
3330

@@ -68,12 +65,8 @@ protected long durationNil(Nil duration) {
6865

6966
@Specialization
7067
protected Object duration(RubyDynamicObject duration,
68+
@Cached DispatchNode durationToMilliseconds,
7169
@Cached ToLongNode toLongNode) {
72-
if (durationToMilliseconds == null) {
73-
CompilerDirectives.transferToInterpreterAndInvalidate();
74-
durationToMilliseconds = insert(DispatchNode.create());
75-
}
76-
7770
return toLongNode.execute(durationToMilliseconds.call(
7871
coreLibrary().truffleKernelOperationsModule,
7972
"convert_duration_to_milliseconds",

src/main/ruby/truffleruby/core/truffle/kernel_operations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def self.convert_duration_to_milliseconds(duration)
2626
unless duration.respond_to?(:divmod)
2727
raise TypeError, "can't convert #{duration.class} into time interval"
2828
end
29-
a,b = duration.divmod(1)
29+
a, b = duration.divmod(1)
3030
((a + b) * 1000)
3131
end
3232

0 commit comments

Comments
 (0)