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
eefaeb78
Kaydet (Commit)
eefaeb78
authored
Kas 06, 2000
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
move pruneNext method to correct object (doh!)
üst
314e3fb2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
48 deletions
+48
-48
pyassem.py
Lib/compiler/pyassem.py
+24
-24
pyassem.py
Tools/compiler/compiler/pyassem.py
+24
-24
No files found.
Lib/compiler/pyassem.py
Dosyayı görüntüle @
eefaeb78
...
...
@@ -120,30 +120,6 @@ class FlowGraph:
l
.
extend
(
b
.
getContainedGraphs
())
return
l
_uncond_transfer
=
(
'RETURN_VALUE'
,
'RAISE_VARARGS'
,
'JUMP_ABSOLUTE'
,
'JUMP_FORWARD'
)
def
pruneNext
(
self
):
"""Remove bogus edge for unconditional transfers
Each block has a next edge that accounts for implicit control
transfers, e.g. from a JUMP_IF_FALSE to the block that will be
executed if the test is true.
These edges must remain for the current assembler code to
work. If they are removed, the dfs_postorder gets things in
weird orders. However, they shouldn't be there for other
purposes, e.g. conversion to SSA form. This method will
remove the next edge when it follows an unconditional control
transfer.
"""
try
:
op
,
arg
=
self
.
insts
[
-
1
]
except
(
IndexError
,
TypeError
):
return
if
op
in
self
.
_uncond_transfer
:
self
.
next
=
[]
def
dfs_postorder
(
b
,
seen
):
"""Depth-first search of tree rooted at b, return in postorder"""
order
=
[]
...
...
@@ -197,6 +173,30 @@ class Block:
self
.
next
.
append
(
block
)
assert
len
(
self
.
next
)
==
1
,
map
(
str
,
self
.
next
)
_uncond_transfer
=
(
'RETURN_VALUE'
,
'RAISE_VARARGS'
,
'JUMP_ABSOLUTE'
,
'JUMP_FORWARD'
)
def
pruneNext
(
self
):
"""Remove bogus edge for unconditional transfers
Each block has a next edge that accounts for implicit control
transfers, e.g. from a JUMP_IF_FALSE to the block that will be
executed if the test is true.
These edges must remain for the current assembler code to
work. If they are removed, the dfs_postorder gets things in
weird orders. However, they shouldn't be there for other
purposes, e.g. conversion to SSA form. This method will
remove the next edge when it follows an unconditional control
transfer.
"""
try
:
op
,
arg
=
self
.
insts
[
-
1
]
except
(
IndexError
,
ValueError
):
return
if
op
in
self
.
_uncond_transfer
:
self
.
next
=
[]
def
get_children
(
self
):
if
self
.
next
and
self
.
next
[
0
]
in
self
.
outEdges
:
self
.
outEdges
.
remove
(
self
.
next
[
0
])
...
...
Tools/compiler/compiler/pyassem.py
Dosyayı görüntüle @
eefaeb78
...
...
@@ -120,30 +120,6 @@ class FlowGraph:
l
.
extend
(
b
.
getContainedGraphs
())
return
l
_uncond_transfer
=
(
'RETURN_VALUE'
,
'RAISE_VARARGS'
,
'JUMP_ABSOLUTE'
,
'JUMP_FORWARD'
)
def
pruneNext
(
self
):
"""Remove bogus edge for unconditional transfers
Each block has a next edge that accounts for implicit control
transfers, e.g. from a JUMP_IF_FALSE to the block that will be
executed if the test is true.
These edges must remain for the current assembler code to
work. If they are removed, the dfs_postorder gets things in
weird orders. However, they shouldn't be there for other
purposes, e.g. conversion to SSA form. This method will
remove the next edge when it follows an unconditional control
transfer.
"""
try
:
op
,
arg
=
self
.
insts
[
-
1
]
except
(
IndexError
,
TypeError
):
return
if
op
in
self
.
_uncond_transfer
:
self
.
next
=
[]
def
dfs_postorder
(
b
,
seen
):
"""Depth-first search of tree rooted at b, return in postorder"""
order
=
[]
...
...
@@ -197,6 +173,30 @@ class Block:
self
.
next
.
append
(
block
)
assert
len
(
self
.
next
)
==
1
,
map
(
str
,
self
.
next
)
_uncond_transfer
=
(
'RETURN_VALUE'
,
'RAISE_VARARGS'
,
'JUMP_ABSOLUTE'
,
'JUMP_FORWARD'
)
def
pruneNext
(
self
):
"""Remove bogus edge for unconditional transfers
Each block has a next edge that accounts for implicit control
transfers, e.g. from a JUMP_IF_FALSE to the block that will be
executed if the test is true.
These edges must remain for the current assembler code to
work. If they are removed, the dfs_postorder gets things in
weird orders. However, they shouldn't be there for other
purposes, e.g. conversion to SSA form. This method will
remove the next edge when it follows an unconditional control
transfer.
"""
try
:
op
,
arg
=
self
.
insts
[
-
1
]
except
(
IndexError
,
ValueError
):
return
if
op
in
self
.
_uncond_transfer
:
self
.
next
=
[]
def
get_children
(
self
):
if
self
.
next
and
self
.
next
[
0
]
in
self
.
outEdges
:
self
.
outEdges
.
remove
(
self
.
next
[
0
])
...
...
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