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
a0affc4e
Commit
a0affc4e
authored
Jul 05, 2016
by
Marius Wachtler
Committed by
GitHub
Jul 05, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1270 from Daetalus/scipy_fixing4_nexedi
fix some scipy segfaults
parents
20c9a7dc
7f56274b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
23 deletions
+31
-23
src/asm_writing/rewriter.cpp
src/asm_writing/rewriter.cpp
+5
-3
src/asm_writing/rewriter.h
src/asm_writing/rewriter.h
+3
-0
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+23
-20
No files found.
src/asm_writing/rewriter.cpp
View file @
a0affc4e
...
...
@@ -448,8 +448,10 @@ void Rewriter::_getAttr(RewriterVar* result, RewriterVar* ptr, int offset, Locat
ptr
->
bumpUseEarlyIfPossible
();
assembler
::
Register
newvar_reg
=
result
->
initializeInReg
(
dest
);
assembler
->
mov_generic
(
assembler
::
Indirect
(
ptr_reg
,
offset
),
newvar_reg
,
type
);
if
(
!
failed
)
{
assembler
::
Register
newvar_reg
=
result
->
initializeInReg
(
dest
);
assembler
->
mov_generic
(
assembler
::
Indirect
(
ptr_reg
,
offset
),
newvar_reg
,
type
);
}
result
->
releaseIfNoUses
();
...
...
@@ -2172,7 +2174,7 @@ assembler::Register RewriterVar::initializeInReg(Location l) {
// Add this to vars_by_locations
RewriterVar
*&
var
=
rewriter
->
vars_by_location
[
l
];
assert
(
!
var
);
assert
(
!
var
||
rewriter
->
failed
);
var
=
this
;
// Add the location to this
...
...
src/asm_writing/rewriter.h
View file @
a0affc4e
...
...
@@ -580,6 +580,9 @@ protected:
void
_callOptimalEncoding
(
assembler
::
Register
tmp_reg
,
void
*
func_addr
);
void
assertConsistent
()
{
if
(
failed
)
return
;
#ifndef NDEBUG
for
(
RewriterVar
&
var
:
vars
)
{
for
(
Location
l
:
var
.
locations
)
{
...
...
src/runtime/objmodel.cpp
View file @
a0affc4e
...
...
@@ -4210,25 +4210,6 @@ Box* rearrangeArgumentsAndCallInternal(ParamReceiveSpec paramspec, const ParamNa
memset
(
oargs
,
0
,
sizeof
(
Box
*
)
*
(
num_output_args
-
3
));
}
// Clear any increfs we did for when we throw an exception:
int
positional_to_positional
=
std
::
min
(
argspec
.
num_args
,
paramspec
.
num_args
);
auto
clear_refs
=
[
&
]()
{
switch
(
positional_to_positional
)
{
case
0
:
Py_XDECREF
(
oarg1
);
case
1
:
Py_XDECREF
(
oarg2
);
case
2
:
Py_XDECREF
(
oarg3
);
default:
for
(
int
i
=
std
::
max
(
positional_to_positional
-
3
,
0
);
i
<
num_output_args
-
3
;
i
++
)
{
Py_XDECREF
(
oargs
[
i
]);
}
}
};
ExceptionCleanup
<
decltype
(
clear_refs
)
>
cleanup
(
clear_refs
);
// I feel like there should be some way to automatically infer the decltype
static
StatCounter
slowpath_rearrangeargs_slowpath
(
"slowpath_rearrangeargs_slowpath"
);
slowpath_rearrangeargs_slowpath
.
log
();
...
...
@@ -4276,6 +4257,8 @@ Box* rearrangeArgumentsAndCallInternal(ParamReceiveSpec paramspec, const ParamNa
varargs_size
=
PySequence_Fast_GET_SIZE
(
varargs
);
}
int
positional_to_positional
=
std
::
min
(
argspec
.
num_args
,
paramspec
.
num_args
);
////
// First, match up positional parameters to positional/varargs:
for
(
int
i
=
0
;
i
<
positional_to_positional
;
i
++
)
{
...
...
@@ -4285,9 +4268,29 @@ Box* rearrangeArgumentsAndCallInternal(ParamReceiveSpec paramspec, const ParamNa
int
varargs_to_positional
=
std
::
min
((
int
)
varargs_size
,
paramspec
.
num_args
-
positional_to_positional
);
for
(
int
i
=
0
;
i
<
varargs_to_positional
;
i
++
)
{
assert
(
!
rewrite_args
&&
"would need to be handled here"
);
getArg
(
i
+
positional_to_positional
,
oarg1
,
oarg2
,
oarg3
,
oargs
)
=
incref
(
PySequence_Fast_GET_ITEM
(
varargs
,
i
)
);
getArg
(
i
+
positional_to_positional
,
oarg1
,
oarg2
,
oarg3
,
oargs
)
=
PySequence_Fast_GET_ITEM
(
varargs
,
i
);
}
// Clear any increfs we did for when we throw an exception:
auto
clear_refs
=
[
&
]()
{
switch
(
positional_to_positional
+
varargs_to_positional
)
{
case
0
:
Py_XDECREF
(
oarg1
);
case
1
:
Py_XDECREF
(
oarg2
);
case
2
:
Py_XDECREF
(
oarg3
);
default:
for
(
int
i
=
std
::
max
(
positional_to_positional
+
varargs_to_positional
-
3
,
0
);
i
<
num_output_args
-
3
;
i
++
)
{
Py_XDECREF
(
oargs
[
i
]);
}
}
};
ExceptionCleanup
<
decltype
(
clear_refs
)
>
cleanup
(
clear_refs
);
// I feel like there should be some way to automatically infer the decltype
llvm
::
SmallVector
<
bool
,
8
>
params_filled
(
num_output_args
);
for
(
int
i
=
0
;
i
<
positional_to_positional
+
varargs_to_positional
;
i
++
)
{
params_filled
[
i
]
=
true
;
...
...
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