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
21d52eb8
Commit
21d52eb8
authored
Nov 20, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Runtime setup is complete
parent
fa84f801
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
52 deletions
+34
-52
src/jit.cpp
src/jit.cpp
+6
-6
src/runtime/builtin_modules/sys.cpp
src/runtime/builtin_modules/sys.cpp
+4
-3
src/runtime/types.cpp
src/runtime/types.cpp
+24
-43
No files found.
src/jit.cpp
View file @
21d52eb8
...
...
@@ -388,12 +388,6 @@ static int main(int argc, char** argv) noexcept {
Py_Initialize
();
}
// XXX
{
Py_Finalize
();
return
0
;
}
// Arguments left over after option parsing are of the form:
// [ script | - ] [ arguments... ]
// unless we've been already parsed a `-c command` option, in which case only:
...
...
@@ -450,6 +444,12 @@ 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
{
...
...
src/runtime/builtin_modules/sys.cpp
View file @
21d52eb8
...
...
@@ -207,15 +207,16 @@ extern "C" void PySys_WriteStderr(const char* format, ...) noexcept {
}
void
addToSysArgv
(
const
char
*
str
)
{
Box
*
sys_argv
=
sys_module
->
getattr
(
internStringMortal
(
"argv"
));
static
BoxedString
*
argv_str
=
getStaticString
(
"argv"
);
Box
*
sys_argv
=
sys_module
->
getattr
(
argv_str
);
assert
(
sys_argv
);
assert
(
sys_argv
->
cls
==
list_cls
);
listAppendInternal
(
sys_argv
,
boxString
(
str
));
listAppendInternal
(
sys_argv
,
autoDecref
(
boxString
(
str
)
));
}
void
appendToSysPath
(
llvm
::
StringRef
path
)
{
BoxedList
*
sys_path
=
getSysPath
();
listAppendInternal
(
sys_path
,
boxString
(
path
));
listAppendInternal
(
sys_path
,
autoDecref
(
boxString
(
path
)
));
}
void
prependToSysPath
(
llvm
::
StringRef
path
)
{
...
...
src/runtime/types.cpp
View file @
21d52eb8
...
...
@@ -4224,6 +4224,7 @@ void setupRuntime() {
TRACK_ALLOCATIONS
=
true
;
#if 0
Box* l = NULL;
for (int i = 0; i < 1000000000; i++) {
//if (i % 10000 == 0) {
...
...
@@ -4261,7 +4262,7 @@ void setupRuntime() {
PRINT_TOTAL_REFS();
exit(0);
// XXX
#endif
}
BoxedModule
*
createModule
(
BoxedString
*
name
,
const
char
*
fn
,
const
char
*
doc
)
noexcept
{
...
...
@@ -4320,9 +4321,29 @@ extern "C" void Py_Finalize() noexcept {
call_sys_exitfunc
();
// initialized = 0;
// PyOS_FiniInterrupts();
// XXX
PyGC_Collect
();
// To make sure it creates any static objects
IN_SHUTDOWN
=
true
;
PyOS_FiniInterrupts
();
PyType_ClearCache
();
_PyUnicode_Fini
();
for
(
auto
b
:
constants
)
{
Py_DECREF
(
b
);
}
// May need to run multiple collections to collect everything:
while
(
PyGC_Collect
())
;
_Py_ReleaseInternedStrings
();
for
(
auto
b
:
classes
)
{
if
(
!
PyObject_IS_GC
(
b
))
{
b
->
clearAttrs
();
Py_CLEAR
(
b
->
tp_mro
);
}
Py_DECREF
(
b
);
}
// May need to run multiple collections to collect everything:
while
(
PyGC_Collect
())
;
// PyGC_Collect());
...
...
@@ -4333,46 +4354,6 @@ extern "C" void Py_Finalize() noexcept {
// _PyGILState_Fini();
// TODO it's probably a waste of time to tear these down in non-debugging mode
/*
// clear all the attributes on the base classes before freeing the classes themselves,
// since we will run into problem if we free a class but there is an object somewhere
// else that refers to it.
clearAttrs(bool_cls);
clearAttrs(int_cls);
clearAttrs(float_cls);
clearAttrs(none_cls);
clearAttrs(function_cls);
clearAttrs(instancemethod_cls);
clearAttrs(str_cls);
clearAttrs(list_cls);
clearAttrs(slice_cls);
clearAttrs(type_cls);
clearAttrs(module_cls);
clearAttrs(dict_cls);
clearAttrs(tuple_cls);
clearAttrs(file_cls);
decref(bool_cls);
decref(int_cls);
decref(float_cls);
decref(function_cls);
decref(instancemethod_cls);
decref(str_cls);
decref(list_cls);
decref(slice_cls);
decref(module_cls);
decref(dict_cls);
decref(tuple_cls);
decref(file_cls);
ASSERT(None->nrefs == 1, "%ld", None->nrefs);
decref(None);
decref(none_cls);
decref(type_cls);
*/
#if 0
/* Delete current thread */
PyThreadState_Swap(NULL);
...
...
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