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
6a880f44
Commit
6a880f44
authored
Nov 02, 2015
by
Kevin Modzelewski
Committed by
Kevin Modzelewski
Nov 02, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move some functions to where I think they make more sense
parent
3a811c26
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
16 deletions
+15
-16
src/runtime/classobj.cpp
src/runtime/classobj.cpp
+1
-0
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+0
-10
src/runtime/objmodel.h
src/runtime/objmodel.h
+0
-6
src/runtime/types.cpp
src/runtime/types.cpp
+10
-0
src/runtime/types.h
src/runtime/types.h
+4
-0
No files found.
src/runtime/classobj.cpp
View file @
6a880f44
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "capi/typeobject.h"
#include "capi/typeobject.h"
#include "capi/types.h"
#include "capi/types.h"
#include "codegen/unwinding.h"
#include "core/types.h"
#include "core/types.h"
#include "runtime/objmodel.h"
#include "runtime/objmodel.h"
#include "runtime/rewrite_args.h"
#include "runtime/rewrite_args.h"
...
...
src/runtime/objmodel.cpp
View file @
6a880f44
...
@@ -337,10 +337,6 @@ extern "C" Box** unpackIntoArray(Box* obj, int64_t expected_size) {
...
@@ -337,10 +337,6 @@ extern "C" Box** unpackIntoArray(Box* obj, int64_t expected_size) {
return
&
elts
[
0
];
return
&
elts
[
0
];
}
}
void
dealloc_null
(
Box
*
box
)
{
assert
(
box
->
cls
->
tp_del
==
NULL
);
}
// Analoguous to CPython's implementation of subtype_dealloc, but having a GC
// Analoguous to CPython's implementation of subtype_dealloc, but having a GC
// saves us from complications involving "trashcan macros".
// saves us from complications involving "trashcan macros".
//
//
...
@@ -378,12 +374,6 @@ static void subtype_dealloc(Box* self) {
...
@@ -378,12 +374,6 @@ static void subtype_dealloc(Box* self) {
}
}
}
}
// We don't need CPython's version of tp_free since we have GC.
// We still need to set tp_free to something and not a NULL pointer,
// because C extensions might still call tp_free from tp_dealloc.
void
default_free
(
void
*
)
{
}
bool
BoxedClass
::
hasNonDefaultTpDealloc
()
{
bool
BoxedClass
::
hasNonDefaultTpDealloc
()
{
// Find nearest base with a different tp_dealloc.
// Find nearest base with a different tp_dealloc.
BoxedClass
*
base
=
this
;
BoxedClass
*
base
=
this
;
...
...
src/runtime/objmodel.h
View file @
6a880f44
...
@@ -42,17 +42,11 @@ void _printStacktrace();
...
@@ -42,17 +42,11 @@ void _printStacktrace();
extern
"C"
Box
*
deopt
(
AST_expr
*
expr
,
Box
*
value
);
extern
"C"
Box
*
deopt
(
AST_expr
*
expr
,
Box
*
value
);
// Finalizer-related
void
default_free
(
void
*
);
void
dealloc_null
(
Box
*
box
);
// helper function for raising from the runtime:
// helper function for raising from the runtime:
void
raiseExcHelper
(
BoxedClass
*
,
const
char
*
fmt
,
...)
__attribute__
((
__noreturn__
))
void
raiseExcHelper
(
BoxedClass
*
,
const
char
*
fmt
,
...)
__attribute__
((
__noreturn__
))
__attribute__
((
format
(
printf
,
2
,
3
)));
__attribute__
((
format
(
printf
,
2
,
3
)));
void
raiseExcHelper
(
BoxedClass
*
,
Box
*
arg
)
__attribute__
((
__noreturn__
));
void
raiseExcHelper
(
BoxedClass
*
,
Box
*
arg
)
__attribute__
((
__noreturn__
));
BoxedModule
*
getCurrentModule
();
// TODO sort this
// TODO sort this
extern
"C"
bool
softspace
(
Box
*
b
,
bool
newval
);
extern
"C"
bool
softspace
(
Box
*
b
,
bool
newval
);
extern
"C"
void
printHelper
(
Box
*
dest
,
Box
*
var
,
bool
nl
);
extern
"C"
void
printHelper
(
Box
*
dest
,
Box
*
var
,
bool
nl
);
...
...
src/runtime/types.cpp
View file @
6a880f44
...
@@ -3498,6 +3498,16 @@ extern "C" PyUnicodeObject* _PyUnicode_New(Py_ssize_t length) noexcept {
...
@@ -3498,6 +3498,16 @@ extern "C" PyUnicodeObject* _PyUnicode_New(Py_ssize_t length) noexcept {
return
unicode
;
return
unicode
;
}
}
// We don't need CPython's version of tp_free since we have GC.
// We still need to set tp_free to something and not a NULL pointer,
// because C extensions might still call tp_free from tp_dealloc.
void
default_free
(
void
*
)
{
}
void
dealloc_null
(
Box
*
box
)
{
assert
(
box
->
cls
->
tp_del
==
NULL
);
}
// Normally we don't call the Python tp_ slots that are present to support
// Normally we don't call the Python tp_ slots that are present to support
// CPython's reference-counted garbage collection.
// CPython's reference-counted garbage collection.
static
void
setTypeGCProxy
(
BoxedClass
*
cls
)
{
static
void
setTypeGCProxy
(
BoxedClass
*
cls
)
{
...
...
src/runtime/types.h
View file @
6a880f44
...
@@ -181,6 +181,10 @@ void ensureCAPIExceptionSet();
...
@@ -181,6 +181,10 @@ void ensureCAPIExceptionSet();
struct
ExcInfo
;
struct
ExcInfo
;
void
setCAPIException
(
const
ExcInfo
&
e
);
void
setCAPIException
(
const
ExcInfo
&
e
);
// Finalizer-related
void
default_free
(
void
*
);
void
dealloc_null
(
Box
*
box
);
// In Pyston, this is the same type as CPython's PyTypeObject (they are interchangeable, but we
// In Pyston, this is the same type as CPython's PyTypeObject (they are interchangeable, but we
// use BoxedClass in Pyston wherever possible as a convention).
// use BoxedClass in Pyston wherever possible as a convention).
class
BoxedClass
:
public
BoxVar
{
class
BoxedClass
:
public
BoxVar
{
...
...
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