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
d7934a4c
Commit
d7934a4c
authored
Aug 21, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a couple things not gc-allocated
parent
978974b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
src/runtime/int.cpp
src/runtime/int.cpp
+3
-3
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+10
-2
No files found.
src/runtime/int.cpp
View file @
d7934a4c
...
...
@@ -241,17 +241,17 @@ extern "C" PyObject* PyInt_FromString(const char* s, char** pend, int base) noex
#ifdef Py_USING_UNICODE
extern
"C"
PyObject
*
PyInt_FromUnicode
(
Py_UNICODE
*
s
,
Py_ssize_t
length
,
int
base
)
noexcept
{
PyObject
*
result
;
char
*
buffer
=
(
char
*
)
PyMem_MALLOC
(
length
+
1
);
char
*
buffer
=
(
char
*
)
malloc
(
length
+
1
);
if
(
buffer
==
NULL
)
return
PyErr_NoMemory
();
if
(
PyUnicode_EncodeDecimal
(
s
,
length
,
buffer
,
NULL
))
{
PyMem_FREE
(
buffer
);
free
(
buffer
);
return
NULL
;
}
result
=
PyInt_FromString
(
buffer
,
NULL
,
base
);
PyMem_FREE
(
buffer
);
free
(
buffer
);
return
result
;
}
#endif
...
...
src/runtime/objmodel.cpp
View file @
d7934a4c
...
...
@@ -39,6 +39,7 @@
#include "core/types.h"
#include "gc/collector.h"
#include "gc/heap.h"
#include "gc/roots.h"
#include "runtime/classobj.h"
#include "runtime/dict.h"
#include "runtime/file.h"
...
...
@@ -3177,7 +3178,11 @@ void rearrangeArguments(ParamReceiveSpec paramspec, const ParamNames* param_name
params_filled
[
i
]
=
true
;
}
std
::
vector
<
Box
*
,
StlCompatAllocator
<
Box
*>>
unused_positional
;
// unussed_positional relies on the fact that all the args (including a potentially-created varargs) will keep its
// contents alive
llvm
::
SmallVector
<
Box
*
,
4
>
unused_positional
;
unused_positional
.
reserve
(
argspec
.
num_args
-
positional_to_positional
+
varargs_size
-
varargs_to_positional
);
RewriterVar
::
SmallVector
unused_positional_rvars
;
for
(
int
i
=
positional_to_positional
;
i
<
argspec
.
num_args
;
i
++
)
{
unused_positional
.
push_back
(
getArg
(
i
,
arg1
,
arg2
,
arg3
,
args
));
...
...
@@ -3236,13 +3241,16 @@ void rearrangeArguments(ParamReceiveSpec paramspec, const ParamNames* param_name
}
}
Box
*
ovarargs
=
BoxedTuple
::
create
(
unused_positional
.
size
(),
&
unused_positional
[
0
]
);
Box
*
ovarargs
=
BoxedTuple
::
create
(
unused_positional
.
size
(),
unused_positional
.
data
()
);
getArg
(
varargs_idx
,
oarg1
,
oarg2
,
oarg3
,
oargs
)
=
ovarargs
;
}
else
if
(
unused_positional
.
size
())
{
raiseExcHelper
(
TypeError
,
"%s() takes at most %d argument%s (%ld given)"
,
func_name
,
paramspec
.
num_args
,
(
paramspec
.
num_args
==
1
?
""
:
"s"
),
argspec
.
num_args
+
argspec
.
num_keywords
+
varargs_size
);
}
// unused_positional relies on varargs being alive so that it doesn't have to do its own tracking.
GC_KEEP_ALIVE
(
varargs
);
////
// Second, apply any keywords:
...
...
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