File tree Expand file tree Collapse file tree 2 files changed +2
-9
lines changed
java/org/truffleruby/core/cast
ruby/truffleruby/core/truffle Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
package org .truffleruby .core .cast ;
11
11
12
- import com .oracle .truffle .api .CompilerDirectives ;
13
12
import com .oracle .truffle .api .dsl .Cached ;
14
13
import org .truffleruby .language .Nil ;
15
14
import org .truffleruby .language .RubyContextSourceNode ;
26
25
@ NodeChild (value = "duration" , type = RubyNode .class )
27
26
public abstract class DurationToMillisecondsNode extends RubyContextSourceNode {
28
27
29
- @ Child private DispatchNode durationToMilliseconds ;
30
-
31
28
private final ConditionProfile durationLessThanZeroProfile = ConditionProfile .create ();
32
29
private final boolean acceptsNil ;
33
30
@@ -68,12 +65,8 @@ protected long durationNil(Nil duration) {
68
65
69
66
@ Specialization
70
67
protected Object duration (RubyDynamicObject duration ,
68
+ @ Cached DispatchNode durationToMilliseconds ,
71
69
@ Cached ToLongNode toLongNode ) {
72
- if (durationToMilliseconds == null ) {
73
- CompilerDirectives .transferToInterpreterAndInvalidate ();
74
- durationToMilliseconds = insert (DispatchNode .create ());
75
- }
76
-
77
70
return toLongNode .execute (durationToMilliseconds .call (
78
71
coreLibrary ().truffleKernelOperationsModule ,
79
72
"convert_duration_to_milliseconds" ,
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def self.convert_duration_to_milliseconds(duration)
26
26
unless duration . respond_to? ( :divmod )
27
27
raise TypeError , "can't convert #{ duration . class } into time interval"
28
28
end
29
- a , b = duration . divmod ( 1 )
29
+ a , b = duration . divmod ( 1 )
30
30
( ( a + b ) * 1000 )
31
31
end
32
32
You can’t perform that action at this time.
0 commit comments