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
075f148d
Commit
075f148d
authored
Nov 20, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Running up to compileAndRunModule
parent
691b1409
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
41 deletions
+28
-41
src/capi/typeobject.cpp
src/capi/typeobject.cpp
+2
-2
src/codegen/irgen/hooks.cpp
src/codegen/irgen/hooks.cpp
+1
-1
src/core/threading.h
src/core/threading.h
+0
-13
src/jit.cpp
src/jit.cpp
+1
-7
src/runtime/builtin_modules/sys.cpp
src/runtime/builtin_modules/sys.cpp
+2
-1
src/runtime/import.cpp
src/runtime/import.cpp
+2
-2
src/runtime/list.cpp
src/runtime/list.cpp
+12
-11
src/runtime/types.cpp
src/runtime/types.cpp
+8
-4
No files found.
src/capi/typeobject.cpp
View file @
075f148d
...
...
@@ -452,7 +452,7 @@ static PyObject* lookup_maybe(PyObject* self, const char* attrstr, PyObject** at
PyObject
*
res
;
if
(
*
attrobj
==
NULL
)
{
*
attrobj
=
PyString_InternFrom
String
(
attrstr
);
*
attrobj
=
getStatic
String
(
attrstr
);
if
(
*
attrobj
==
NULL
)
return
NULL
;
}
...
...
@@ -466,7 +466,7 @@ static PyObject* lookup_maybe(PyObject* self, const char* attrstr, PyObject** at
return
NULL
;
}
}
return
obj
;
return
incref
(
obj
)
;
}
extern
"C"
PyObject
*
_PyObject_LookupSpecial
(
PyObject
*
self
,
const
char
*
attrstr
,
PyObject
**
attrobj
)
noexcept
{
...
...
src/codegen/irgen/hooks.cpp
View file @
075f148d
...
...
@@ -137,7 +137,7 @@ Box* SourceInfo::getDocString() {
return
boxString
(
static_cast
<
AST_Str
*>
(
static_cast
<
AST_Expr
*>
(
body
[
0
])
->
value
)
->
str_data
);
}
return
None
;
return
incref
(
None
)
;
}
ScopeInfo
*
SourceInfo
::
getScopeInfo
()
{
...
...
src/core/threading.h
View file @
075f148d
...
...
@@ -99,19 +99,6 @@ extern "C" inline void allowGLReadPreemption() {
}
#endif
RELEASE_ASSERT
(
0
,
"call pending finalizers?"
);
#if 0
// We need to call the finalizers on dead objects at some point. This is a safe place to do so.
// This needs to be done before checking for other threads waiting on the GIL since there could
// be only one thread doing a lot of work. Similarly for weakref callbacks.
//
// The conditional is an optimization - the function will do nothing if the lists are empty,
// but it's worth checking for to avoid the overhead of making a function call.
if (!gc::pending_finalization_list.empty() || !gc::weakrefs_needing_callback_list.empty()) {
gc::callPendingDestructionLogic();
}
#endif
// Double-checked locking: first read with no ordering constraint:
if
(
!
threads_waiting_on_gil
.
load
(
std
::
memory_order_relaxed
))
return
;
...
...
src/jit.cpp
View file @
075f148d
...
...
@@ -444,12 +444,6 @@ static int main(int argc, char** argv) noexcept {
_t
.
split
(
"to run"
);
BoxedModule
*
main_module
=
NULL
;
// XXX
{
Py_Finalize
();
return
0
;
}
// if the user invoked `pyston -c command`
if
(
command
!=
NULL
)
{
try
{
...
...
@@ -467,7 +461,7 @@ static int main(int argc, char** argv) noexcept {
main_module
=
createModule
(
boxString
(
"__main__"
),
"<string>"
);
rtncode
=
(
RunModule
(
module
,
1
)
!=
0
);
}
else
{
main_module
=
createModule
(
boxString
(
"__main__"
),
fn
?
fn
:
"<stdin>"
);
main_module
=
createModule
(
autoDecref
(
boxString
(
"__main__"
)
),
fn
?
fn
:
"<stdin>"
);
rtncode
=
0
;
if
(
fn
!=
NULL
)
{
rtncode
=
RunMainFromImporter
(
fn
);
...
...
src/runtime/builtin_modules/sys.cpp
View file @
075f148d
...
...
@@ -223,7 +223,8 @@ void prependToSysPath(llvm::StringRef path) {
BoxedList
*
sys_path
=
getSysPath
();
static
BoxedString
*
insert_str
=
getStaticString
(
"insert"
);
CallattrFlags
callattr_flags
{.
cls_only
=
false
,
.
null_on_nonexistent
=
false
,
.
argspec
=
ArgPassSpec
(
2
)
};
callattr
(
sys_path
,
insert_str
,
callattr_flags
,
boxInt
(
0
),
boxString
(
path
),
NULL
,
NULL
,
NULL
);
autoDecref
(
callattr
(
sys_path
,
insert_str
,
callattr_flags
,
autoDecref
(
boxInt
(
0
)),
autoDecref
(
boxString
(
path
)),
NULL
,
NULL
,
NULL
));
}
static
BoxedClass
*
sys_flags_cls
;
...
...
src/runtime/import.cpp
View file @
075f148d
...
...
@@ -707,11 +707,11 @@ Box* nullImporterInit(Box* self, Box* _path) {
if
(
isdir
(
path
->
data
()))
raiseExcHelper
(
ImportError
,
"existing directory"
);
return
None
;
Py_RETURN_NONE
;
}
Box
*
nullImporterFindModule
(
Box
*
self
,
Box
*
fullname
,
Box
*
path
)
{
return
None
;
Py_RETURN_NONE
;
}
extern
"C"
Box
*
import
(
int
level
,
Box
*
from_imports
,
llvm
::
StringRef
module_name
)
{
...
...
src/runtime/list.cpp
View file @
075f148d
...
...
@@ -336,7 +336,7 @@ static void _listSetitem(BoxedList* self, int64_t n, Box* v) {
extern
"C"
Box
*
listSetitemUnboxed
(
BoxedList
*
self
,
int64_t
n
,
Box
*
v
)
{
assert
(
PyList_Check
(
self
));
_listSetitem
(
self
,
n
,
v
);
return
None
;
Py_RETURN_NONE
;
}
extern
"C"
Box
*
listSetitemInt
(
BoxedList
*
self
,
BoxedInt
*
slice
,
Box
*
v
)
{
...
...
@@ -567,11 +567,11 @@ extern "C" Box* listSetitemSlice(BoxedList* self, BoxedSlice* slice, Box* v) {
int
r
=
list_ass_ext_slice
(
self
,
slice
,
v
);
if
(
r
)
throwCAPIException
();
return
None
;
Py_RETURN_NONE
;
}
listSetitemSliceInt64
(
self
,
start
,
stop
,
step
,
v
);
return
None
;
Py_RETURN_NONE
;
}
// Analoguous to CPython's, used for sq_ slots.
...
...
@@ -589,7 +589,7 @@ extern "C" Box* listSetslice(BoxedList* self, Box* boxedStart, Box* boxedStop, B
sliceIndex
(
boxedStop
,
&
stop
);
listSetitemSliceInt64
(
self
,
start
,
stop
,
1
,
value
);
return
None
;
Py_RETURN_NONE
;
}
extern
"C"
Box
*
listSetitem
(
BoxedList
*
self
,
Box
*
slice
,
Box
*
v
)
{
...
...
@@ -599,7 +599,7 @@ extern "C" Box* listSetitem(BoxedList* self, Box* slice, Box* v) {
if
(
i
==
-
1
&&
PyErr_Occurred
())
throwCAPIException
();
listSetitemUnboxed
(
self
,
i
,
v
);
return
None
;
Py_RETURN_NONE
;
}
else
if
(
slice
->
cls
==
slice_cls
)
{
return
listSetitemSlice
(
self
,
static_cast
<
BoxedSlice
*>
(
slice
),
v
);
}
else
{
...
...
@@ -617,7 +617,7 @@ extern "C" Box* listDelitemInt(BoxedList* self, BoxedInt* slice) {
}
memmove
(
self
->
elts
->
elts
+
n
,
self
->
elts
->
elts
+
n
+
1
,
(
self
->
size
-
n
-
1
)
*
sizeof
(
Box
*
));
self
->
size
--
;
return
None
;
Py_RETURN_NONE
;
}
extern
"C"
Box
*
listDelitemSlice
(
BoxedList
*
self
,
BoxedSlice
*
slice
)
{
...
...
@@ -665,10 +665,11 @@ extern "C" Box* listInsert(BoxedList* self, Box* idx, Box* v) {
memmove
(
self
->
elts
->
elts
+
n
+
1
,
self
->
elts
->
elts
+
n
,
(
self
->
size
-
n
)
*
sizeof
(
Box
*
));
self
->
size
++
;
Py_INCREF
(
v
);
self
->
elts
->
elts
[
n
]
=
v
;
}
return
None
;
Py_RETURN_NONE
;
}
extern
"C"
int
PyList_Insert
(
PyObject
*
op
,
Py_ssize_t
where
,
PyObject
*
newitem
)
noexcept
{
...
...
@@ -825,7 +826,7 @@ Box* listReverse(BoxedList* self) {
self
->
elts
->
elts
[
j
]
=
e
;
}
return
None
;
Py_RETURN_NONE
;
}
extern
"C"
int
PyList_Reverse
(
PyObject
*
v
)
noexcept
{
...
...
@@ -923,7 +924,7 @@ void listSort(BoxedList* self, Box* cmp, Box* key, Box* reverse) {
Box
*
listSortFunc
(
BoxedList
*
self
,
Box
*
cmp
,
Box
*
key
,
Box
**
_args
)
{
Box
*
reverse
=
_args
[
0
];
listSort
(
self
,
cmp
,
key
,
reverse
);
return
None
;
Py_RETURN_NONE
;
}
extern
"C"
int
PyList_Sort
(
PyObject
*
v
)
noexcept
{
...
...
@@ -1084,7 +1085,7 @@ Box* listRemove(BoxedList* self, Box* elt) {
if
(
r
)
{
memmove
(
self
->
elts
->
elts
+
i
,
self
->
elts
->
elts
+
i
+
1
,
(
self
->
size
-
i
-
1
)
*
sizeof
(
Box
*
));
self
->
size
--
;
return
None
;
Py_RETURN_NONE
;
}
}
...
...
@@ -1101,7 +1102,7 @@ Box* listInit(BoxedList* self, Box* container) {
listIAdd
(
self
,
container
);
}
return
None
;
Py_RETURN_NONE
;
}
extern
"C"
PyObject
*
PyList_New
(
Py_ssize_t
size
)
noexcept
{
...
...
src/runtime/types.cpp
View file @
075f148d
...
...
@@ -337,12 +337,11 @@ extern "C" BoxedFunctionBase::BoxedFunctionBase(FunctionMetadata* md, std::initi
globals_for_name
=
md
->
source
->
parent_module
;
}
assert
(
0
&&
"check the refcounting here"
);
static
BoxedString
*
name_str
=
getStaticString
(
"__name__"
);
if
(
globals_for_name
->
cls
==
module_cls
)
{
this
->
modname
=
globals_for_name
->
getattr
(
name_str
);
this
->
modname
=
incref
(
globals_for_name
->
getattr
(
name_str
)
);
}
else
{
this
->
modname
=
PyDict_GetItem
(
globals_for_name
,
name_str
);
this
->
modname
=
incref
(
PyDict_GetItem
(
globals_for_name
,
name_str
)
);
}
// It's ok for modname to be NULL
...
...
@@ -3434,7 +3433,12 @@ int BoxedModule::clear(Box* b) noexcept {
assert
(
!
self
->
str_constants
.
size
());
assert
(
!
self
->
unicode_constants
.
size
());
assert
(
!
self
->
int_constants
.
size
());
for
(
auto
p
:
self
->
int_constants
)
{
Py_DECREF
(
self
->
int_constants
.
getMapped
(
p
.
second
));
}
self
->
int_constants
.
~
ContiguousMap
();
assert
(
!
self
->
float_constants
.
size
());
assert
(
!
self
->
imaginary_constants
.
size
());
assert
(
!
self
->
long_constants
.
size
());
...
...
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