Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
10be2ea8
Kaydet (Commit)
10be2ea8
authored
Mar 03, 2006
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF bug 1442442: LIST_APPEND optimization got lost in the AST merge.
Add it back.
üst
d4e30357
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
24 deletions
+24
-24
pyassem.py
Lib/compiler/pyassem.py
+1
-0
test_dis.py
Lib/test/test_dis.py
+19
-21
compile.c
Python/compile.c
+4
-3
No files found.
Lib/compiler/pyassem.py
Dosyayı görüntüle @
10be2ea8
...
@@ -744,6 +744,7 @@ class StackDepthTracker:
...
@@ -744,6 +744,7 @@ class StackDepthTracker:
effect
=
{
effect
=
{
'POP_TOP'
:
-
1
,
'POP_TOP'
:
-
1
,
'DUP_TOP'
:
1
,
'DUP_TOP'
:
1
,
'LIST_APPEND'
:
-
2
,
'SLICE+1'
:
-
1
,
'SLICE+1'
:
-
1
,
'SLICE+2'
:
-
1
,
'SLICE+2'
:
-
1
,
'SLICE+3'
:
-
2
,
'SLICE+3'
:
-
2
,
...
...
Lib/test/test_dis.py
Dosyayı görüntüle @
10be2ea8
...
@@ -54,31 +54,29 @@ def bug1333982(x=[]):
...
@@ -54,31 +54,29 @@ def bug1333982(x=[]):
dis_bug1333982
=
"""
\
dis_bug1333982
=
"""
\
%-4
d 0 LOAD_CONST 1 (0)
%-4
d 0 LOAD_CONST 1 (0)
3 JUMP_IF_TRUE 4
7 (to 53
)
3 JUMP_IF_TRUE 4
1 (to 47
)
6 POP_TOP
6 POP_TOP
7 LOAD_GLOBAL 0 (AssertionError)
7 LOAD_GLOBAL 0 (AssertionError)
10 BUILD_LIST 0
10 BUILD_LIST 0
13 DUP_TOP
13 DUP_TOP
14 LOAD_ATTR 1 (append)
14 STORE_FAST 1 (_[1])
17 STORE_FAST 1 (_[1])
17 LOAD_FAST 0 (x)
20 LOAD_FAST 0 (x)
20 GET_ITER
23 GET_ITER
>> 21 FOR_ITER 13 (to 37)
>> 24 FOR_ITER 16 (to 43)
24 STORE_FAST 2 (s)
27 STORE_FAST 2 (s)
27 LOAD_FAST 1 (_[1])
30 LOAD_FAST 1 (_[1])
30 LOAD_FAST 2 (s)
33 LOAD_FAST 2 (s)
33 LIST_APPEND
36 CALL_FUNCTION 1
34 JUMP_ABSOLUTE 21
39 POP_TOP
>> 37 DELETE_FAST 1 (_[1])
40 JUMP_ABSOLUTE 24
>> 43 DELETE_FAST 1 (_[1])
%-4
d 40 LOAD_CONST 2 (1)
43 BINARY_ADD
%-4
d 46 LOAD_CONST 2 (1)
44 RAISE_VARARGS 2
49 BINARY_ADD
>> 47 POP_TOP
50 RAISE_VARARGS 2
>> 53 POP_TOP
%-4
d 48 LOAD_CONST 0 (None)
51 RETURN_VALUE
%-4
d 54 LOAD_CONST 0 (None)
57 RETURN_VALUE
"""
%
(
bug1333982
.
func_code
.
co_firstlineno
+
1
,
"""
%
(
bug1333982
.
func_code
.
co_firstlineno
+
1
,
bug1333982
.
func_code
.
co_firstlineno
+
2
,
bug1333982
.
func_code
.
co_firstlineno
+
2
,
bug1333982
.
func_code
.
co_firstlineno
+
3
)
bug1333982
.
func_code
.
co_firstlineno
+
3
)
...
...
Python/compile.c
Dosyayı görüntüle @
10be2ea8
...
@@ -1297,6 +1297,9 @@ opcode_stack_effect(int opcode, int oparg)
...
@@ -1297,6 +1297,9 @@ opcode_stack_effect(int opcode, int oparg)
case
UNARY_INVERT
:
case
UNARY_INVERT
:
return
0
;
return
0
;
case
LIST_APPEND
:
return
-
2
;
case
BINARY_POWER
:
case
BINARY_POWER
:
case
BINARY_MULTIPLY
:
case
BINARY_MULTIPLY
:
case
BINARY_DIVIDE
:
case
BINARY_DIVIDE
:
...
@@ -3149,8 +3152,7 @@ compiler_listcomp_generator(struct compiler *c, PyObject *tmpname,
...
@@ -3149,8 +3152,7 @@ compiler_listcomp_generator(struct compiler *c, PyObject *tmpname,
if
(
!
compiler_nameop
(
c
,
tmpname
,
Load
))
if
(
!
compiler_nameop
(
c
,
tmpname
,
Load
))
return
0
;
return
0
;
VISIT
(
c
,
expr
,
elt
);
VISIT
(
c
,
expr
,
elt
);
ADDOP_I
(
c
,
CALL_FUNCTION
,
1
);
ADDOP
(
c
,
LIST_APPEND
);
ADDOP
(
c
,
POP_TOP
);
compiler_use_next_block
(
c
,
skip
);
compiler_use_next_block
(
c
,
skip
);
}
}
...
@@ -3189,7 +3191,6 @@ compiler_listcomp(struct compiler *c, expr_ty e)
...
@@ -3189,7 +3191,6 @@ compiler_listcomp(struct compiler *c, expr_ty e)
return
0
;
return
0
;
ADDOP_I
(
c
,
BUILD_LIST
,
0
);
ADDOP_I
(
c
,
BUILD_LIST
,
0
);
ADDOP
(
c
,
DUP_TOP
);
ADDOP
(
c
,
DUP_TOP
);
ADDOP_O
(
c
,
LOAD_ATTR
,
append
,
names
);
if
(
compiler_nameop
(
c
,
tmp
,
Store
))
if
(
compiler_nameop
(
c
,
tmp
,
Store
))
rc
=
compiler_listcomp_generator
(
c
,
tmp
,
generators
,
0
,
rc
=
compiler_listcomp_generator
(
c
,
tmp
,
generators
,
0
,
e
->
v
.
ListComp
.
elt
);
e
->
v
.
ListComp
.
elt
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment