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
7d5ea0c8
Commit
7d5ea0c8
authored
Aug 28, 2015
by
Rudi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move closer towards exposing the public gc interface only in one file.
parent
34532626
Changes
37
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
56 additions
and
68 deletions
+56
-68
src/asm_writing/rewriter.h
src/asm_writing/rewriter.h
+1
-0
src/capi/errors.cpp
src/capi/errors.cpp
+0
-1
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+0
-1
src/codegen/baseline_jit.h
src/codegen/baseline_jit.h
+0
-1
src/codegen/pypa-parser.cpp
src/codegen/pypa-parser.cpp
+0
-1
src/core/stats.cpp
src/core/stats.cpp
+1
-1
src/core/threading.cpp
src/core/threading.cpp
+0
-1
src/core/threading.h
src/core/threading.h
+1
-1
src/gc/collector.h
src/gc/collector.h
+2
-29
src/gc/gc.h
src/gc/gc.h
+46
-3
src/gc/gc_alloc.h
src/gc/gc_alloc.h
+1
-0
src/gc/heap.h
src/gc/heap.h
+0
-1
src/gc/roots.h
src/gc/roots.h
+1
-2
src/runtime/bool.cpp
src/runtime/bool.cpp
+0
-1
src/runtime/builtin_modules/ast.cpp
src/runtime/builtin_modules/ast.cpp
+0
-1
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+0
-1
src/runtime/builtin_modules/gc.cpp
src/runtime/builtin_modules/gc.cpp
+1
-1
src/runtime/builtin_modules/sys.cpp
src/runtime/builtin_modules/sys.cpp
+0
-1
src/runtime/classobj.cpp
src/runtime/classobj.cpp
+0
-1
src/runtime/code.cpp
src/runtime/code.cpp
+0
-1
src/runtime/dict.cpp
src/runtime/dict.cpp
+0
-1
src/runtime/exceptions.cpp
src/runtime/exceptions.cpp
+0
-1
src/runtime/generator.cpp
src/runtime/generator.cpp
+0
-1
src/runtime/hiddenclass.h
src/runtime/hiddenclass.h
+0
-1
src/runtime/inline/link_forcer.cpp
src/runtime/inline/link_forcer.cpp
+0
-1
src/runtime/int.cpp
src/runtime/int.cpp
+0
-1
src/runtime/iterobject.cpp
src/runtime/iterobject.cpp
+0
-1
src/runtime/list.cpp
src/runtime/list.cpp
+0
-1
src/runtime/long.cpp
src/runtime/long.cpp
+0
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+1
-3
src/runtime/set.cpp
src/runtime/set.cpp
+0
-1
src/runtime/str.cpp
src/runtime/str.cpp
+0
-1
src/runtime/super.cpp
src/runtime/super.cpp
+0
-1
src/runtime/traceback.cpp
src/runtime/traceback.cpp
+0
-1
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+0
-1
src/runtime/types.cpp
src/runtime/types.cpp
+0
-1
test/unittests/gc.cpp
test/unittests/gc.cpp
+1
-1
No files found.
src/asm_writing/rewriter.h
View file @
7d5ea0c8
...
...
@@ -16,6 +16,7 @@
#define PYSTON_ASMWRITING_REWRITER_H
#include <deque>
#include <list>
#include <map>
#include <memory>
#include <tuple>
...
...
src/capi/errors.cpp
View file @
7d5ea0c8
...
...
@@ -20,7 +20,6 @@
#include "core/common.h"
#include "core/types.h"
#include "core/util.h"
#include "gc/collector.h"
#include "runtime/dict.h"
#include "runtime/objmodel.h"
#include "runtime/types.h"
...
...
src/codegen/ast_interpreter.cpp
View file @
7d5ea0c8
...
...
@@ -35,7 +35,6 @@
#include "core/stats.h"
#include "core/thread_utils.h"
#include "core/util.h"
#include "gc/roots.h"
#include "runtime/generator.h"
#include "runtime/import.h"
#include "runtime/inline/boxing.h"
...
...
src/codegen/baseline_jit.h
View file @
7d5ea0c8
...
...
@@ -20,7 +20,6 @@
#include "asm_writing/rewriter.h"
#include "codegen/ast_interpreter.h"
#include "codegen/patchpoints.h"
#include "gc/heap.h"
namespace
pyston
{
...
...
src/codegen/pypa-parser.cpp
View file @
7d5ea0c8
...
...
@@ -32,7 +32,6 @@
#include "core/stats.h"
#include "core/types.h"
#include "core/util.h"
#include "gc/collector.h"
#include "runtime/objmodel.h"
#include "runtime/types.h"
...
...
src/core/stats.cpp
View file @
7d5ea0c8
...
...
@@ -17,7 +17,7 @@
#include <algorithm>
#include "core/thread_utils.h"
#include "gc/
heap
.h"
#include "gc/
gc
.h"
namespace
pyston
{
...
...
src/core/threading.cpp
View file @
7d5ea0c8
...
...
@@ -29,7 +29,6 @@
#include "core/stats.h"
#include "core/thread_utils.h"
#include "core/util.h"
#include "gc/collector.h"
#include "runtime/objmodel.h" // _printStacktrace
namespace
pyston
{
...
...
src/core/threading.h
View file @
7d5ea0c8
...
...
@@ -23,7 +23,7 @@
#include "core/common.h"
#include "core/thread_utils.h"
#include "gc/
collector
.h"
#include "gc/
gc
.h"
namespace
pyston
{
class
Box
;
...
...
src/gc/collector.h
View file @
7d5ea0c8
...
...
@@ -15,25 +15,11 @@
#ifndef PYSTON_GC_COLLECTOR_H
#define PYSTON_GC_COLLECTOR_H
#include <deque>
#include <list>
#include <vector>
#include "core/types.h"
namespace
pyston
{
namespace
gc
{
#define TRACE_GC_MARKING 0
#if TRACE_GC_MARKING
extern
FILE
*
trace_fp
;
#define GC_TRACE_LOG(...) fprintf(pyston::gc::trace_fp, __VA_ARGS__)
#else
#define GC_TRACE_LOG(...)
#endif
class
Box
;
extern
std
::
deque
<
Box
*>
pending_finalization_list
;
extern
std
::
deque
<
PyWeakReference
*>
weakrefs_needing_callback_list
;
namespace
gc
{
// Mark this gc-allocated object as being a root, even if there are no visible references to it.
// (Note: this marks the gc allocation itself, not the pointer that points to one. For that, use
...
...
@@ -63,19 +49,6 @@ public:
Box
*
operator
->
()
{
return
value
;
}
};
void
callPendingDestructionLogic
();
void
runCollection
();
// Python programs are allowed to pause the GC. This is supposed to pause automatic GC,
// but does not seem to pause manual calls to gc.collect(). So, callers should check gcIsEnabled(),
// if appropriate, before calling runCollection().
bool
gcIsEnabled
();
void
disableGC
();
void
enableGC
();
// These are mostly for debugging:
bool
isValidGCMemory
(
void
*
p
);
// if p is a valid gc-allocated pointer (or a non-heap root)
bool
isValidGCObject
(
void
*
p
);
// whether p is valid gc memory and is set to have Python destructor semantics applied
bool
isNonheapRoot
(
void
*
p
);
void
registerPythonObject
(
Box
*
b
);
void
invalidateOrderedFinalizerList
();
...
...
src/gc/gc.h
View file @
7d5ea0c8
...
...
@@ -15,11 +15,29 @@
#ifndef PYSTON_GC_GC_H
#define PYSTON_GC_GC_H
#include <deque>
// Files outside of the gc/ folder should only import gc.h or gc_alloc.h
// which are the "public" memory management interface.
#define GC_KEEP_ALIVE(t) asm volatile("" : : "X"(t))
#define TRACE_GC_MARKING 0
#if TRACE_GC_MARKING
extern
FILE
*
trace_fp
;
#define GC_TRACE_LOG(...) fprintf(pyston::gc::trace_fp, __VA_ARGS__)
#else
#define GC_TRACE_LOG(...)
#endif
struct
_PyWeakReference
;
typedef
struct
_PyWeakReference
PyWeakReference
;
namespace
pyston
{
namespace
gc
{
// GOAL: Eventually, move any declaration that needs to be visible outside the gc/ folder
// to this file and only expose this header.
class
Box
;
namespace
gc
{
class
TraceStack
;
class
GCVisitor
{
...
...
@@ -65,6 +83,31 @@ extern "C" void* gc_alloc(size_t nbytes, GCKind kind);
extern
"C"
void
*
gc_realloc
(
void
*
ptr
,
size_t
bytes
);
extern
"C"
void
gc_free
(
void
*
ptr
);
// Python programs are allowed to pause the GC. This is supposed to pause automatic GC,
// but does not seem to pause manual calls to gc.collect(). So, callers should check gcIsEnabled(),
// if appropriate, before calling runCollection().
bool
gcIsEnabled
();
void
disableGC
();
void
enableGC
();
void
runCollection
();
void
dumpHeapStatistics
(
int
level
);
// These are exposed since the GC isn't necessarily responsible for calling finalizeres.
void
callPendingDestructionLogic
();
extern
std
::
deque
<
Box
*>
pending_finalization_list
;
extern
std
::
deque
<
PyWeakReference
*>
weakrefs_needing_callback_list
;
// These should only be used for debugging outside of the GC module. Except for functions that print
// some debugging information, it should be possible to replace calls to these functions with true
// without changing the behavior of the program.
// If p is a valid gc-allocated pointer (or a non-heap root)
bool
isValidGCMemory
(
void
*
p
);
// Whether p is valid gc memory and is set to have Python destructor semantics applied
bool
isValidGCObject
(
void
*
p
);
// Use this if a C++ object needs to be allocated in our heap.
class
GCAllocatedRuntime
{
public:
...
...
src/gc/gc_alloc.h
View file @
7d5ea0c8
...
...
@@ -17,6 +17,7 @@
#include <cstdlib>
#include "core/types.h"
#include "gc/collector.h"
#include "gc/heap.h"
...
...
src/gc/heap.h
View file @
7d5ea0c8
...
...
@@ -648,7 +648,6 @@ public:
};
extern
Heap
global_heap
;
void
dumpHeapStatistics
(
int
level
);
}
// namespace gc
}
// namespace pyston
...
...
src/gc/roots.h
View file @
7d5ea0c8
...
...
@@ -17,11 +17,10 @@
#include "core/common.h"
#include "core/threading.h"
#include "gc/gc.h"
namespace
pyston
{
#define GC_KEEP_ALIVE(t) asm volatile("" : : "X"(t))
template
<
class
T
>
class
StackRoot
{
public:
explicit
StackRoot
(
T
*
t
)
:
t
(
t
)
{}
...
...
src/runtime/bool.cpp
View file @
7d5ea0c8
...
...
@@ -14,7 +14,6 @@
#include "core/common.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/objmodel.h"
#include "runtime/types.h"
...
...
src/runtime/builtin_modules/ast.cpp
View file @
7d5ea0c8
...
...
@@ -23,7 +23,6 @@
#include "codegen/unwinding.h"
#include "core/ast.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/file.h"
#include "runtime/inline/boxing.h"
#include "runtime/int.h"
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
7d5ea0c8
...
...
@@ -26,7 +26,6 @@
#include "codegen/unwinding.h"
#include "core/ast.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/classobj.h"
#include "runtime/file.h"
#include "runtime/ics.h"
...
...
src/runtime/builtin_modules/gc.cpp
View file @
7d5ea0c8
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#include "core/types.h"
#include "gc/
collector
.h"
#include "gc/
gc
.h"
#include "runtime/types.h"
namespace
pyston
{
...
...
src/runtime/builtin_modules/sys.cpp
View file @
7d5ea0c8
...
...
@@ -26,7 +26,6 @@
#include "capi/types.h"
#include "codegen/unwinding.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/file.h"
#include "runtime/inline/boxing.h"
#include "runtime/inline/list.h"
...
...
src/runtime/classobj.cpp
View file @
7d5ea0c8
...
...
@@ -18,7 +18,6 @@
#include "capi/types.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/objmodel.h"
#include "runtime/types.h"
...
...
src/runtime/code.cpp
View file @
7d5ea0c8
...
...
@@ -17,7 +17,6 @@
#include <sstream>
#include "core/ast.h"
#include "gc/collector.h"
#include "runtime/objmodel.h"
#include "runtime/set.h"
...
...
src/runtime/dict.cpp
View file @
7d5ea0c8
...
...
@@ -19,7 +19,6 @@
#include "core/common.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/ics.h"
#include "runtime/inline/list.h"
#include "runtime/objmodel.h"
...
...
src/runtime/exceptions.cpp
View file @
7d5ea0c8
...
...
@@ -19,7 +19,6 @@
#include "codegen/unwinding.h"
#include "core/ast.h"
#include "core/options.h"
#include "gc/collector.h"
#include "runtime/objmodel.h"
#include "runtime/traceback.h"
#include "runtime/types.h"
...
...
src/runtime/generator.cpp
View file @
7d5ea0c8
...
...
@@ -28,7 +28,6 @@
#include "core/common.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/ctxswitching.h"
#include "runtime/objmodel.h"
#include "runtime/types.h"
...
...
src/runtime/hiddenclass.h
View file @
7d5ea0c8
...
...
@@ -21,7 +21,6 @@
#include "core/contiguous_map.h"
#include "core/types.h"
#include "gc/gc_alloc.h"
namespace
pyston
{
...
...
src/runtime/inline/link_forcer.cpp
View file @
7d5ea0c8
...
...
@@ -20,7 +20,6 @@
#include "core/ast.h"
#include "core/threading.h"
#include "core/types.h"
#include "gc/heap.h"
#include "runtime/complex.h"
#include "runtime/float.h"
#include "runtime/generator.h"
...
...
src/runtime/int.cpp
View file @
7d5ea0c8
...
...
@@ -23,7 +23,6 @@
#include "core/options.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/float.h"
#include "runtime/inline/boxing.h"
#include "runtime/long.h"
...
...
src/runtime/iterobject.cpp
View file @
7d5ea0c8
...
...
@@ -22,7 +22,6 @@
#include "core/options.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/inline/boxing.h"
#include "runtime/objmodel.h"
#include "runtime/types.h"
...
...
src/runtime/list.cpp
View file @
7d5ea0c8
...
...
@@ -22,7 +22,6 @@
#include "core/common.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "gc/roots.h"
#include "runtime/inline/list.h"
#include "runtime/objmodel.h"
...
...
src/runtime/long.cpp
View file @
7d5ea0c8
...
...
@@ -26,7 +26,6 @@
#include "core/options.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/float.h"
#include "runtime/inline/boxing.h"
#include "runtime/objmodel.h"
...
...
src/runtime/objmodel.cpp
View file @
7d5ea0c8
...
...
@@ -37,9 +37,7 @@
#include "core/options.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "gc/heap.h"
#include "gc/roots.h"
#include "gc/gc.h"
#include "runtime/classobj.h"
#include "runtime/dict.h"
#include "runtime/file.h"
...
...
src/runtime/set.cpp
View file @
7d5ea0c8
...
...
@@ -14,7 +14,6 @@
#include "runtime/set.h"
#include "gc/collector.h"
#include "runtime/objmodel.h"
namespace
pyston
{
...
...
src/runtime/str.cpp
View file @
7d5ea0c8
...
...
@@ -28,7 +28,6 @@
#include "core/common.h"
#include "core/types.h"
#include "core/util.h"
#include "gc/collector.h"
#include "runtime/dict.h"
#include "runtime/long.h"
#include "runtime/objmodel.h"
...
...
src/runtime/super.cpp
View file @
7d5ea0c8
...
...
@@ -18,7 +18,6 @@
#include "capi/types.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/objmodel.h"
#include "runtime/types.h"
...
...
src/runtime/traceback.cpp
View file @
7d5ea0c8
...
...
@@ -23,7 +23,6 @@
#include "core/common.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/inline/list.h"
#include "runtime/list.h"
#include "runtime/objmodel.h"
...
...
src/runtime/tuple.cpp
View file @
7d5ea0c8
...
...
@@ -21,7 +21,6 @@
#include "core/common.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/objmodel.h"
#include "runtime/types.h"
#include "runtime/util.h"
...
...
src/runtime/types.cpp
View file @
7d5ea0c8
...
...
@@ -33,7 +33,6 @@
#include "core/options.h"
#include "core/stats.h"
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/classobj.h"
#include "runtime/complex.h"
#include "runtime/dict.h"
...
...
test/unittests/gc.cpp
View file @
7d5ea0c8
...
...
@@ -5,7 +5,7 @@
#include "gtest/gtest.h"
#include "core/types.h"
#include "gc/gc
_alloc
.h"
#include "gc/gc.h"
#include "runtime/types.h"
#include "unittests.h"
...
...
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