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
cdaed13f
Commit
cdaed13f
authored
Jun 27, 2016
by
Kevin Modzelewski
Committed by
Kevin Modzelewski
Jul 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update unittests
And update sys_test to support apport overriding excepthook
parent
279edc79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
15 deletions
+22
-15
test/tests/sys_test.py
test/tests/sys_test.py
+2
-1
test/unittests/analysis.cpp
test/unittests/analysis.cpp
+20
-14
No files found.
test/tests/sys_test.py
View file @
cdaed13f
import
sys
import
os.path
print
sys
.
excepthook
,
sys
.
displayhook
assert
callable
(
sys
.
excepthook
)
print
sys
.
displayhook
print
sys
.
version
[:
3
]
print
os
.
path
.
exists
(
sys
.
executable
)
print
sys
.
copyright
[
-
200
:]
...
...
test/unittests/analysis.cpp
View file @
cdaed13f
...
...
@@ -46,13 +46,14 @@ TEST_F(AnalysisTest, augassign) {
ParamNames
param_names
(
si
->
ast
,
si
->
getInternedStrings
());
CFG
*
cfg
=
computeCFG
(
si
,
func
->
body
,
param_names
);
std
::
unique_ptr
<
LivenessAnalysis
>
liveness
=
computeLivenessInfo
(
cfg
);
auto
&&
vregs
=
cfg
->
getVRegInfo
();
//cfg->print();
for
(
CFGBlock
*
block
:
cfg
->
blocks
)
{
//printf("%d\n", block->idx);
if
(
block
->
body
.
back
()
->
type
!=
AST_TYPE
::
Return
)
ASSERT_TRUE
(
liveness
->
isLiveAtEnd
(
module
->
interned_strings
->
get
(
"a"
),
block
));
ASSERT_TRUE
(
liveness
->
isLiveAtEnd
(
vregs
.
getVReg
(
module
->
interned_strings
->
get
(
"a"
)
),
block
));
}
std
::
unique_ptr
<
PhiAnalysis
>
phis
=
computeRequiredPhis
(
ParamNames
(
func
,
si
->
getInternedStrings
()),
cfg
,
liveness
.
get
(),
scope_info
);
...
...
@@ -76,10 +77,13 @@ void doOsrTest(bool is_osr, bool i_maybe_undefined) {
FunctionMetadata
*
clfunc
=
new
FunctionMetadata
(
0
,
false
,
false
,
std
::
move
(
si
));
CFG
*
cfg
=
computeCFG
(
clfunc
->
source
.
get
(),
func
->
body
,
clfunc
->
param_names
);
clfunc
->
source
->
cfg
=
cfg
;
std
::
unique_ptr
<
LivenessAnalysis
>
liveness
=
computeLivenessInfo
(
cfg
);
// cfg->print();
auto
&&
vregs
=
cfg
->
getVRegInfo
();
InternedString
i_str
=
module
->
interned_strings
->
get
(
"i"
);
InternedString
idi_str
=
module
->
interned_strings
->
get
(
"!is_defined_i"
);
InternedString
iter_str
=
module
->
interned_strings
->
get
(
"#iter_3"
);
...
...
@@ -95,11 +99,14 @@ void doOsrTest(bool is_osr, bool i_maybe_undefined) {
std
::
unique_ptr
<
PhiAnalysis
>
phis
;
if
(
is_osr
)
{
int
vreg
=
vregs
.
getVReg
(
i_str
);
OSREntryDescriptor
*
entry_descriptor
=
OSREntryDescriptor
::
create
(
clfunc
,
backedge
,
CXX
);
entry_descriptor
->
args
[
i_str
]
=
NULL
;
// need to set it to non-null
ConcreteCompilerType
*
fake_type
=
(
ConcreteCompilerType
*
)
1
;
entry_descriptor
->
args
[
vreg
]
=
fake_type
;
if
(
i_maybe_undefined
)
entry_descriptor
->
args
[
idi_str
]
=
NULL
;
entry_descriptor
->
args
[
iter_str
]
=
NULL
;
entry_descriptor
->
potentially_undefined
.
set
(
vreg
)
;
entry_descriptor
->
args
[
vregs
.
getVReg
(
iter_str
)]
=
fake_type
;
phis
=
computeRequiredPhis
(
entry_descriptor
,
liveness
.
get
(),
scope_info
);
}
else
{
phis
=
computeRequiredPhis
(
ParamNames
(
func
,
clfunc
->
source
->
getInternedStrings
()),
cfg
,
liveness
.
get
(),
scope_info
);
...
...
@@ -110,15 +117,14 @@ void doOsrTest(bool is_osr, bool i_maybe_undefined) {
// into the BB which the analysis might not otherwise track.
auto
required_phis
=
phis
->
getAllRequiredFor
(
backedge
->
target
);
EXPECT_EQ
(
1
,
required_phis
.
count
(
i_str
));
EXPECT_EQ
(
0
,
required_phis
.
count
(
idi_str
));
EXPECT_EQ
(
1
,
required_phis
.
count
(
iter_str
));
EXPECT_EQ
(
2
,
required_phis
.
size
());
EXPECT_EQ
(
1
,
required_phis
[
vregs
.
getVReg
(
i_str
)]);
EXPECT_EQ
(
1
,
required_phis
[
vregs
.
getVReg
(
iter_str
)]);
EXPECT_EQ
(
2
,
required_phis
.
numSet
());
EXPECT_EQ
(
!
is_osr
||
i_maybe_undefined
,
phis
->
isPotentiallyUndefinedAt
(
i_str
,
backedge
->
target
));
EXPECT_FALSE
(
phis
->
isPotentiallyUndefinedAt
(
iter_str
,
backedge
->
target
));
EXPECT_EQ
(
!
is_osr
||
i_maybe_undefined
,
phis
->
isPotentiallyUndefinedAfter
(
i_str
,
loop_backedge
));
EXPECT_FALSE
(
phis
->
isPotentiallyUndefinedAfter
(
iter_str
,
loop_backedge
));
EXPECT_EQ
(
!
is_osr
||
i_maybe_undefined
,
phis
->
isPotentiallyUndefinedAt
(
vregs
.
getVReg
(
i_str
)
,
backedge
->
target
));
EXPECT_FALSE
(
phis
->
isPotentiallyUndefinedAt
(
vregs
.
getVReg
(
iter_str
)
,
backedge
->
target
));
EXPECT_EQ
(
!
is_osr
||
i_maybe_undefined
,
phis
->
isPotentiallyUndefinedAfter
(
vregs
.
getVReg
(
i_str
)
,
loop_backedge
));
EXPECT_FALSE
(
phis
->
isPotentiallyUndefinedAfter
(
vregs
.
getVReg
(
iter_str
)
,
loop_backedge
));
// Now, let's verify that we don't need a phi after the loop
...
...
@@ -127,9 +133,9 @@ void doOsrTest(bool is_osr, bool i_maybe_undefined) {
ASSERT_EQ
(
2
,
if_join
->
predecessors
.
size
());
if
(
is_osr
)
EXPECT_EQ
(
0
,
phis
->
getAllRequiredFor
(
if_join
).
size
());
EXPECT_EQ
(
0
,
phis
->
getAllRequiredFor
(
if_join
).
numSet
());
else
EXPECT_EQ
(
1
,
phis
->
getAllRequiredFor
(
if_join
).
size
());
EXPECT_EQ
(
1
,
phis
->
getAllRequiredFor
(
if_join
).
numSet
());
}
TEST_F
(
AnalysisTest
,
osr_initial
)
{
...
...
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