Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
b3f86e63
Commit
b3f86e63
authored
Nov 11, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename CFGBlock::getLastStmt to getTerminator
parent
ee6cacaf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
src/codegen/irgen.cpp
src/codegen/irgen.cpp
+2
-2
src/core/cfg.cpp
src/core/cfg.cpp
+4
-4
src/core/cfg.h
src/core/cfg.h
+1
-1
test/unittests/analysis.cpp
test/unittests/analysis.cpp
+1
-1
No files found.
src/codegen/irgen.cpp
View file @
b3f86e63
...
@@ -741,7 +741,7 @@ static void emitBBs(IRGenState* irstate, TypeAnalysis* types, const OSREntryDesc
...
@@ -741,7 +741,7 @@ static void emitBBs(IRGenState* irstate, TypeAnalysis* types, const OSREntryDesc
// are disallowed
// are disallowed
auto
pred
=
block
->
predecessors
[
0
];
auto
pred
=
block
->
predecessors
[
0
];
auto
last_inst
=
pred
->
get
LastStmt
();
auto
last_inst
=
pred
->
get
Terminator
();
SymbolTable
*
sym_table
=
ending_symbol_tables
[
pred
];
SymbolTable
*
sym_table
=
ending_symbol_tables
[
pred
];
bool
created_new_sym_table
=
false
;
bool
created_new_sym_table
=
false
;
...
@@ -823,7 +823,7 @@ static void emitBBs(IRGenState* irstate, TypeAnalysis* types, const OSREntryDesc
...
@@ -823,7 +823,7 @@ static void emitBBs(IRGenState* irstate, TypeAnalysis* types, const OSREntryDesc
llvm_exit_blocks
[
block
]
=
ending_st
.
ending_block
;
llvm_exit_blocks
[
block
]
=
ending_st
.
ending_block
;
if
(
ending_st
.
exception_state
.
size
())
{
if
(
ending_st
.
exception_state
.
size
())
{
BST_stmt
*
last_stmt
=
block
->
get
LastStmt
();
BST_stmt
*
last_stmt
=
block
->
get
Terminator
();
assert
(
last_stmt
->
is_invoke
());
assert
(
last_stmt
->
is_invoke
());
CFGBlock
*
exc_block
=
last_stmt
->
get_exc_block
();
CFGBlock
*
exc_block
=
last_stmt
->
get_exc_block
();
assert
(
!
incoming_exception_state
.
count
(
exc_block
));
assert
(
!
incoming_exception_state
.
count
(
exc_block
));
...
...
src/core/cfg.cpp
View file @
b3f86e63
...
@@ -233,7 +233,7 @@ static int getLastLineno(llvm::ArrayRef<AST_stmt*> body, int default_lineno) {
...
@@ -233,7 +233,7 @@ static int getLastLineno(llvm::ArrayRef<AST_stmt*> body, int default_lineno) {
llvm
::
SmallVector
<
CFGBlock
*
,
2
>
CFGBlock
::
successors
()
const
{
llvm
::
SmallVector
<
CFGBlock
*
,
2
>
CFGBlock
::
successors
()
const
{
llvm
::
SmallVector
<
CFGBlock
*
,
2
>
successors
;
llvm
::
SmallVector
<
CFGBlock
*
,
2
>
successors
;
auto
*
last
=
get
LastStmt
();
auto
*
last
=
get
Terminator
();
if
(
last
->
type
()
==
BST_TYPE
::
Jump
)
{
if
(
last
->
type
()
==
BST_TYPE
::
Jump
)
{
successors
.
push_back
(
bst_cast
<
BST_Jump
>
(
last
)
->
target
);
successors
.
push_back
(
bst_cast
<
BST_Jump
>
(
last
)
->
target
);
}
else
if
(
last
->
type
()
==
BST_TYPE
::
Branch
)
{
}
else
if
(
last
->
type
()
==
BST_TYPE
::
Branch
)
{
...
@@ -3239,7 +3239,7 @@ static int pruneUnnecessaryBlocks(CFG* rtn) {
...
@@ -3239,7 +3239,7 @@ static int pruneUnnecessaryBlocks(CFG* rtn) {
if
(
b2
->
predecessors
.
size
()
!=
1
)
if
(
b2
->
predecessors
.
size
()
!=
1
)
continue
;
continue
;
auto
last_stmt
=
b
->
get
LastStmt
();
auto
last_stmt
=
b
->
get
Terminator
();
if
(
last_stmt
->
is_invoke
())
{
if
(
last_stmt
->
is_invoke
())
{
// TODO probably shouldn't be generating these anyway:
// TODO probably shouldn't be generating these anyway:
assert
(
last_stmt
->
get_normal_block
()
==
last_stmt
->
get_exc_block
());
assert
(
last_stmt
->
get_normal_block
()
==
last_stmt
->
get_exc_block
());
...
@@ -3277,7 +3277,7 @@ static int pruneUnnecessaryBlocks(CFG* rtn) {
...
@@ -3277,7 +3277,7 @@ static int pruneUnnecessaryBlocks(CFG* rtn) {
bool
should_merge_blocks
=
blocks_to_merge
.
count
(
b
);
bool
should_merge_blocks
=
blocks_to_merge
.
count
(
b
);
if
(
should_merge_blocks
)
{
if
(
should_merge_blocks
)
{
// copy first block without the terminator
// copy first block without the terminator
block_size
-=
b
->
get
LastStmt
()
->
size_in_bytes
();
block_size
-=
b
->
get
Terminator
()
->
size_in_bytes
();
memcpy
(
final_bytecode
.
allocate
(
block_size
),
b
->
body
(),
block_size
);
memcpy
(
final_bytecode
.
allocate
(
block_size
),
b
->
body
(),
block_size
);
offset
+=
block_size
;
offset
+=
block_size
;
// copy second block and delete it
// copy second block and delete it
...
@@ -3410,7 +3410,7 @@ static std::pair<CFG*, CodeConstants> computeCFG(llvm::ArrayRef<AST_stmt*> body,
...
@@ -3410,7 +3410,7 @@ static std::pair<CFG*, CodeConstants> computeCFG(llvm::ArrayRef<AST_stmt*> body,
ASSERT
(
b
->
body
()
!=
NULL
,
"%d"
,
b
->
idx
);
ASSERT
(
b
->
body
()
!=
NULL
,
"%d"
,
b
->
idx
);
ASSERT
(
b
->
successors
().
size
()
<=
2
,
"%d has too many successors!"
,
b
->
idx
);
ASSERT
(
b
->
successors
().
size
()
<=
2
,
"%d has too many successors!"
,
b
->
idx
);
if
(
b
->
successors
().
size
()
==
0
)
{
if
(
b
->
successors
().
size
()
==
0
)
{
BST_stmt
*
terminator
=
b
->
get
LastStmt
();
BST_stmt
*
terminator
=
b
->
get
Terminator
();
assert
(
terminator
->
type
()
==
BST_TYPE
::
Return
||
terminator
->
type
()
==
BST_TYPE
::
Raise
assert
(
terminator
->
type
()
==
BST_TYPE
::
Return
||
terminator
->
type
()
==
BST_TYPE
::
Raise
||
terminator
->
type
()
==
BST_TYPE
::
Assert
);
||
terminator
->
type
()
==
BST_TYPE
::
Assert
);
}
}
...
...
src/core/cfg.h
View file @
b3f86e63
...
@@ -102,7 +102,7 @@ public:
...
@@ -102,7 +102,7 @@ public:
}
}
return
size
;
return
size
;
}
}
BST_stmt
*
get
LastStmt
()
const
{
BST_stmt
*
get
Terminator
()
const
{
// TODO: this is inefficient
// TODO: this is inefficient
for
(
BST_stmt
*
stmt
:
*
this
)
{
for
(
BST_stmt
*
stmt
:
*
this
)
{
if
(
stmt
->
is_terminator
())
if
(
stmt
->
is_terminator
())
...
...
test/unittests/analysis.cpp
View file @
b3f86e63
...
@@ -75,7 +75,7 @@ TEST_F(AnalysisTest, augassign) {
...
@@ -75,7 +75,7 @@ TEST_F(AnalysisTest, augassign) {
for
(
CFGBlock
*
block
:
cfg
->
blocks
)
{
for
(
CFGBlock
*
block
:
cfg
->
blocks
)
{
//printf("%d\n", block->idx);
//printf("%d\n", block->idx);
if
(
block
->
get
LastStmt
()
->
type
()
!=
BST_TYPE
::
Return
)
if
(
block
->
get
Terminator
()
->
type
()
!=
BST_TYPE
::
Return
)
ASSERT_TRUE
(
liveness
->
isLiveAtEnd
(
vregs
.
getVReg
(
module
->
interned_strings
->
get
(
"a"
)),
block
));
ASSERT_TRUE
(
liveness
->
isLiveAtEnd
(
vregs
.
getVReg
(
module
->
interned_strings
->
get
(
"a"
)),
block
));
}
}
...
...
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