File tree Expand file tree Collapse file tree 6 files changed +16
-12
lines changed
com.oracle.graal.python.test/src/tests
com.oracle.graal.python/src/com/oracle/graal/python Expand file tree Collapse file tree 6 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -56,12 +56,8 @@ def handler(signal, frame):
56
56
57
57
_signal .alarm (1 )
58
58
59
- def dummy ():
60
- pass
61
-
62
59
while not triggered :
63
- dummy ()
64
60
time .sleep (0.5 )
65
61
66
62
assert triggered [0 ] == _signal .SIGALRM
67
- assert triggered [1 ].f_code .co_name == "test_alarm2" , triggered [1 ].f_code . co_name
63
+ assert triggered [1 ].f_code .co_name == "test_alarm2" , triggered [1 ].f_code
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2017, 2018 , Oracle and/or its affiliates.
2
+ * Copyright (c) 2017, 2019 , Oracle and/or its affiliates.
3
3
* Copyright (c) 2013, Regents of the University of California
4
4
*
5
5
* All rights reserved.
@@ -71,6 +71,7 @@ public boolean executeRepeating(VirtualFrame frame) {
71
71
throw raise (PythonErrorType .RuntimeError , "internal error: unexpected frame slot type" );
72
72
}
73
73
body .executeVoid (frame );
74
+ getContext ().triggerAsyncActions ();
74
75
return true ;
75
76
}
76
77
}
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2017, 2018 , Oracle and/or its affiliates.
2
+ * Copyright (c) 2017, 2019 , Oracle and/or its affiliates.
3
3
* Copyright (c) 2013, Regents of the University of California
4
4
*
5
5
* All rights reserved.
25
25
*/
26
26
package com .oracle .graal .python .nodes .control ;
27
27
28
+ import com .oracle .graal .python .nodes .PNodeWithContext ;
28
29
import com .oracle .graal .python .nodes .expression .CastToBooleanNode ;
29
30
import com .oracle .graal .python .nodes .statement .StatementNode ;
30
31
import com .oracle .truffle .api .Truffle ;
31
32
import com .oracle .truffle .api .frame .VirtualFrame ;
32
- import com .oracle .truffle .api .nodes .Node ;
33
33
import com .oracle .truffle .api .nodes .NodeInfo ;
34
34
import com .oracle .truffle .api .nodes .RepeatingNode ;
35
35
import com .oracle .truffle .api .profiles .LoopConditionProfile ;
36
36
37
- final class WhileRepeatingNode extends Node implements RepeatingNode {
37
+ final class WhileRepeatingNode extends PNodeWithContext implements RepeatingNode {
38
38
39
39
private final LoopConditionProfile conditionProfile = LoopConditionProfile .createCountingProfile ();
40
40
@@ -50,6 +50,7 @@ final class WhileRepeatingNode extends Node implements RepeatingNode {
50
50
public boolean executeRepeating (VirtualFrame frame ) {
51
51
if (conditionProfile .profile (condition .executeBoolean (frame ))) {
52
52
body .executeVoid (frame );
53
+ getContext ().triggerAsyncActions ();
53
54
return true ;
54
55
}
55
56
return false ;
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2017, 2018 , Oracle and/or its affiliates.
2
+ * Copyright (c) 2017, 2019 , Oracle and/or its affiliates.
3
3
* Copyright (c) 2013, Regents of the University of California
4
4
*
5
5
* All rights reserved.
31
31
import com .oracle .graal .python .nodes .frame .WriteNode ;
32
32
import com .oracle .graal .python .nodes .object .IsBuiltinClassProfile ;
33
33
import com .oracle .graal .python .nodes .statement .StatementNode ;
34
+ import com .oracle .graal .python .runtime .PythonContext ;
34
35
import com .oracle .graal .python .runtime .exception .PException ;
35
36
import com .oracle .graal .python .runtime .exception .YieldException ;
36
37
import com .oracle .truffle .api .CompilerDirectives ;
@@ -93,6 +94,7 @@ public void executeVoid(VirtualFrame frame) {
93
94
}
94
95
95
96
Object nextIterator = null ;
97
+ PythonContext context = getContext ();
96
98
int count = 0 ;
97
99
try {
98
100
while (true ) {
@@ -108,6 +110,7 @@ public void executeVoid(VirtualFrame frame) {
108
110
if (CompilerDirectives .inInterpreter ()) {
109
111
count ++;
110
112
}
113
+ context .triggerAsyncActions ();
111
114
}
112
115
return ;
113
116
} catch (YieldException e ) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2017, 2018 , Oracle and/or its affiliates.
2
+ * Copyright (c) 2017, 2019 , Oracle and/or its affiliates.
3
3
* Copyright (c) 2014, Regents of the University of California
4
4
*
5
5
* All rights reserved.
28
28
import com .oracle .graal .python .nodes .control .LoopNode ;
29
29
import com .oracle .graal .python .nodes .expression .CastToBooleanNode ;
30
30
import com .oracle .graal .python .nodes .statement .StatementNode ;
31
+ import com .oracle .graal .python .runtime .PythonContext ;
31
32
import com .oracle .graal .python .runtime .exception .BreakException ;
32
33
import com .oracle .graal .python .runtime .exception .YieldException ;
33
34
import com .oracle .truffle .api .CompilerDirectives ;
@@ -68,12 +69,14 @@ public void executeVoid(VirtualFrame frame) {
68
69
}
69
70
boolean nextFlag = false ;
70
71
int count = 0 ;
72
+ PythonContext context = getContext ();
71
73
try {
72
74
do {
73
75
body .executeVoid (frame );
74
76
if (CompilerDirectives .inInterpreter ()) {
75
77
count ++;
76
78
}
79
+ context .triggerAsyncActions ();
77
80
} while (condition .executeBoolean (frame ));
78
81
return ;
79
82
} catch (YieldException e ) {
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ public Object execute(VirtualFrame frame) {
126
126
int frameIndex = (int ) frameArguments [1 ];
127
127
Object [] arguments = Arrays .copyOfRange (frameArguments , 2 , frameArguments .length );
128
128
if (frameIndex >= 0 ) {
129
- arguments [frameIndex ] = getFrameNode .execute (2 );
129
+ arguments [frameIndex ] = getFrameNode .execute (1 );
130
130
}
131
131
return callNode .execute (frame , callable , arguments );
132
132
}
You can’t perform that action at this time.
0 commit comments