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
5500b773
Commit
5500b773
authored
Jul 06, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some vreg-reuse confusion
parent
a0529f48
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
13 deletions
+27
-13
src/analysis/function_analysis.cpp
src/analysis/function_analysis.cpp
+10
-3
src/core/cfg.cpp
src/core/cfg.cpp
+17
-10
No files found.
src/analysis/function_analysis.cpp
View file @
5500b773
...
...
@@ -158,11 +158,10 @@ bool LivenessAnalysis::isLiveAtEnd(int vreg, CFGBlock* block) {
if
(
vreg
<
block
->
cfg
->
getVRegInfo
().
getNumOfUserVisibleVRegs
())
return
true
;
// For block-local vregs, this query doesn't really make sense,
// since the vreg will be live but that's probably not what we care about.
// It's probably safe to return false, but let's just error for now.
#ifndef NDEBUG
if
(
block
->
cfg
->
getVRegInfo
().
isBlockLocalVReg
(
vreg
))
return
false
;
#endif
if
(
block
->
successors
.
size
()
==
0
)
return
false
;
...
...
@@ -206,6 +205,14 @@ bool LivenessAnalysis::isLiveAtEnd(int vreg, CFGBlock* block) {
us_liveness
.
log
(
_t
.
end
());
}
// For block-local vregs, this query doesn't really make sense,
// since the vreg will be live but that's probably not what we care about.
// It's probably safe to return false, but let's just error for now.
if
(
block
->
cfg
->
getVRegInfo
().
isBlockLocalVReg
(
vreg
))
{
ASSERT
(
!
result_cache
[
vreg
][
block
],
"%d in %d"
,
vreg
,
block
->
idx
);
return
false
;
}
return
result_cache
[
vreg
][
block
];
}
...
...
src/core/cfg.cpp
View file @
5500b773
...
...
@@ -232,6 +232,9 @@ private:
CFGBlock
*
exc_dest
;
// variable names to store the exception (type, value, traceback) in
InternedString
exc_type_name
,
exc_value_name
,
exc_traceback_name
;
// Similar to did_why: says whether the block might have been jumped-to
bool
maybe_taken
;
};
// ---------- Member fields ----------
...
...
@@ -1576,6 +1579,7 @@ public:
curblock
->
connectTo
(
exc_dest
);
ExcBlockInfo
&
exc_info
=
exc_handlers
.
back
();
exc_info
.
maybe_taken
=
true
;
curblock
=
exc_dest
;
// TODO: need to clear some temporaries here
...
...
@@ -2341,7 +2345,7 @@ public:
InternedString
exc_type_name
=
nodeName
(
"type"
);
InternedString
exc_value_name
=
nodeName
(
"value"
);
InternedString
exc_traceback_name
=
nodeName
(
"traceback"
);
exc_handlers
.
push_back
({
exc_handler_block
,
exc_type_name
,
exc_value_name
,
exc_traceback_name
});
exc_handlers
.
push_back
({
exc_handler_block
,
exc_type_name
,
exc_value_name
,
exc_traceback_name
,
false
});
for
(
AST_stmt
*
subnode
:
node
->
body
)
{
subnode
->
accept
(
this
);
...
...
@@ -2464,7 +2468,7 @@ public:
InternedString
exc_value_name
=
nodeName
(
"value"
);
InternedString
exc_traceback_name
=
nodeName
(
"traceback"
);
InternedString
exc_why_name
=
nodeName
(
"why"
);
exc_handlers
.
push_back
({
exc_handler_block
,
exc_type_name
,
exc_value_name
,
exc_traceback_name
});
exc_handlers
.
push_back
({
exc_handler_block
,
exc_type_name
,
exc_value_name
,
exc_traceback_name
,
false
});
CFGBlock
*
finally_block
=
cfg
->
addDeferredBlock
();
pushFinallyContinuation
(
finally_block
,
exc_why_name
);
...
...
@@ -2475,6 +2479,7 @@ public:
break
;
}
bool
maybe_exception
=
exc_handlers
.
back
().
maybe_taken
;
exc_handlers
.
pop_back
();
int
did_why
=
continuations
.
back
().
did_why
;
// bad to just reach in like this
...
...
@@ -2512,16 +2517,18 @@ public:
exitFinallyIf
(
node
,
Why
::
BREAK
,
exc_why_name
);
if
(
did_why
&
(
1
<<
Why
::
CONTINUE
))
exitFinallyIf
(
node
,
Why
::
CONTINUE
,
exc_why_name
);
if
(
maybe_exception
)
{
CFGBlock
*
reraise
=
cfg
->
addDeferredBlock
();
CFGBlock
*
noexc
=
makeFinallyCont
(
Why
::
EXCEPTION
,
makeLoad
(
exc_why_name
,
node
,
true
),
reraise
);
cfg
->
placeBlock
(
reraise
);
curblock
=
reraise
;
pushReraise
(
getLastLinenoSub
(
node
->
finalbody
.
back
()),
exc_type_name
,
exc_value_name
,
exc_traceback_name
);
pushReraise
(
getLastLinenoSub
(
node
->
finalbody
.
back
()),
exc_type_name
,
exc_value_name
,
exc_traceback_name
);
curblock
=
noexc
;
}
}
return
true
;
}
...
...
@@ -2585,7 +2592,7 @@ public:
CFGBlock
*
exc_block
=
cfg
->
addDeferredBlock
();
exc_block
->
info
=
"with_exc"
;
exc_handlers
.
push_back
({
exc_block
,
exc_type_name
,
exc_value_name
,
exc_traceback_name
});
exc_handlers
.
push_back
({
exc_block
,
exc_type_name
,
exc_value_name
,
exc_traceback_name
,
false
});
for
(
int
i
=
0
;
i
<
node
->
body
.
size
();
i
++
)
{
node
->
body
[
i
]
->
accept
(
this
);
...
...
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