Skip to content

Commit af15b02

Browse files
msimacektomasstupka
authored andcommitted
Delete exception binding after block
1 parent 3a6df74 commit af15b02

File tree

9 files changed

+251
-174
lines changed

9 files changed

+251
-174
lines changed

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testBreakFromExcept.co

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,28 @@ Disassembly of <module>:
33
000015 2 LOAD_BYTE 10
44
000009 4 CALL_FUNCTION 1
55
000000 6 GET_ITER
6-
000000 >> 7 FOR_ITER 31 (to 38)
6+
000000 >> 7 FOR_ITER 38 (to 45)
77
000004 9 STORE_NAME 1 (i)
88
000031 11 LOAD_BYTE 1
99
000035 13 LOAD_BYTE 0
1010
000031 15 BINARY_OP 8 (TRUEDIV)
1111
000031 17 POP_TOP
12-
000031 18 JUMP_FORWARD 18 (to 36)
12+
000031 18 JUMP_FORWARD 25 (to 43)
1313
000031 20 PUSH_EXC_INFO (exc handler 11 - 20; stack: 1)
1414
000046 21 LOAD_NAME 2 (RuntimeError)
15-
000039 23 MATCH_EXC_OR_JUMP 12 (to 35)
15+
000039 23 MATCH_EXC_OR_JUMP 19 (to 42)
1616
000039 25 UNWRAP_EXC
1717
000039 26 STORE_NAME 3 (e)
18-
000068 28 POP_EXCEPT
19-
000068 29 POP_TOP
20-
000068 30 JUMP_FORWARD 8 (to 38)
21-
000068 32 POP_EXCEPT
22-
000068 33 JUMP_FORWARD 3 (to 36)
23-
000068 >> 35 END_EXC_HANDLER (exc handler 21 - 35; stack: 2)
24-
000068 >> 36 JUMP_BACKWARD 29 (to 7)
25-
000068 >> 38 LOAD_NONE
26-
000068 39 RETURN_VALUE
18+
000068 28 DELETE_NAME 3 (e)
19+
000068 30 POP_EXCEPT
20+
000068 31 POP_TOP
21+
000068 32 JUMP_FORWARD 13 (to 45)
22+
000068 34 DELETE_NAME 3 (e)
23+
000068 36 POP_EXCEPT
24+
000068 37 JUMP_FORWARD 6 (to 43)
25+
000068 39 DELETE_NAME 3 (e) (exc handler 28 - 34; stack: 2)
26+
000068 41 END_EXC_HANDLER
27+
000068 >> 42 END_EXC_HANDLER (exc handler 21 - 28; stack: 2 | exc handler 34 - 42; stack: 2)
28+
000068 >> 43 JUMP_BACKWARD 36 (to 7)
29+
000068 >> 45 LOAD_NONE
30+
000068 46 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testReturnFromExcept.co

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,31 @@ Disassembly of <module>:
33
000015 2 LOAD_BYTE 10
44
000009 4 CALL_FUNCTION 1
55
000000 6 GET_ITER
6-
000000 >> 7 FOR_ITER 34 (to 41)
6+
000000 >> 7 FOR_ITER 41 (to 48)
77
000004 9 STORE_NAME 1 (i)
88
000031 11 LOAD_BYTE 1
99
000035 13 LOAD_BYTE 0
1010
000031 15 BINARY_OP 8 (TRUEDIV)
1111
000031 17 POP_TOP
12-
000031 18 JUMP_FORWARD 21 (to 39)
12+
000031 18 JUMP_FORWARD 28 (to 46)
1313
000031 20 PUSH_EXC_INFO (exc handler 11 - 20; stack: 1)
1414
000046 21 LOAD_NAME 2 (RuntimeError)
15-
000039 23 MATCH_EXC_OR_JUMP 15 (to 38)
15+
000039 23 MATCH_EXC_OR_JUMP 22 (to 45)
1616
000039 25 UNWRAP_EXC
1717
000039 26 STORE_NAME 3 (e)
1818
000075 28 LOAD_NAME 4 (a)
19-
000068 30 ROT_TWO
20-
000068 31 POP_EXCEPT
19+
000068 30 DELETE_NAME 3 (e)
2120
000068 32 ROT_TWO
22-
000068 33 POP_TOP
23-
000068 34 RETURN_VALUE
24-
000068 35 POP_EXCEPT
25-
000068 36 JUMP_FORWARD 3 (to 39)
26-
000068 >> 38 END_EXC_HANDLER (exc handler 21 - 38; stack: 2)
27-
000068 >> 39 JUMP_BACKWARD 32 (to 7)
28-
000068 >> 41 LOAD_NONE
29-
000068 42 RETURN_VALUE
21+
000068 33 POP_EXCEPT
22+
000068 34 ROT_TWO
23+
000068 35 POP_TOP
24+
000068 36 RETURN_VALUE
25+
000068 37 DELETE_NAME 3 (e)
26+
000068 39 POP_EXCEPT
27+
000068 40 JUMP_FORWARD 6 (to 46)
28+
000068 42 DELETE_NAME 3 (e) (exc handler 28 - 37; stack: 2)
29+
000068 44 END_EXC_HANDLER
30+
000068 >> 45 END_EXC_HANDLER (exc handler 21 - 28; stack: 2 | exc handler 37 - 45; stack: 2)
31+
000068 >> 46 JUMP_BACKWARD 39 (to 7)
32+
000068 >> 48 LOAD_NONE
33+
000068 49 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testTryExcept.co

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,36 @@ Disassembly of <module>:
77
000029 9 LOAD_STRING 1 ('try')
88
000023 11 CALL_FUNCTION 1
99
000023 13 POP_TOP
10-
000023 14 JUMP_FORWARD 38 (to 52)
10+
000023 14 JUMP_FORWARD 48 (to 62)
1111
000023 16 PUSH_EXC_INFO (exc handler 7 - 16; stack: 0)
1212
000043 17 LOAD_NAME 1 (TypeError)
13-
000036 19 MATCH_EXC_OR_JUMP 15 (to 34)
13+
000036 19 MATCH_EXC_OR_JUMP 20 (to 39)
1414
000036 21 UNWRAP_EXC
1515
000036 22 STORE_NAME 2 (e)
1616
000061 24 LOAD_NAME 0 (print)
1717
000067 26 LOAD_STRING 2 ('except1')
1818
000061 28 CALL_FUNCTION 1
1919
000061 30 POP_TOP
20-
000061 31 POP_EXCEPT
21-
000061 32 JUMP_FORWARD 20 (to 52)
22-
000085 >> 34 LOAD_NAME 3 (ValueError)
23-
000078 36 MATCH_EXC_OR_JUMP 15 (to 51)
24-
000078 38 UNWRAP_EXC
25-
000078 39 STORE_NAME 2 (e)
26-
000104 41 LOAD_NAME 0 (print)
27-
000110 43 LOAD_STRING 3 ('except2')
28-
000104 45 CALL_FUNCTION 1
29-
000104 47 POP_TOP
30-
000104 48 POP_EXCEPT
31-
000104 49 JUMP_FORWARD 3 (to 52)
32-
000104 >> 51 END_EXC_HANDLER (exc handler 17 - 51; stack: 1)
33-
000121 >> 52 LOAD_NAME 0 (print)
34-
000127 54 LOAD_STRING 4 ('after')
35-
000121 56 CALL_FUNCTION 1
36-
000121 58 RETURN_VALUE
20+
000061 31 DELETE_NAME 2 (e)
21+
000061 33 POP_EXCEPT
22+
000061 34 JUMP_FORWARD 28 (to 62)
23+
000061 36 DELETE_NAME 2 (e) (exc handler 24 - 31; stack: 1)
24+
000061 38 END_EXC_HANDLER
25+
000085 >> 39 LOAD_NAME 3 (ValueError)
26+
000078 41 MATCH_EXC_OR_JUMP 20 (to 61)
27+
000078 43 UNWRAP_EXC
28+
000078 44 STORE_NAME 2 (e)
29+
000104 46 LOAD_NAME 0 (print)
30+
000110 48 LOAD_STRING 3 ('except2')
31+
000104 50 CALL_FUNCTION 1
32+
000104 52 POP_TOP
33+
000104 53 DELETE_NAME 2 (e)
34+
000104 55 POP_EXCEPT
35+
000104 56 JUMP_FORWARD 6 (to 62)
36+
000104 58 DELETE_NAME 2 (e) (exc handler 46 - 53; stack: 1)
37+
000104 60 END_EXC_HANDLER
38+
000104 >> 61 END_EXC_HANDLER (exc handler 17 - 24; stack: 1 | exc handler 31 - 46; stack: 1 | exc handler 53 - 61; stack: 1)
39+
000121 >> 62 LOAD_NAME 0 (print)
40+
000127 64 LOAD_STRING 4 ('after')
41+
000121 66 CALL_FUNCTION 1
42+
000121 68 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testTryExceptBare.co

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,30 @@ Disassembly of <module>:
77
000029 9 LOAD_STRING 1 ('try')
88
000023 11 CALL_FUNCTION 1
99
000023 13 POP_TOP
10-
000023 14 JUMP_FORWARD 32 (to 46)
10+
000023 14 JUMP_FORWARD 37 (to 51)
1111
000023 16 PUSH_EXC_INFO (exc handler 7 - 16; stack: 0)
1212
000043 17 LOAD_NAME 1 (TypeError)
13-
000036 19 MATCH_EXC_OR_JUMP 15 (to 34)
13+
000036 19 MATCH_EXC_OR_JUMP 20 (to 39)
1414
000036 21 UNWRAP_EXC
1515
000036 22 STORE_NAME 2 (e)
1616
000061 24 LOAD_NAME 0 (print)
1717
000067 26 LOAD_STRING 2 ('except1')
1818
000061 28 CALL_FUNCTION 1
1919
000061 30 POP_TOP
20-
000061 31 POP_EXCEPT
21-
000061 32 JUMP_FORWARD 14 (to 46)
22-
000078 >> 34 POP_TOP
23-
000088 35 LOAD_NAME 0 (print)
24-
000094 37 LOAD_STRING 3 ('except bare')
25-
000088 39 CALL_FUNCTION 1
26-
000088 41 POP_TOP
27-
000088 42 POP_EXCEPT
28-
000088 43 JUMP_FORWARD 3 (to 46)
29-
000088 45 END_EXC_HANDLER (exc handler 17 - 45; stack: 1)
30-
000109 >> 46 LOAD_NAME 0 (print)
31-
000115 48 LOAD_STRING 4 ('after')
32-
000109 50 CALL_FUNCTION 1
33-
000109 52 RETURN_VALUE
20+
000061 31 DELETE_NAME 2 (e)
21+
000061 33 POP_EXCEPT
22+
000061 34 JUMP_FORWARD 17 (to 51)
23+
000061 36 DELETE_NAME 2 (e) (exc handler 24 - 31; stack: 1)
24+
000061 38 END_EXC_HANDLER
25+
000078 >> 39 POP_TOP
26+
000088 40 LOAD_NAME 0 (print)
27+
000094 42 LOAD_STRING 3 ('except bare')
28+
000088 44 CALL_FUNCTION 1
29+
000088 46 POP_TOP
30+
000088 47 POP_EXCEPT
31+
000088 48 JUMP_FORWARD 3 (to 51)
32+
000088 50 END_EXC_HANDLER (exc handler 17 - 24; stack: 1 | exc handler 31 - 50; stack: 1)
33+
000109 >> 51 LOAD_NAME 0 (print)
34+
000115 53 LOAD_STRING 4 ('after')
35+
000109 55 CALL_FUNCTION 1
36+
000109 57 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testTryExceptElse.co

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,41 @@ Disassembly of <module>:
77
000029 9 LOAD_STRING 1 ('try')
88
000023 11 CALL_FUNCTION 1
99
000023 13 POP_TOP
10-
000023 14 JUMP_FORWARD 38 (to 52)
10+
000023 14 JUMP_FORWARD 48 (to 62)
1111
000023 16 PUSH_EXC_INFO (exc handler 7 - 16; stack: 0)
1212
000043 17 LOAD_NAME 1 (TypeError)
13-
000036 19 MATCH_EXC_OR_JUMP 15 (to 34)
13+
000036 19 MATCH_EXC_OR_JUMP 20 (to 39)
1414
000036 21 UNWRAP_EXC
1515
000036 22 STORE_NAME 2 (e)
1616
000061 24 LOAD_NAME 0 (print)
1717
000067 26 LOAD_STRING 2 ('except1')
1818
000061 28 CALL_FUNCTION 1
1919
000061 30 POP_TOP
20-
000061 31 POP_EXCEPT
21-
000061 32 JUMP_FORWARD 29 (to 61)
22-
000085 >> 34 LOAD_NAME 3 (ValueError)
23-
000078 36 MATCH_EXC_OR_JUMP 15 (to 51)
24-
000078 38 UNWRAP_EXC
25-
000078 39 STORE_NAME 2 (e)
26-
000104 41 LOAD_NAME 0 (print)
27-
000110 43 LOAD_STRING 3 ('except2')
28-
000104 45 CALL_FUNCTION 1
29-
000104 47 POP_TOP
30-
000104 48 POP_EXCEPT
31-
000104 49 JUMP_FORWARD 12 (to 61)
32-
000104 >> 51 END_EXC_HANDLER (exc handler 17 - 51; stack: 1)
33-
000129 >> 52 LOAD_NAME 0 (print)
34-
000135 54 LOAD_STRING 4 ('else')
35-
000129 56 CALL_FUNCTION 1
36-
000129 58 POP_TOP
37-
000129 59 JUMP_FORWARD 2 (to 61)
38-
000143 >> 61 LOAD_NAME 0 (print)
39-
000149 63 LOAD_STRING 5 ('after')
40-
000143 65 CALL_FUNCTION 1
41-
000143 67 RETURN_VALUE
20+
000061 31 DELETE_NAME 2 (e)
21+
000061 33 POP_EXCEPT
22+
000061 34 JUMP_FORWARD 37 (to 71)
23+
000061 36 DELETE_NAME 2 (e) (exc handler 24 - 31; stack: 1)
24+
000061 38 END_EXC_HANDLER
25+
000085 >> 39 LOAD_NAME 3 (ValueError)
26+
000078 41 MATCH_EXC_OR_JUMP 20 (to 61)
27+
000078 43 UNWRAP_EXC
28+
000078 44 STORE_NAME 2 (e)
29+
000104 46 LOAD_NAME 0 (print)
30+
000110 48 LOAD_STRING 3 ('except2')
31+
000104 50 CALL_FUNCTION 1
32+
000104 52 POP_TOP
33+
000104 53 DELETE_NAME 2 (e)
34+
000104 55 POP_EXCEPT
35+
000104 56 JUMP_FORWARD 15 (to 71)
36+
000104 58 DELETE_NAME 2 (e) (exc handler 46 - 53; stack: 1)
37+
000104 60 END_EXC_HANDLER
38+
000104 >> 61 END_EXC_HANDLER (exc handler 17 - 24; stack: 1 | exc handler 31 - 46; stack: 1 | exc handler 53 - 61; stack: 1)
39+
000129 >> 62 LOAD_NAME 0 (print)
40+
000135 64 LOAD_STRING 4 ('else')
41+
000129 66 CALL_FUNCTION 1
42+
000129 68 POP_TOP
43+
000129 69 JUMP_FORWARD 2 (to 71)
44+
000143 >> 71 LOAD_NAME 0 (print)
45+
000149 73 LOAD_STRING 5 ('after')
46+
000143 75 CALL_FUNCTION 1
47+
000143 77 RETURN_VALUE

graalpython/com.oracle.graal.python.test/testData/goldenFiles/CompilerTests/testTryExceptElseFinally.co

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,57 @@ Disassembly of <module>:
77
000029 9 LOAD_STRING 1 ('try')
88
000023 11 CALL_FUNCTION 1
99
000023 13 POP_TOP
10-
000023 14 JUMP_FORWARD 41 (to 55)
10+
000023 14 JUMP_FORWARD 57 (to 71)
1111
000023 16 PUSH_EXC_INFO (exc handler 7 - 16; stack: 0)
1212
000043 17 LOAD_NAME 1 (TypeError)
13-
000036 19 MATCH_EXC_OR_JUMP 15 (to 34)
13+
000036 19 MATCH_EXC_OR_JUMP 23 (to 42)
1414
000036 21 UNWRAP_EXC
1515
000036 22 STORE_NAME 2 (e)
1616
000061 24 LOAD_NAME 0 (print)
1717
000067 26 LOAD_STRING 2 ('except1')
1818
000061 28 CALL_FUNCTION 1
1919
000061 30 POP_TOP
20-
000061 31 POP_EXCEPT
21-
000061 32 JUMP_FORWARD 41 (to 73)
22-
000085 >> 34 LOAD_NAME 3 (ValueError)
23-
000078 36 MATCH_EXC_OR_JUMP 29 (to 65)
24-
000078 38 UNWRAP_EXC
25-
000078 39 STORE_NAME 2 (e)
26-
000104 41 LOAD_NAME 0 (print)
27-
000110 43 LOAD_STRING 3 ('except2')
28-
000104 45 CALL_FUNCTION 1
29-
000104 47 POP_TOP
30-
000104 48 POP_EXCEPT
31-
000104 49 JUMP_FORWARD 24 (to 73)
32-
000104 51 ROT_TWO (exc handler 17 - 51; stack: 1)
33-
000104 52 POP_EXCEPT
34-
000104 53 JUMP_FORWARD 11 (to 64)
35-
000129 >> 55 LOAD_NAME 0 (print)
36-
000135 57 LOAD_STRING 4 ('else')
37-
000129 59 CALL_FUNCTION 1
38-
000129 61 POP_TOP
39-
000129 62 JUMP_FORWARD 11 (to 73)
40-
000129 >> 64 PUSH_EXC_INFO (exc handler 16 - 17; stack: 0 | exc handler 51 - 64; stack: 0)
41-
000154 >> 65 LOAD_NAME 0 (print)
42-
000160 67 LOAD_STRING 5 ('finally')
43-
000154 69 CALL_FUNCTION 1
44-
000154 71 POP_TOP
45-
000154 72 END_EXC_HANDLER (exc handler 65 - 72; stack: 1)
46-
000154 >> 73 LOAD_NAME 0 (print)
47-
000160 75 LOAD_STRING 5 ('finally')
48-
000154 77 CALL_FUNCTION 1
49-
000154 79 POP_TOP
50-
000171 80 LOAD_NAME 0 (print)
51-
000177 82 LOAD_STRING 6 ('after')
52-
000171 84 CALL_FUNCTION 1
53-
000171 86 RETURN_VALUE
20+
000061 31 DELETE_NAME 2 (e)
21+
000061 33 POP_EXCEPT
22+
000061 34 JUMP_FORWARD 55 (to 89)
23+
000061 36 DELETE_NAME 2 (e) (exc handler 24 - 31; stack: 1)
24+
000061 38 ROT_TWO
25+
000061 39 POP_EXCEPT
26+
000061 40 JUMP_FORWARD 40 (to 80)
27+
000085 >> 42 LOAD_NAME 3 (ValueError)
28+
000078 44 MATCH_EXC_OR_JUMP 37 (to 81)
29+
000078 46 UNWRAP_EXC
30+
000078 47 STORE_NAME 2 (e)
31+
000104 49 LOAD_NAME 0 (print)
32+
000110 51 LOAD_STRING 3 ('except2')
33+
000104 53 CALL_FUNCTION 1
34+
000104 55 POP_TOP
35+
000104 56 DELETE_NAME 2 (e)
36+
000104 58 POP_EXCEPT
37+
000104 59 JUMP_FORWARD 30 (to 89)
38+
000104 61 DELETE_NAME 2 (e) (exc handler 49 - 56; stack: 1)
39+
000104 63 ROT_TWO
40+
000104 64 POP_EXCEPT
41+
000104 65 JUMP_FORWARD 15 (to 80)
42+
000104 67 ROT_TWO (exc handler 17 - 24; stack: 1 | exc handler 31 - 49; stack: 1 | exc handler 56 - 67; stack: 1)
43+
000104 68 POP_EXCEPT
44+
000104 69 JUMP_FORWARD 11 (to 80)
45+
000129 >> 71 LOAD_NAME 0 (print)
46+
000135 73 LOAD_STRING 4 ('else')
47+
000129 75 CALL_FUNCTION 1
48+
000129 77 POP_TOP
49+
000129 78 JUMP_FORWARD 11 (to 89)
50+
000129 >> 80 PUSH_EXC_INFO (exc handler 16 - 17; stack: 0 | exc handler 67 - 80; stack: 0)
51+
000154 >> 81 LOAD_NAME 0 (print)
52+
000160 83 LOAD_STRING 5 ('finally')
53+
000154 85 CALL_FUNCTION 1
54+
000154 87 POP_TOP
55+
000154 88 END_EXC_HANDLER (exc handler 81 - 88; stack: 1)
56+
000154 >> 89 LOAD_NAME 0 (print)
57+
000160 91 LOAD_STRING 5 ('finally')
58+
000154 93 CALL_FUNCTION 1
59+
000154 95 POP_TOP
60+
000171 96 LOAD_NAME 0 (print)
61+
000177 98 LOAD_STRING 6 ('after')
62+
000171 100 CALL_FUNCTION 1
63+
000171 102 RETURN_VALUE

0 commit comments

Comments
 (0)