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
b34237fb
Commit
b34237fb
authored
Aug 06, 2015
by
Rudi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename boxGCHandler to Box::gcHandler.
parent
03cd0cbc
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
72 additions
and
72 deletions
+72
-72
src/capi/types.h
src/capi/types.h
+1
-1
src/core/types.h
src/core/types.h
+2
-0
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+1
-1
src/runtime/builtin_modules/sys.cpp
src/runtime/builtin_modules/sys.cpp
+1
-1
src/runtime/classobj.h
src/runtime/classobj.h
+2
-2
src/runtime/code.cpp
src/runtime/code.cpp
+1
-1
src/runtime/descr.cpp
src/runtime/descr.cpp
+3
-3
src/runtime/dict.cpp
src/runtime/dict.cpp
+3
-3
src/runtime/file.cpp
src/runtime/file.cpp
+1
-1
src/runtime/frame.cpp
src/runtime/frame.cpp
+1
-1
src/runtime/generator.cpp
src/runtime/generator.cpp
+1
-1
src/runtime/inline/xrange.cpp
src/runtime/inline/xrange.cpp
+1
-1
src/runtime/iterobject.cpp
src/runtime/iterobject.cpp
+2
-2
src/runtime/list.cpp
src/runtime/list.cpp
+2
-2
src/runtime/long.cpp
src/runtime/long.cpp
+1
-1
src/runtime/set.cpp
src/runtime/set.cpp
+2
-2
src/runtime/str.cpp
src/runtime/str.cpp
+1
-1
src/runtime/super.cpp
src/runtime/super.cpp
+1
-1
src/runtime/traceback.cpp
src/runtime/traceback.cpp
+1
-1
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+2
-2
src/runtime/types.cpp
src/runtime/types.cpp
+42
-42
src/runtime/types.h
src/runtime/types.h
+0
-2
No files found.
src/capi/types.h
View file @
b34237fb
...
@@ -58,7 +58,7 @@ public:
...
@@ -58,7 +58,7 @@ public:
assert
(
_o
->
cls
==
capifunc_cls
);
assert
(
_o
->
cls
==
capifunc_cls
);
BoxedCApiFunction
*
o
=
static_cast
<
BoxedCApiFunction
*>
(
_o
);
BoxedCApiFunction
*
o
=
static_cast
<
BoxedCApiFunction
*>
(
_o
);
boxGC
Handler
(
v
,
o
);
Box
::
gc
Handler
(
v
,
o
);
v
->
visit
(
o
->
passthrough
);
v
->
visit
(
o
->
passthrough
);
v
->
visit
(
o
->
module
);
v
->
visit
(
o
->
module
);
}
}
...
...
src/core/types.h
View file @
b34237fb
...
@@ -603,6 +603,8 @@ public:
...
@@ -603,6 +603,8 @@ public:
Box
*
hasnextOrNullIC
();
Box
*
hasnextOrNullIC
();
friend
class
AttrWrapper
;
friend
class
AttrWrapper
;
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
);
};
};
static_assert
(
offsetof
(
Box
,
cls
)
==
offsetof
(
struct
_object
,
ob_type
),
""
);
static_assert
(
offsetof
(
Box
,
cls
)
==
offsetof
(
struct
_object
,
ob_type
),
""
);
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
b34237fb
...
@@ -1013,7 +1013,7 @@ public:
...
@@ -1013,7 +1013,7 @@ public:
}
}
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedEnumerate
*
it
=
(
BoxedEnumerate
*
)
b
;
BoxedEnumerate
*
it
=
(
BoxedEnumerate
*
)
b
;
it
->
iterator
.
gcHandler
(
v
);
it
->
iterator
.
gcHandler
(
v
);
...
...
src/runtime/builtin_modules/sys.cpp
View file @
b34237fb
...
@@ -228,7 +228,7 @@ public:
...
@@ -228,7 +228,7 @@ public:
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
_b
)
{
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
_b
)
{
assert
(
_b
->
cls
==
sys_flags_cls
);
assert
(
_b
->
cls
==
sys_flags_cls
);
boxGC
Handler
(
v
,
_b
);
Box
::
gc
Handler
(
v
,
_b
);
BoxedSysFlags
*
self
=
static_cast
<
BoxedSysFlags
*>
(
_b
);
BoxedSysFlags
*
self
=
static_cast
<
BoxedSysFlags
*>
(
_b
);
v
->
visit
(
self
->
division_warning
);
v
->
visit
(
self
->
division_warning
);
...
...
src/runtime/classobj.h
View file @
b34237fb
...
@@ -52,7 +52,7 @@ public:
...
@@ -52,7 +52,7 @@ public:
assert
(
_o
->
cls
==
classobj_cls
);
assert
(
_o
->
cls
==
classobj_cls
);
BoxedClassobj
*
o
=
static_cast
<
BoxedClassobj
*>
(
_o
);
BoxedClassobj
*
o
=
static_cast
<
BoxedClassobj
*>
(
_o
);
boxGC
Handler
(
v
,
o
);
Box
::
gc
Handler
(
v
,
o
);
if
(
o
->
bases
)
if
(
o
->
bases
)
v
->
visit
(
o
->
bases
);
v
->
visit
(
o
->
bases
);
if
(
o
->
name
)
if
(
o
->
name
)
...
@@ -76,7 +76,7 @@ public:
...
@@ -76,7 +76,7 @@ public:
assert
(
_o
->
cls
==
instance_cls
);
assert
(
_o
->
cls
==
instance_cls
);
BoxedInstance
*
o
=
static_cast
<
BoxedInstance
*>
(
_o
);
BoxedInstance
*
o
=
static_cast
<
BoxedInstance
*>
(
_o
);
boxGC
Handler
(
v
,
o
);
Box
::
gc
Handler
(
v
,
o
);
if
(
o
->
inst_cls
)
if
(
o
->
inst_cls
)
v
->
visit
(
o
->
inst_cls
);
v
->
visit
(
o
->
inst_cls
);
}
}
...
...
src/runtime/code.cpp
View file @
b34237fb
...
@@ -39,7 +39,7 @@ public:
...
@@ -39,7 +39,7 @@ public:
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
assert
(
b
->
cls
==
code_cls
);
assert
(
b
->
cls
==
code_cls
);
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
}
}
static
Box
*
name
(
Box
*
b
,
void
*
)
{
static
Box
*
name
(
Box
*
b
,
void
*
)
{
...
...
src/runtime/descr.cpp
View file @
b34237fb
...
@@ -413,7 +413,7 @@ void BoxedMethodDescriptor::gcHandler(GCVisitor* v, Box* _o) {
...
@@ -413,7 +413,7 @@ void BoxedMethodDescriptor::gcHandler(GCVisitor* v, Box* _o) {
assert
(
_o
->
cls
==
method_cls
);
assert
(
_o
->
cls
==
method_cls
);
BoxedMethodDescriptor
*
o
=
static_cast
<
BoxedMethodDescriptor
*>
(
_o
);
BoxedMethodDescriptor
*
o
=
static_cast
<
BoxedMethodDescriptor
*>
(
_o
);
boxGC
Handler
(
v
,
o
);
Box
::
gc
Handler
(
v
,
o
);
v
->
visit
(
o
->
type
);
v
->
visit
(
o
->
type
);
}
}
...
@@ -452,7 +452,7 @@ void BoxedWrapperDescriptor::gcHandler(GCVisitor* v, Box* _o) {
...
@@ -452,7 +452,7 @@ void BoxedWrapperDescriptor::gcHandler(GCVisitor* v, Box* _o) {
assert
(
_o
->
cls
==
wrapperdescr_cls
);
assert
(
_o
->
cls
==
wrapperdescr_cls
);
BoxedWrapperDescriptor
*
o
=
static_cast
<
BoxedWrapperDescriptor
*>
(
_o
);
BoxedWrapperDescriptor
*
o
=
static_cast
<
BoxedWrapperDescriptor
*>
(
_o
);
boxGC
Handler
(
v
,
o
);
Box
::
gc
Handler
(
v
,
o
);
v
->
visit
(
o
->
type
);
v
->
visit
(
o
->
type
);
}
}
...
@@ -570,7 +570,7 @@ void BoxedWrapperObject::gcHandler(GCVisitor* v, Box* _o) {
...
@@ -570,7 +570,7 @@ void BoxedWrapperObject::gcHandler(GCVisitor* v, Box* _o) {
assert
(
_o
->
cls
==
wrapperobject_cls
);
assert
(
_o
->
cls
==
wrapperobject_cls
);
BoxedWrapperObject
*
o
=
static_cast
<
BoxedWrapperObject
*>
(
_o
);
BoxedWrapperObject
*
o
=
static_cast
<
BoxedWrapperObject
*>
(
_o
);
boxGC
Handler
(
v
,
o
);
Box
::
gc
Handler
(
v
,
o
);
v
->
visit
(
o
->
obj
);
v
->
visit
(
o
->
obj
);
}
}
...
...
src/runtime/dict.cpp
View file @
b34237fb
...
@@ -685,7 +685,7 @@ extern "C" Box* dictInit(BoxedDict* self, BoxedTuple* args, BoxedDict* kwargs) {
...
@@ -685,7 +685,7 @@ extern "C" Box* dictInit(BoxedDict* self, BoxedTuple* args, BoxedDict* kwargs) {
void
BoxedDict
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedDict
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
assert
(
isSubclass
(
b
->
cls
,
dict_cls
));
assert
(
isSubclass
(
b
->
cls
,
dict_cls
));
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedDict
*
d
=
(
BoxedDict
*
)
b
;
BoxedDict
*
d
=
(
BoxedDict
*
)
b
;
...
@@ -701,7 +701,7 @@ void BoxedDict::gcHandler(GCVisitor* v, Box* b) {
...
@@ -701,7 +701,7 @@ void BoxedDict::gcHandler(GCVisitor* v, Box* b) {
void
BoxedDictIterator
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedDictIterator
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
assert
(
b
->
cls
==
dict_iterator_cls
);
assert
(
b
->
cls
==
dict_iterator_cls
);
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedDictIterator
*
it
=
static_cast
<
BoxedDictIterator
*>
(
b
);
BoxedDictIterator
*
it
=
static_cast
<
BoxedDictIterator
*>
(
b
);
v
->
visit
(
it
->
d
);
v
->
visit
(
it
->
d
);
...
@@ -709,7 +709,7 @@ void BoxedDictIterator::gcHandler(GCVisitor* v, Box* b) {
...
@@ -709,7 +709,7 @@ void BoxedDictIterator::gcHandler(GCVisitor* v, Box* b) {
void
BoxedDictView
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedDictView
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
assert
(
b
->
cls
==
dict_items_cls
);
assert
(
b
->
cls
==
dict_items_cls
);
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedDictView
*
view
=
static_cast
<
BoxedDictView
*>
(
b
);
BoxedDictView
*
view
=
static_cast
<
BoxedDictView
*>
(
b
);
v
->
visit
(
view
->
d
);
v
->
visit
(
view
->
d
);
...
...
src/runtime/file.cpp
View file @
b34237fb
...
@@ -1744,7 +1744,7 @@ void fileDestructor(Box* b) {
...
@@ -1744,7 +1744,7 @@ void fileDestructor(Box* b) {
}
}
void
BoxedFile
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedFile
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
assert
(
isSubclass
(
b
->
cls
,
file_cls
));
assert
(
isSubclass
(
b
->
cls
,
file_cls
));
BoxedFile
*
f
=
static_cast
<
BoxedFile
*>
(
b
);
BoxedFile
*
f
=
static_cast
<
BoxedFile
*>
(
b
);
...
...
src/runtime/frame.cpp
View file @
b34237fb
...
@@ -78,7 +78,7 @@ public:
...
@@ -78,7 +78,7 @@ public:
// ** = getter supported, but setter unsupported
// ** = getter supported, but setter unsupported
static
void
gchandler
(
GCVisitor
*
v
,
Box
*
b
)
{
static
void
gchandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
auto
f
=
static_cast
<
BoxedFrame
*>
(
b
);
auto
f
=
static_cast
<
BoxedFrame
*>
(
b
);
...
...
src/runtime/generator.cpp
View file @
b34237fb
...
@@ -379,7 +379,7 @@ extern "C" BoxedGenerator::BoxedGenerator(BoxedFunctionBase* function, Box* arg1
...
@@ -379,7 +379,7 @@ extern "C" BoxedGenerator::BoxedGenerator(BoxedFunctionBase* function, Box* arg1
}
}
void
BoxedGenerator
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedGenerator
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedGenerator
*
g
=
(
BoxedGenerator
*
)
b
;
BoxedGenerator
*
g
=
(
BoxedGenerator
*
)
b
;
...
...
src/runtime/inline/xrange.cpp
View file @
b34237fb
...
@@ -119,7 +119,7 @@ public:
...
@@ -119,7 +119,7 @@ public:
}
}
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedXrangeIterator
*
it
=
(
BoxedXrangeIterator
*
)
b
;
BoxedXrangeIterator
*
it
=
(
BoxedXrangeIterator
*
)
b
;
v
->
visit
(
it
->
xrange
);
v
->
visit
(
it
->
xrange
);
...
...
src/runtime/iterobject.cpp
View file @
b34237fb
...
@@ -114,7 +114,7 @@ Box* seqiterNext(Box* s) {
...
@@ -114,7 +114,7 @@ Box* seqiterNext(Box* s) {
void
BoxedSeqIter
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedSeqIter
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
assert
(
b
->
cls
==
seqiter_cls
||
b
->
cls
==
seqreviter_cls
);
assert
(
b
->
cls
==
seqiter_cls
||
b
->
cls
==
seqreviter_cls
);
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedSeqIter
*
si
=
static_cast
<
BoxedSeqIter
*>
(
b
);
BoxedSeqIter
*
si
=
static_cast
<
BoxedSeqIter
*>
(
b
);
v
->
visit
(
si
->
b
);
v
->
visit
(
si
->
b
);
...
@@ -124,7 +124,7 @@ void BoxedSeqIter::gcHandler(GCVisitor* v, Box* b) {
...
@@ -124,7 +124,7 @@ void BoxedSeqIter::gcHandler(GCVisitor* v, Box* b) {
void
BoxedIterWrapper
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedIterWrapper
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
assert
(
b
->
cls
==
iterwrapper_cls
);
assert
(
b
->
cls
==
iterwrapper_cls
);
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedIterWrapper
*
iw
=
static_cast
<
BoxedIterWrapper
*>
(
b
);
BoxedIterWrapper
*
iw
=
static_cast
<
BoxedIterWrapper
*>
(
b
);
v
->
visit
(
iw
->
iter
);
v
->
visit
(
iw
->
iter
);
...
...
src/runtime/list.cpp
View file @
b34237fb
...
@@ -1092,7 +1092,7 @@ extern "C" int PyList_SetSlice(PyObject* a, Py_ssize_t ilow, Py_ssize_t ihigh, P
...
@@ -1092,7 +1092,7 @@ extern "C" int PyList_SetSlice(PyObject* a, Py_ssize_t ilow, Py_ssize_t ihigh, P
}
}
void
BoxedListIterator
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedListIterator
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedListIterator
*
it
=
(
BoxedListIterator
*
)
b
;
BoxedListIterator
*
it
=
(
BoxedListIterator
*
)
b
;
v
->
visit
(
it
->
l
);
v
->
visit
(
it
->
l
);
}
}
...
@@ -1100,7 +1100,7 @@ void BoxedListIterator::gcHandler(GCVisitor* v, Box* b) {
...
@@ -1100,7 +1100,7 @@ void BoxedListIterator::gcHandler(GCVisitor* v, Box* b) {
void
BoxedList
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedList
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
assert
(
isSubclass
(
b
->
cls
,
list_cls
));
assert
(
isSubclass
(
b
->
cls
,
list_cls
));
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedList
*
l
=
(
BoxedList
*
)
b
;
BoxedList
*
l
=
(
BoxedList
*
)
b
;
int
size
=
l
->
size
;
int
size
=
l
->
size
;
...
...
src/runtime/long.cpp
View file @
b34237fb
...
@@ -62,7 +62,7 @@ int _PyLong_DigitValue[256] = {
...
@@ -62,7 +62,7 @@ int _PyLong_DigitValue[256] = {
#define PY_ABS_LLONG_MIN (0 - (unsigned PY_LONG_LONG)PY_LLONG_MIN)
#define PY_ABS_LLONG_MIN (0 - (unsigned PY_LONG_LONG)PY_LLONG_MIN)
void
BoxedLong
::
gchandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedLong
::
gchandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedLong
*
l
=
(
BoxedLong
*
)
b
;
BoxedLong
*
l
=
(
BoxedLong
*
)
b
;
...
...
src/runtime/set.cpp
View file @
b34237fb
...
@@ -26,7 +26,7 @@ extern "C" Box* createSet() {
...
@@ -26,7 +26,7 @@ extern "C" Box* createSet() {
}
}
void
BoxedSet
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedSet
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedSet
*
s
=
(
BoxedSet
*
)
b
;
BoxedSet
*
s
=
(
BoxedSet
*
)
b
;
...
@@ -60,7 +60,7 @@ public:
...
@@ -60,7 +60,7 @@ public:
}
}
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedSetIterator
*
it
=
(
BoxedSetIterator
*
)
b
;
BoxedSetIterator
*
it
=
(
BoxedSetIterator
*
)
b
;
...
...
src/runtime/str.cpp
View file @
b34237fb
...
@@ -2313,7 +2313,7 @@ public:
...
@@ -2313,7 +2313,7 @@ public:
}
}
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedStringIterator
*
it
=
(
BoxedStringIterator
*
)
b
;
BoxedStringIterator
*
it
=
(
BoxedStringIterator
*
)
b
;
v
->
visit
(
it
->
s
);
v
->
visit
(
it
->
s
);
}
}
...
...
src/runtime/super.cpp
View file @
b34237fb
...
@@ -41,7 +41,7 @@ public:
...
@@ -41,7 +41,7 @@ public:
assert
(
_o
->
cls
==
super_cls
);
assert
(
_o
->
cls
==
super_cls
);
BoxedSuper
*
o
=
static_cast
<
BoxedSuper
*>
(
_o
);
BoxedSuper
*
o
=
static_cast
<
BoxedSuper
*>
(
_o
);
boxGC
Handler
(
v
,
o
);
Box
::
gc
Handler
(
v
,
o
);
if
(
o
->
type
)
if
(
o
->
type
)
v
->
visit
(
o
->
type
);
v
->
visit
(
o
->
type
);
if
(
o
->
obj
)
if
(
o
->
obj
)
...
...
src/runtime/traceback.cpp
View file @
b34237fb
...
@@ -45,7 +45,7 @@ void BoxedTraceback::gcHandler(GCVisitor* v, Box* b) {
...
@@ -45,7 +45,7 @@ void BoxedTraceback::gcHandler(GCVisitor* v, Box* b) {
if
(
self
->
tb_next
)
if
(
self
->
tb_next
)
v
->
visit
(
self
->
tb_next
);
v
->
visit
(
self
->
tb_next
);
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
}
}
void
printTraceback
(
Box
*
b
)
{
void
printTraceback
(
Box
*
b
)
{
...
...
src/runtime/tuple.cpp
View file @
b34237fb
...
@@ -559,14 +559,14 @@ static Py_ssize_t tuplelength(PyTupleObject* a) {
...
@@ -559,14 +559,14 @@ static Py_ssize_t tuplelength(PyTupleObject* a) {
}
}
void
BoxedTuple
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedTuple
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedTuple
*
t
=
(
BoxedTuple
*
)
b
;
BoxedTuple
*
t
=
(
BoxedTuple
*
)
b
;
v
->
visitRange
((
void
*
const
*
)
&
t
->
elts
[
0
],
(
void
*
const
*
)
&
t
->
elts
[
t
->
size
()]);
v
->
visitRange
((
void
*
const
*
)
&
t
->
elts
[
0
],
(
void
*
const
*
)
&
t
->
elts
[
t
->
size
()]);
}
}
extern
"C"
void
BoxedTupleIterator
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
extern
"C"
void
BoxedTupleIterator
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedTupleIterator
*
it
=
(
BoxedTupleIterator
*
)
b
;
BoxedTupleIterator
*
it
=
(
BoxedTupleIterator
*
)
b
;
v
->
visit
(
it
->
t
);
v
->
visit
(
it
->
t
);
}
}
...
...
src/runtime/types.cpp
View file @
b34237fb
...
@@ -332,6 +332,34 @@ Box* Box::hasnextOrNullIC() {
...
@@ -332,6 +332,34 @@ Box* Box::hasnextOrNullIC() {
return
this
->
cls
->
callHasnextIC
(
this
,
true
);
return
this
->
cls
->
callHasnextIC
(
this
,
true
);
}
}
void
Box
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
if
(
b
->
cls
)
{
v
->
visit
(
b
->
cls
);
if
(
b
->
cls
->
instancesHaveHCAttrs
())
{
HCAttrs
*
attrs
=
b
->
getHCAttrsPtr
();
v
->
visit
(
attrs
->
hcls
);
if
(
attrs
->
attr_list
)
v
->
visit
(
attrs
->
attr_list
);
}
if
(
b
->
cls
->
instancesHaveDictAttrs
())
{
RELEASE_ASSERT
(
0
,
"Shouldn't all of these objects be conservatively scanned?"
);
}
if
(
b
->
cls
->
tp_flags
&
Py_TPFLAGS_HEAPTYPE
)
{
BoxedHeapClass
*
heap_cls
=
static_cast
<
BoxedHeapClass
*>
(
b
->
cls
);
BoxedHeapClass
::
SlotOffset
*
slotOffsets
=
heap_cls
->
slotOffsets
();
for
(
int
i
=
0
;
i
<
heap_cls
->
nslots
();
i
++
)
{
v
->
visit
(
*
((
Box
**
)((
char
*
)
b
+
slotOffsets
[
i
])));
}
}
}
else
{
assert
(
type_cls
==
NULL
||
b
==
type_cls
);
}
}
extern
"C"
BoxedFunctionBase
::
BoxedFunctionBase
(
CLFunction
*
f
)
extern
"C"
BoxedFunctionBase
::
BoxedFunctionBase
(
CLFunction
*
f
)
:
in_weakreflist
(
NULL
),
f
(
f
),
closure
(
NULL
),
ndefaults
(
0
),
defaults
(
NULL
),
modname
(
NULL
),
name
(
NULL
),
doc
(
NULL
)
{
:
in_weakreflist
(
NULL
),
f
(
f
),
closure
(
NULL
),
ndefaults
(
0
),
defaults
(
NULL
),
modname
(
NULL
),
name
(
NULL
),
doc
(
NULL
)
{
if
(
f
->
source
)
{
if
(
f
->
source
)
{
...
@@ -409,7 +437,7 @@ BoxedFunction::BoxedFunction(CLFunction* f, std::initializer_list<Box*> defaults
...
@@ -409,7 +437,7 @@ BoxedFunction::BoxedFunction(CLFunction* f, std::initializer_list<Box*> defaults
}
}
void
BoxedFunction
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedFunction
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedFunction
*
f
=
(
BoxedFunction
*
)
b
;
BoxedFunction
*
f
=
(
BoxedFunction
*
)
b
;
...
@@ -541,7 +569,7 @@ template <typename A, typename B, typename C> void visitContiguousMap(GCVisitor*
...
@@ -541,7 +569,7 @@ template <typename A, typename B, typename C> void visitContiguousMap(GCVisitor*
}
}
void
BoxedModule
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedModule
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedModule
*
d
=
(
BoxedModule
*
)
b
;
BoxedModule
*
d
=
(
BoxedModule
*
)
b
;
...
@@ -571,34 +599,6 @@ extern "C" CLFunction* unboxCLFunction(Box* b) {
...
@@ -571,34 +599,6 @@ extern "C" CLFunction* unboxCLFunction(Box* b) {
return
static_cast
<
BoxedFunction
*>
(
b
)
->
f
;
return
static_cast
<
BoxedFunction
*>
(
b
)
->
f
;
}
}
extern
"C"
void
boxGCHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
if
(
b
->
cls
)
{
v
->
visit
(
b
->
cls
);
if
(
b
->
cls
->
instancesHaveHCAttrs
())
{
HCAttrs
*
attrs
=
b
->
getHCAttrsPtr
();
v
->
visit
(
attrs
->
hcls
);
if
(
attrs
->
attr_list
)
v
->
visit
(
attrs
->
attr_list
);
}
if
(
b
->
cls
->
instancesHaveDictAttrs
())
{
RELEASE_ASSERT
(
0
,
"Shouldn't all of these objects be conservatively scanned?"
);
}
if
(
b
->
cls
->
tp_flags
&
Py_TPFLAGS_HEAPTYPE
)
{
BoxedHeapClass
*
heap_cls
=
static_cast
<
BoxedHeapClass
*>
(
b
->
cls
);
BoxedHeapClass
::
SlotOffset
*
slotOffsets
=
heap_cls
->
slotOffsets
();
for
(
int
i
=
0
;
i
<
heap_cls
->
nslots
();
i
++
)
{
v
->
visit
(
*
((
Box
**
)((
char
*
)
b
+
slotOffsets
[
i
])));
}
}
}
else
{
assert
(
type_cls
==
NULL
||
b
==
type_cls
);
}
}
static
Box
*
typeCallInner
(
CallRewriteArgs
*
rewrite_args
,
ArgPassSpec
argspec
,
Box
*
arg1
,
Box
*
arg2
,
Box
*
arg3
,
static
Box
*
typeCallInner
(
CallRewriteArgs
*
rewrite_args
,
ArgPassSpec
argspec
,
Box
*
arg1
,
Box
*
arg2
,
Box
*
arg3
,
Box
**
args
,
const
std
::
vector
<
BoxedString
*>*
keyword_names
);
Box
**
args
,
const
std
::
vector
<
BoxedString
*>*
keyword_names
);
...
@@ -1132,7 +1132,7 @@ Box* typeCall(Box* obj, BoxedTuple* vararg, BoxedDict* kwargs) {
...
@@ -1132,7 +1132,7 @@ Box* typeCall(Box* obj, BoxedTuple* vararg, BoxedDict* kwargs) {
}
}
void
BoxedHeapClass
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedHeapClass
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedClass
*
cls
=
(
BoxedClass
*
)
b
;
BoxedClass
*
cls
=
(
BoxedClass
*
)
b
;
...
@@ -1196,7 +1196,7 @@ static void typeSubSetDict(Box* obj, Box* val, void* context) {
...
@@ -1196,7 +1196,7 @@ static void typeSubSetDict(Box* obj, Box* val, void* context) {
Box
*
dict_descr
=
NULL
;
Box
*
dict_descr
=
NULL
;
void
BoxedInstanceMethod
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedInstanceMethod
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedInstanceMethod
*
im
=
(
BoxedInstanceMethod
*
)
b
;
BoxedInstanceMethod
*
im
=
(
BoxedInstanceMethod
*
)
b
;
...
@@ -1206,7 +1206,7 @@ void BoxedInstanceMethod::gcHandler(GCVisitor* v, Box* b) {
...
@@ -1206,7 +1206,7 @@ void BoxedInstanceMethod::gcHandler(GCVisitor* v, Box* b) {
}
}
void
BoxedProperty
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedProperty
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedProperty
*
prop
=
(
BoxedProperty
*
)
b
;
BoxedProperty
*
prop
=
(
BoxedProperty
*
)
b
;
...
@@ -1221,7 +1221,7 @@ void BoxedProperty::gcHandler(GCVisitor* v, Box* b) {
...
@@ -1221,7 +1221,7 @@ void BoxedProperty::gcHandler(GCVisitor* v, Box* b) {
}
}
void
BoxedStaticmethod
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedStaticmethod
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedStaticmethod
*
sm
=
(
BoxedStaticmethod
*
)
b
;
BoxedStaticmethod
*
sm
=
(
BoxedStaticmethod
*
)
b
;
...
@@ -1230,7 +1230,7 @@ void BoxedStaticmethod::gcHandler(GCVisitor* v, Box* b) {
...
@@ -1230,7 +1230,7 @@ void BoxedStaticmethod::gcHandler(GCVisitor* v, Box* b) {
}
}
void
BoxedClassmethod
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedClassmethod
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedClassmethod
*
cm
=
(
BoxedClassmethod
*
)
b
;
BoxedClassmethod
*
cm
=
(
BoxedClassmethod
*
)
b
;
...
@@ -1241,7 +1241,7 @@ void BoxedClassmethod::gcHandler(GCVisitor* v, Box* b) {
...
@@ -1241,7 +1241,7 @@ void BoxedClassmethod::gcHandler(GCVisitor* v, Box* b) {
void
BoxedSlice
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedSlice
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
assert
(
b
->
cls
==
slice_cls
);
assert
(
b
->
cls
==
slice_cls
);
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedSlice
*
sl
=
static_cast
<
BoxedSlice
*>
(
b
);
BoxedSlice
*
sl
=
static_cast
<
BoxedSlice
*>
(
b
);
...
@@ -1259,7 +1259,7 @@ static int call_gc_visit(PyObject* val, void* arg) {
...
@@ -1259,7 +1259,7 @@ static int call_gc_visit(PyObject* val, void* arg) {
}
}
static
void
proxy_to_tp_traverse
(
GCVisitor
*
v
,
Box
*
b
)
{
static
void
proxy_to_tp_traverse
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
assert
(
b
->
cls
->
tp_traverse
);
assert
(
b
->
cls
->
tp_traverse
);
b
->
cls
->
tp_traverse
(
b
,
call_gc_visit
,
v
);
b
->
cls
->
tp_traverse
(
b
,
call_gc_visit
,
v
);
...
@@ -1268,7 +1268,7 @@ static void proxy_to_tp_traverse(GCVisitor* v, Box* b) {
...
@@ -1268,7 +1268,7 @@ static void proxy_to_tp_traverse(GCVisitor* v, Box* b) {
void
BoxedClosure
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
void
BoxedClosure
::
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
assert
(
isSubclass
(
b
->
cls
,
closure_cls
));
assert
(
isSubclass
(
b
->
cls
,
closure_cls
));
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
BoxedClosure
*
c
=
(
BoxedClosure
*
)
b
;
BoxedClosure
*
c
=
(
BoxedClosure
*
)
b
;
if
(
c
->
parent
)
if
(
c
->
parent
)
...
@@ -1981,7 +1981,7 @@ public:
...
@@ -1981,7 +1981,7 @@ public:
DEFAULT_CLASS
(
attrwrapperiter_cls
);
DEFAULT_CLASS
(
attrwrapperiter_cls
);
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
AttrWrapperIter
*
self
=
(
AttrWrapperIter
*
)
b
;
AttrWrapperIter
*
self
=
(
AttrWrapperIter
*
)
b
;
v
->
visit
(
self
->
hcls
);
v
->
visit
(
self
->
hcls
);
...
@@ -2016,7 +2016,7 @@ public:
...
@@ -2016,7 +2016,7 @@ public:
Box
*
getUnderlying
()
{
return
b
;
}
Box
*
getUnderlying
()
{
return
b
;
}
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
AttrWrapper
*
aw
=
(
AttrWrapper
*
)
b
;
AttrWrapper
*
aw
=
(
AttrWrapper
*
)
b
;
v
->
visit
(
aw
->
b
);
v
->
visit
(
aw
->
b
);
...
@@ -3026,7 +3026,7 @@ out:
...
@@ -3026,7 +3026,7 @@ out:
}
}
void
unicode_visit
(
GCVisitor
*
v
,
Box
*
b
)
{
void
unicode_visit
(
GCVisitor
*
v
,
Box
*
b
)
{
boxGC
Handler
(
v
,
b
);
Box
::
gc
Handler
(
v
,
b
);
PyUnicodeObject
*
u
=
(
PyUnicodeObject
*
)
b
;
PyUnicodeObject
*
u
=
(
PyUnicodeObject
*
)
b
;
v
->
visit
(
u
->
str
);
v
->
visit
(
u
->
str
);
...
@@ -3193,7 +3193,7 @@ void setupRuntime() {
...
@@ -3193,7 +3193,7 @@ void setupRuntime() {
// We have to do a little dance to get object_cls and type_cls set up, since the normal
// We have to do a little dance to get object_cls and type_cls set up, since the normal
// object-creation routines look at the class to see the allocation size.
// object-creation routines look at the class to see the allocation size.
void
*
mem
=
gc_alloc
(
sizeof
(
BoxedClass
),
gc
::
GCKind
::
PYTHON
);
void
*
mem
=
gc_alloc
(
sizeof
(
BoxedClass
),
gc
::
GCKind
::
PYTHON
);
object_cls
=
::
new
(
mem
)
BoxedClass
(
NULL
,
&
boxGC
Handler
,
0
,
0
,
sizeof
(
Box
),
false
);
object_cls
=
::
new
(
mem
)
BoxedClass
(
NULL
,
&
Box
::
gc
Handler
,
0
,
0
,
sizeof
(
Box
),
false
);
mem
=
gc_alloc
(
sizeof
(
BoxedHeapClass
),
gc
::
GCKind
::
PYTHON
);
mem
=
gc_alloc
(
sizeof
(
BoxedHeapClass
),
gc
::
GCKind
::
PYTHON
);
type_cls
=
::
new
(
mem
)
BoxedHeapClass
(
object_cls
,
&
BoxedHeapClass
::
gcHandler
,
offsetof
(
BoxedClass
,
attrs
),
type_cls
=
::
new
(
mem
)
BoxedHeapClass
(
object_cls
,
&
BoxedHeapClass
::
gcHandler
,
offsetof
(
BoxedClass
,
attrs
),
offsetof
(
BoxedClass
,
tp_weaklist
),
sizeof
(
BoxedHeapClass
),
false
,
NULL
);
offsetof
(
BoxedClass
,
tp_weaklist
),
sizeof
(
BoxedHeapClass
),
false
,
NULL
);
...
...
src/runtime/types.h
View file @
b34237fb
...
@@ -1006,8 +1006,6 @@ public:
...
@@ -1006,8 +1006,6 @@ public:
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
_o
);
static
void
gcHandler
(
GCVisitor
*
v
,
Box
*
_o
);
};
};
extern
"C"
void
boxGCHandler
(
GCVisitor
*
v
,
Box
*
b
);
Box
*
objectNewNoArgs
(
BoxedClass
*
cls
);
Box
*
objectNewNoArgs
(
BoxedClass
*
cls
);
Box
*
objectSetattr
(
Box
*
obj
,
Box
*
attr
,
Box
*
value
);
Box
*
objectSetattr
(
Box
*
obj
,
Box
*
attr
,
Box
*
value
);
...
...
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