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
772200b7
Commit
772200b7
authored
Feb 26, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of the now-unused has_safe_tp_dealloc
parent
6be5e446
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
0 additions
and
44 deletions
+0
-44
src/runtime/builtin_modules/thread.cpp
src/runtime/builtin_modules/thread.cpp
+0
-1
src/runtime/classobj.cpp
src/runtime/classobj.cpp
+0
-1
src/runtime/dict.cpp
src/runtime/dict.cpp
+0
-2
src/runtime/file.cpp
src/runtime/file.cpp
+0
-2
src/runtime/generator.cpp
src/runtime/generator.cpp
+0
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+0
-21
src/runtime/set.cpp
src/runtime/set.cpp
+0
-1
src/runtime/types.cpp
src/runtime/types.cpp
+0
-2
src/runtime/types.h
src/runtime/types.h
+0
-13
No files found.
src/runtime/builtin_modules/thread.cpp
View file @
772200b7
...
...
@@ -230,7 +230,6 @@ void setupThread() {
thread_lock_cls
=
BoxedClass
::
create
(
type_cls
,
object_cls
,
0
,
0
,
sizeof
(
BoxedThreadLock
),
false
,
"lock"
,
true
,
BoxedThreadLock
::
dealloc
,
NULL
,
false
);
thread_lock_cls
->
tp_dealloc
=
BoxedThreadLock
::
threadLockDestructor
;
thread_lock_cls
->
has_safe_tp_dealloc
=
true
;
thread_lock_cls
->
instances_are_nonzero
=
true
;
thread_lock_cls
->
giveAttr
(
"__module__"
,
boxString
(
"thread"
));
...
...
src/runtime/classobj.cpp
View file @
772200b7
...
...
@@ -1912,6 +1912,5 @@ void setupClassobj() {
instance_cls
->
tp_as_number
->
nb_index
=
instance_index
;
instance_cls
->
tp_as_number
->
nb_power
=
instance_pow
;
instance_cls
->
tp_as_number
->
nb_inplace_power
=
instance_ipow
;
instance_cls
->
has_safe_tp_dealloc
=
false
;
}
}
src/runtime/dict.cpp
View file @
772200b7
...
...
@@ -866,8 +866,6 @@ void setupDict() {
dictiterkey_cls
->
instances_are_nonzero
=
dictitervalue_cls
->
instances_are_nonzero
=
dictiteritem_cls
->
instances_are_nonzero
=
true
;
dict_cls
->
has_safe_tp_dealloc
=
true
;
dict_cls
->
giveAttr
(
"__len__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
dictLen
,
BOXED_INT
,
1
)));
dict_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
dictNew
,
UNKNOWN
,
1
,
true
,
true
)));
dict_cls
->
giveAttr
(
"__init__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
dictInit
,
NONE
,
1
,
true
,
true
)));
...
...
src/runtime/file.cpp
View file @
772200b7
...
...
@@ -1856,8 +1856,6 @@ void file_dealloc(Box* b) noexcept {
}
void
setupFile
()
{
file_cls
->
has_safe_tp_dealloc
=
true
;
file_cls
->
giveAttr
(
"read"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
fileRead
,
STR
,
2
,
false
,
false
),
{
autoDecref
(
boxInt
(
-
1
))
}));
...
...
src/runtime/generator.cpp
View file @
772200b7
...
...
@@ -519,7 +519,6 @@ void setupGenerator() {
generator_cls
=
BoxedClass
::
create
(
type_cls
,
object_cls
,
0
,
offsetof
(
BoxedGenerator
,
weakreflist
),
sizeof
(
BoxedGenerator
),
false
,
"generator"
,
false
,
(
destructor
)
generator_dealloc
,
NULL
,
true
,
(
traverseproc
)
generator_traverse
,
NOCLEAR
);
generator_cls
->
has_safe_tp_dealloc
=
true
;
generator_cls
->
giveAttr
(
"__iter__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
generatorIter
,
typeFromClass
(
generator_cls
),
1
)));
...
...
src/runtime/objmodel.cpp
View file @
772200b7
...
...
@@ -6524,27 +6524,6 @@ Box* _typeNew(BoxedClass* metatype, BoxedString* name, BoxedTuple* bases, BoxedD
made
->
tp_alloc
=
PyType_GenericAlloc
;
// On some occasions, Python-implemented classes inherit from C-implement classes. For
// example, KeyedRef inherits from weakref, and needs to have it's finalizer called
// whenever weakref would. So we inherit the property that a class has a safe tp_dealloc
// too. However, we must be careful to do that only when nothing else invalidates that
// property, such as the presence of a __del__ (tp_del) method.
assert
(
!
made
->
has_safe_tp_dealloc
);
if
(
!
made
->
tp_del
)
{
for
(
auto
b
:
*
bases
)
{
BoxedClass
*
base
=
static_cast
<
BoxedClass
*>
(
b
);
if
(
!
PyType_Check
(
base
))
continue
;
if
(
base
->
tp_del
)
{
break
;
}
if
(
base
->
has_safe_tp_dealloc
)
{
made
->
has_safe_tp_dealloc
=
true
;
break
;
}
}
}
return
made
;
}
...
...
src/runtime/set.cpp
View file @
772200b7
...
...
@@ -862,7 +862,6 @@ void setupSet() {
frozenset_cls
->
tp_as_number
=
&
frozenset_as_number
;
set_cls
->
tp_dealloc
=
frozenset_cls
->
tp_dealloc
=
BoxedSet
::
dealloc
;
set_cls
->
has_safe_tp_dealloc
=
frozenset_cls
->
has_safe_tp_dealloc
=
true
;
set_iterator_cls
=
BoxedClass
::
create
(
type_cls
,
object_cls
,
0
,
0
,
sizeof
(
BoxedSetIterator
),
false
,
"setiterator"
,
false
,
(
destructor
)
BoxedSetIterator
::
dealloc
,
NULL
,
true
,
...
...
src/runtime/types.cpp
View file @
772200b7
...
...
@@ -3762,7 +3762,6 @@ void setupRuntime() {
_PyObject_GC_TRACK
(
type_cls
);
type_cls
->
tp_is_gc
=
(
inquiry
)
type_is_gc
;
type_cls
->
has_safe_tp_dealloc
=
false
;
type_cls
->
tp_flags
|=
Py_TPFLAGS_TYPE_SUBCLASS
;
type_cls
->
tp_itemsize
=
sizeof
(
BoxedHeapClass
::
SlotOffset
);
...
...
@@ -3840,7 +3839,6 @@ void setupRuntime() {
builtin_function_or_method_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
0
,
offsetof
(
BoxedBuiltinFunctionOrMethod
,
weakreflist
),
sizeof
(
BoxedBuiltinFunctionOrMethod
),
false
,
"builtin_function_or_method"
,
false
,
functionDtor
,
NULL
,
true
,
(
traverseproc
)
builtin_func_traverse
,
NOCLEAR
);
function_cls
->
has_safe_tp_dealloc
=
builtin_function_or_method_cls
->
has_safe_tp_dealloc
=
true
;
module_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
offsetof
(
BoxedModule
,
attrs
),
0
,
sizeof
(
BoxedModule
),
false
,
"module"
,
true
,
BoxedModule
::
dealloc
,
NULL
,
true
,
BoxedModule
::
traverse
,
BoxedModule
::
clear
);
...
...
src/runtime/types.h
View file @
772200b7
...
...
@@ -204,19 +204,6 @@ public:
bool
instancesHaveHCAttrs
()
{
return
attrs_offset
!=
0
;
}
bool
instancesHaveDictAttrs
()
{
return
tp_dictoffset
!=
0
;
}
// A "safe" tp_dealloc destructor/finalizer is one we believe:
// 1) Can be called at any point after the object is dead.
// (implies it's references could be finalized already, including its class)
// 2) Won't take a lot of time to run.
// 3) Won't take up a lot of memory (requiring another GC run).
// 4) Won't resurrect itself.
//
// We specify that such destructors are safe for optimization purposes (in our GC, we try to
// emulate the order of destructor calls and support resurrection by calling them in topological
// order through multiple GC passes, which is potentially quite expensive). We call the tp_dealloc
// as the object gets freed rather than put it in a pending finalizer list.
bool
has_safe_tp_dealloc
;
// Whether this class object is constant or not, ie whether or not class-level
// attributes can be changed or added.
// Does not necessarily imply that the instances of this class are constant,
...
...
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