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
88868143
Commit
88868143
authored
Nov 13, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This is kinda working
parent
8ebaa1ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
14 deletions
+11
-14
from_cpython/Include/object.h
from_cpython/Include/object.h
+0
-2
from_cpython/Include/objimpl.h
from_cpython/Include/objimpl.h
+1
-6
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+2
-2
src/runtime/types.cpp
src/runtime/types.cpp
+8
-4
No files found.
from_cpython/Include/object.h
View file @
88868143
...
...
@@ -26,7 +26,6 @@ An object has a 'reference count' that is increased or decreased when a
pointer to the object is copied or deleted; when the reference count
reaches zero there are no references to the object left and it can be
removed from the heap.
[not true in Pyston]
An object has a 'type' that determines what it represents and what kind
of data it contains. An object's type is fixed when it is created.
...
...
@@ -43,7 +42,6 @@ after allocation. (These restrictions are made so a reference to an
object can be simply a pointer -- moving an object would require
updating all the pointers, and changing an object's size would require
moving it if there was another object right next to it.)
[This may not always be true in Pyston]
Objects are always accessed through pointers of the type 'PyObject *'.
The type 'PyObject' is a structure that only contains the reference count
...
...
from_cpython/Include/objimpl.h
View file @
88868143
...
...
@@ -160,17 +160,12 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t) PYSTON_NO
#define PyObject_NewVar(type, typeobj, n) \
( (type *) _PyObject_NewVar((typeobj), (n)) )
// Pyston change: these are function calls now
#if 0
/* Macros trading binary compatibility for speed. See also pymem.h.
Note that these macros expect non-NULL object pointers.*/
#define PyObject_INIT(op, typeobj) \
( Py_TYPE(op) = (typeobj), (op) )
( Py_TYPE(op) = (typeobj),
_Py_NewReference((PyObject *)(op)),
(op) )
#define PyObject_INIT_VAR(op, typeobj, size) \
( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) )
#endif
#define PyObject_INIT(op, typeobj) PyObject_Init((PyObject*)(op), (PyTypeObject*)(typeobj))
#define PyObject_INIT_VAR(op, typeobj, size) PyObject_InitVar((PyVarObject*)(op), (PyTypeObject*)(typeobj), size)
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
...
...
src/runtime/objmodel.cpp
View file @
88868143
...
...
@@ -438,7 +438,7 @@ BoxedClass::BoxedClass(BoxedClass* base, int attrs_offset, int weaklist_offset,
assert
(
tp_base
->
tp_alloc
);
tp_alloc
=
tp_base
->
tp_alloc
;
}
else
{
assert
(
object_cls
==
NULL
);
assert
(
this
==
object_cls
);
tp_alloc
=
PystonType_GenericAlloc
;
}
...
...
@@ -468,7 +468,7 @@ BoxedClass::BoxedClass(BoxedClass* base, int attrs_offset, int weaklist_offset,
tp_free
=
default_free
;
if
(
!
base
)
{
assert
(
object_cls
==
nullptr
);
assert
(
this
==
object_cls
);
// we're constructing 'object'
// Will have to add __base__ = None later
}
else
{
...
...
src/runtime/types.cpp
View file @
88868143
...
...
@@ -3480,11 +3480,15 @@ void setupRuntime() {
// 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.
void
*
mem
=
PyObject_MALLOC
(
sizeof
(
BoxedClass
));
object_cls
=
::
new
(
mem
)
BoxedClass
(
NULL
,
0
,
0
,
sizeof
(
Box
),
false
,
"object"
);
mem
=
PyObject_MALLOC
(
sizeof
(
BoxedClass
));
type_cls
=
::
new
(
mem
)
BoxedClass
(
object_cls
,
offsetof
(
BoxedClass
,
attrs
),
object_cls
=
static_cast
<
BoxedClass
*>
(
PyObject_MALLOC
(
sizeof
(
BoxedClass
)));
PyObject_INIT
(
object_cls
,
NULL
);
::
new
(
object_cls
)
BoxedClass
(
NULL
,
0
,
0
,
sizeof
(
Box
),
false
,
"object"
);
type_cls
=
static_cast
<
BoxedClass
*>
(
PyObject_MALLOC
(
sizeof
(
BoxedClass
)));
PyObject_INIT
(
type_cls
,
type_cls
);
::
new
(
type_cls
)
BoxedClass
(
object_cls
,
offsetof
(
BoxedClass
,
attrs
),
offsetof
(
BoxedClass
,
tp_weaklist
),
sizeof
(
BoxedHeapClass
),
false
,
"type"
);
type_cls
->
has_safe_tp_dealloc
=
false
;
type_cls
->
tp_flags
|=
Py_TPFLAGS_TYPE_SUBCLASS
;
type_cls
->
tp_itemsize
=
sizeof
(
BoxedHeapClass
::
SlotOffset
);
...
...
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