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
0f8b5369
Commit
0f8b5369
authored
Feb 24, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turn off debugging output
parent
be788bfa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
20 deletions
+19
-20
src/codegen/irgen.cpp
src/codegen/irgen.cpp
+1
-1
src/codegen/irgen/refcounts.cpp
src/codegen/irgen/refcounts.cpp
+14
-16
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+1
-1
src/runtime/types.cpp
src/runtime/types.cpp
+3
-2
No files found.
src/codegen/irgen.cpp
View file @
0f8b5369
...
...
@@ -864,7 +864,7 @@ static void emitBBs(IRGenState* irstate, TypeAnalysis* types, const OSREntryDesc
llvm_phi
->
addIncoming
(
v
->
getValue
(),
llvm_exit_blocks
[
b
->
predecessors
[
j
]]);
if
(
v
->
getType
()
->
getBoxType
()
==
v
->
getType
())
{
llvm
::
outs
()
<<
*
v
->
getValue
()
<<
" is getting consumed by phi "
<<
*
llvm_phi
<<
'\n'
;
//
llvm::outs() << *v->getValue() << " is getting consumed by phi " << *llvm_phi << '\n';
irstate
->
getRefcounts
()
->
setType
(
llvm_phi
,
RefType
::
OWNED
);
assert
(
llvm
::
isa
<
llvm
::
BranchInst
>
(
llvm_exit_blocks
[
b
->
predecessors
[
j
]]
->
getTerminator
()));
irstate
->
getRefcounts
()
->
refConsumed
(
v
->
getValue
(),
llvm_exit_blocks
[
b
->
predecessors
[
j
]]
->
getTerminator
());
...
...
src/codegen/irgen/refcounts.cpp
View file @
0f8b5369
...
...
@@ -211,7 +211,7 @@ static std::vector<llvm::BasicBlock*> computeTraversalOrder(llvm::Function* f) {
for
(
auto
&&
BB
:
*
f
)
{
if
(
llvm
::
succ_begin
(
&
BB
)
==
llvm
::
succ_end
(
&
BB
))
{
llvm
::
outs
()
<<
"Adding "
<<
BB
.
getName
()
<<
" since it is an exit node.
\n
"
;
//
llvm::outs() << "Adding " << BB.getName() << " since it is an exit node.\n";
ordering
.
push_back
(
&
BB
);
added
.
insert
(
&
BB
);
}
...
...
@@ -235,7 +235,7 @@ static std::vector<llvm::BasicBlock*> computeTraversalOrder(llvm::Function* f) {
if
(
num_successors_added
[
PBB
]
==
num_successors
)
{
ordering
.
push_back
(
PBB
);
added
.
insert
(
PBB
);
llvm
::
outs
()
<<
"Adding "
<<
PBB
->
getName
()
<<
" since it has all of its successors added.
\n
"
;
//
llvm::outs() << "Adding " << PBB->getName() << " since it has all of its successors added.\n";
}
}
}
else
{
...
...
@@ -283,7 +283,7 @@ static std::vector<llvm::BasicBlock*> computeTraversalOrder(llvm::Function* f) {
assert
(
best
);
ordering
.
push_back
(
best
);
added
.
insert
(
best
);
llvm
::
outs
()
<<
"Adding "
<<
best
->
getName
()
<<
" since it is the best provisional node.
\n
"
;
//
llvm::outs() << "Adding " << best->getName() << " since it is the best provisional node.\n";
}
}
...
...
@@ -354,7 +354,7 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) {
llvm
::
Function
*
f
=
irstate
->
getLLVMFunction
();
RefcountTracker
*
rt
=
irstate
->
getRefcounts
();
if
(
VERBOSITY
())
{
if
(
VERBOSITY
()
>=
2
)
{
fprintf
(
stderr
,
"Before refcounts:
\n
"
);
fprintf
(
stderr
,
"
\033
[35m"
);
dumpPrettyIR
(
f
);
...
...
@@ -472,8 +472,10 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) {
}
#endif
llvm
::
outs
()
<<
'\n'
;
llvm
::
outs
()
<<
"Processing "
<<
BB
.
getName
()
<<
'\n'
;
if
(
VERBOSITY
()
>=
2
)
{
llvm
::
outs
()
<<
'\n'
;
llvm
::
outs
()
<<
"Processing "
<<
BB
.
getName
()
<<
'\n'
;
}
RefState
&
state
=
states
[
&
BB
];
...
...
@@ -576,9 +578,9 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) {
if
(
num_times_as_op
[
op
]
>
num_consumed
)
{
if
(
rt
->
vars
[
op
].
reftype
==
RefType
::
OWNED
)
{
if
(
state
.
ending_refs
[
op
]
==
0
)
{
// Don't do any updates now since we are iterating over the bb
llvm
::
outs
()
<<
"Last use of "
<<
*
op
<<
" is at "
<<
I
<<
"; adding a decref after
\n
"
;
// llvm::outs() << "Last use of " << *op << " is at " << I << "; adding a decref after\n";
// Don't do any updates now since we are iterating over the bb
if
(
llvm
::
InvokeInst
*
invoke
=
llvm
::
dyn_cast
<
llvm
::
InvokeInst
>
(
&
I
))
{
state
.
decrefs
.
push_back
(
RefOp
({
op
,
rt
->
vars
[
op
].
nullable
,
1
,
findIncrefPt
(
invoke
->
getNormalDest
())}));
state
.
decrefs
.
push_back
(
RefOp
({
op
,
rt
->
vars
[
op
].
nullable
,
1
,
findIncrefPt
(
invoke
->
getUnwindDest
())}));
...
...
@@ -600,7 +602,9 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) {
}
}
llvm
::
outs
()
<<
"End of "
<<
BB
.
getName
()
<<
'\n'
;
if
(
VERBOSITY
()
>=
2
)
{
llvm
::
outs
()
<<
"End of "
<<
BB
.
getName
()
<<
'\n'
;
}
// Handle variables that were defined in this BB:
for
(
auto
&&
p
:
rt
->
vars
)
{
...
...
@@ -625,9 +629,6 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) {
}
}
state
.
ending_refs
.
erase
(
inst
);
}
else
{
if
(
state
.
ending_refs
.
count
(
p
.
first
))
llvm
::
outs
()
<<
*
p
.
first
<<
" "
<<
state
.
ending_refs
[
p
.
first
]
<<
'\n'
;
}
}
...
...
@@ -659,13 +660,10 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) {
}
if
(
endingRefsDifferent
(
orig_ending_refs
,
state
.
ending_refs
))
{
llvm
::
outs
()
<<
"changed!
\n
"
;
for
(
auto
&&
SBB
:
llvm
::
predecessors
(
&
BB
))
{
// llvm::outs() << "reconsidering: " << SBB->getName() << '\n';
orderer
.
add
(
SBB
);
}
}
else
{
llvm
::
outs
()
<<
"no changes
\n
"
;
}
}
...
...
@@ -679,7 +677,7 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) {
addDecrefs
(
op
.
operand
,
op
.
nullable
,
op
.
num_refs
,
op
.
insertion_pt
);
}
if
(
VERBOSITY
())
{
if
(
VERBOSITY
()
>=
2
)
{
fprintf
(
stderr
,
"After refcounts:
\n
"
);
fprintf
(
stderr
,
"
\033
[35m"
);
dumpPrettyIR
(
f
);
...
...
src/runtime/objmodel.cpp
View file @
0f8b5369
...
...
@@ -3172,7 +3172,7 @@ BoxedInt* lenInternal(Box* obj, LenRewriteArgs* rewrite_args) noexcept(S == CAPI
// but the docs say -1. TODO it would be nice to just handle any negative value.
rewrite_args
->
rewriter
->
checkAndThrowCAPIException
(
r_n
,
-
1
);
RewriterVar
*
r_r
=
rewrite_args
->
rewriter
->
call
(
false
,
(
void
*
)
boxInt
,
r_n
);
RewriterVar
*
r_r
=
rewrite_args
->
rewriter
->
call
(
false
,
(
void
*
)
boxInt
,
r_n
)
->
setType
(
RefType
::
OWNED
)
;
rewrite_args
->
out_success
=
true
;
rewrite_args
->
out_rtn
=
r_r
;
...
...
src/runtime/types.cpp
View file @
0f8b5369
...
...
@@ -4452,9 +4452,10 @@ extern "C" void Py_Finalize() noexcept {
teardownCodegen
();
PRINT_TOTAL_REFS
();
if
(
VERBOSITY
())
PRINT_TOTAL_REFS
();
#ifdef Py_REF_DEBUG
assert
(
_Py_RefTotal
==
0
);
RELEASE_ASSERT
(
_Py_RefTotal
==
0
,
"%ld refs remaining!"
,
_Py_RefTotal
);
#endif
}
}
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