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
c96527c6
Commit
c96527c6
authored
Apr 07, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow NULLs in the vreg array
parent
f3665373
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+12
-9
test/tests/deopt_tests.py
test/tests/deopt_tests.py
+0
-1
test/tests/locals_test.py
test/tests/locals_test.py
+0
-2
No files found.
src/codegen/irgen/irgenerator.cpp
View file @
c96527c6
...
...
@@ -1869,7 +1869,8 @@ private:
}
template
<
typename
GetLLVMValCB
>
void
_setVRegIfUserVisible
(
InternedString
name
,
GetLLVMValCB
get_llvm_val_cb
,
CompilerVariable
*
prev
)
{
void
_setVRegIfUserVisible
(
InternedString
name
,
GetLLVMValCB
get_llvm_val_cb
,
CompilerVariable
*
prev
,
bool
potentially_undefined
)
{
auto
cfg
=
irstate
->
getSourceInfo
()
->
cfg
;
if
(
!
cfg
->
hasVregsAssigned
())
irstate
->
getMD
()
->
calculateNumVRegs
();
...
...
@@ -1884,6 +1885,8 @@ private:
if
(
prev
)
{
auto
*
old_value
=
emitter
.
getBuilder
()
->
CreateLoad
(
gep
);
emitter
.
setType
(
old_value
,
RefType
::
OWNED
);
if
(
potentially_undefined
)
emitter
.
setNullable
(
old_value
,
true
);
}
llvm
::
Value
*
new_val
=
get_llvm_val_cb
();
...
...
@@ -1930,7 +1933,7 @@ private:
// Clear out the is_defined name since it is now definitely defined:
assert
(
!
isIsDefinedName
(
name
.
s
()));
InternedString
defined_name
=
getIsDefinedName
(
name
);
_popFake
(
defined_name
,
true
);
bool
maybe_was_undefined
=
_popFake
(
defined_name
,
true
);
if
(
vst
==
ScopeInfo
::
VarScopeType
::
CLOSURE
)
{
size_t
offset
=
scope_info
->
getClosureOffset
(
name
);
...
...
@@ -1949,7 +1952,7 @@ private:
}
auto
&&
get_llvm_val
=
[
&
]()
{
return
val
->
makeConverted
(
emitter
,
UNKNOWN
)
->
getValue
();
};
_setVRegIfUserVisible
(
name
,
get_llvm_val
,
prev
);
_setVRegIfUserVisible
(
name
,
get_llvm_val
,
prev
,
maybe_was_undefined
);
}
}
...
...
@@ -2136,7 +2139,12 @@ private:
assert
(
vst
==
ScopeInfo
::
VarScopeType
::
FAST
);
CompilerVariable
*
prev
=
symbol_table
.
count
(
target
->
id
)
?
symbol_table
[
target
->
id
]
:
NULL
;
_setVRegIfUserVisible
(
target
->
id
,
[]()
{
return
getNullPtr
(
g
.
llvm_value_type_ptr
);
},
prev
);
InternedString
defined_name
=
getIsDefinedName
(
target
->
id
);
ConcreteCompilerVariable
*
is_defined_var
=
static_cast
<
ConcreteCompilerVariable
*>
(
_getFake
(
defined_name
,
true
));
_setVRegIfUserVisible
(
target
->
id
,
[]()
{
return
getNullPtr
(
g
.
llvm_value_type_ptr
);
},
prev
,
(
bool
)
is_defined_var
);
if
(
symbol_table
.
count
(
target
->
id
)
==
0
)
{
llvm
::
CallSite
call
=
emitter
.
createCall
(
...
...
@@ -2148,9 +2156,6 @@ private:
return
;
}
InternedString
defined_name
=
getIsDefinedName
(
target
->
id
);
ConcreteCompilerVariable
*
is_defined_var
=
static_cast
<
ConcreteCompilerVariable
*>
(
_getFake
(
defined_name
,
true
));
if
(
is_defined_var
)
{
emitter
.
createCall
(
unw_info
,
g
.
funcs
.
assertNameDefined
,
...
...
@@ -2668,8 +2673,6 @@ private:
llvm
::
Value
*
v
;
if
(
phi_type
==
phi_type
->
getBoxType
())
{
v
=
emitter
.
getNone
()
->
getValue
();
if
(
new_state
!=
DEAD
)
_setVRegIfUserVisible
(
*
it
,
[
&
]()
{
return
v
;
},
NULL
);
}
else
{
v
=
llvm
::
UndefValue
::
get
(
phi_type
->
llvmType
());
}
...
...
test/tests/deopt_tests.py
View file @
c96527c6
# expected: reffail
# skip-if: '-O' in EXTRA_JIT_ARGS
# statcheck: 4 <= noninit_count('num_deopt') < 50
# statcheck: 1 <= stats["num_osr_exits"] <= 2
...
...
test/tests/locals_test.py
View file @
c96527c6
# expected: reffail
# - locals() returns None for undefined values due to the changes refcounting made to how we store uninitialized variables.
def
f1
():
l
=
[]
for
i
in
xrange
(
5
):
...
...
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