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
224e1ea7
Commit
224e1ea7
authored
Jul 24, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug around instancemethod vref counting
parent
20a52359
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
src/codegen/compvars.cpp
src/codegen/compvars.cpp
+5
-4
test/tests/im_duping.py
test/tests/im_duping.py
+11
-0
No files found.
src/codegen/compvars.cpp
View file @
224e1ea7
...
...
@@ -43,10 +43,7 @@ std::string ValuedCompilerType<llvm::Value*>::debugName() {
struct
RawInstanceMethod
{
CompilerVariable
*
obj
,
*
func
;
RawInstanceMethod
(
CompilerVariable
*
obj
,
CompilerVariable
*
func
)
:
obj
(
obj
),
func
(
func
)
{
obj
->
incvref
();
func
->
incvref
();
}
RawInstanceMethod
(
CompilerVariable
*
obj
,
CompilerVariable
*
func
)
:
obj
(
obj
),
func
(
func
)
{}
};
class
InstanceMethodType
:
public
ValuedCompilerType
<
RawInstanceMethod
*>
{
...
...
@@ -76,6 +73,8 @@ public:
static
CompilerVariable
*
makeIM
(
CompilerVariable
*
obj
,
CompilerVariable
*
func
)
{
CompilerVariable
*
rtn
=
new
ValuedCompilerVariable
<
RawInstanceMethod
*>
(
InstanceMethodType
::
get
(
obj
->
getType
(),
func
->
getType
()),
new
RawInstanceMethod
(
obj
,
func
),
true
);
obj
->
incvref
();
func
->
incvref
();
return
rtn
;
}
...
...
@@ -141,6 +140,8 @@ public:
RawInstanceMethod
*
im
=
var
->
getValue
();
RawInstanceMethod
*
new_im
=
new
RawInstanceMethod
(
im
->
obj
->
dup
(
cache
),
im
->
func
->
dup
(
cache
));
rtn
=
new
VAR
(
this
,
new_im
,
var
->
isGrabbed
());
while
(
rtn
->
getVrefs
()
<
var
->
getVrefs
())
rtn
->
incvref
();
}
return
rtn
;
}
...
...
test/tests/im_duping.py
0 → 100644
View file @
224e1ea7
# Regressin test: internal tracking of non-instantiated instancemethods was incorrect
def
f
():
items
=
[
1
for
i
in
xrange
(
10
)]
set
=
[]
setappend
=
set
.
append
for
item
in
range
(
5
):
setappend
(
item
)
print
set
f
()
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