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
ad8eddcf
Commit
ad8eddcf
authored
May 04, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #489 from tjhance/member_descriptor_cls
rename member -> member_descriptor
parents
90939a9b
d7f34c8d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
15 deletions
+15
-15
src/runtime/descr.cpp
src/runtime/descr.cpp
+3
-3
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+3
-3
src/runtime/types.cpp
src/runtime/types.cpp
+5
-5
src/runtime/types.h
src/runtime/types.h
+4
-4
No files found.
src/runtime/descr.cpp
View file @
ad8eddcf
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
namespace
pyston
{
namespace
pyston
{
static
Box
*
memberGet
(
BoxedMemberDescriptor
*
self
,
Box
*
inst
,
Box
*
owner
)
{
static
Box
*
memberGet
(
BoxedMemberDescriptor
*
self
,
Box
*
inst
,
Box
*
owner
)
{
RELEASE_ASSERT
(
self
->
cls
==
member_cls
,
""
);
RELEASE_ASSERT
(
self
->
cls
==
member_
descriptor_
cls
,
""
);
if
(
inst
==
None
)
if
(
inst
==
None
)
return
self
;
return
self
;
...
@@ -169,8 +169,8 @@ static Box* classmethodGet(Box* self, Box* obj, Box* type) {
...
@@ -169,8 +169,8 @@ static Box* classmethodGet(Box* self, Box* obj, Box* type) {
}
}
void
setupDescr
()
{
void
setupDescr
()
{
member_cls
->
giveAttr
(
"__get__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
memberGet
,
UNKNOWN
,
3
)));
member_
descriptor_
cls
->
giveAttr
(
"__get__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
memberGet
,
UNKNOWN
,
3
)));
member_cls
->
freeze
();
member_
descriptor_
cls
->
freeze
();
property_cls
->
giveAttr
(
"__init__"
,
property_cls
->
giveAttr
(
"__init__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
propertyInit
,
UNKNOWN
,
5
,
4
,
false
,
false
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
propertyInit
,
UNKNOWN
,
5
,
4
,
false
,
false
,
...
...
src/runtime/objmodel.cpp
View file @
ad8eddcf
...
@@ -980,7 +980,7 @@ Box* descriptorClsSpecialCases(GetattrRewriteArgs* rewrite_args, BoxedClass* cls
...
@@ -980,7 +980,7 @@ Box* descriptorClsSpecialCases(GetattrRewriteArgs* rewrite_args, BoxedClass* cls
}
}
// Special case: member descriptor
// Special case: member descriptor
if
(
descr
->
cls
==
member_cls
)
{
if
(
descr
->
cls
==
member_
descriptor_
cls
)
{
if
(
rewrite_args
)
if
(
rewrite_args
)
r_descr
->
addAttrGuard
(
BOX_CLS_OFFSET
,
(
uint64_t
)
descr
->
cls
);
r_descr
->
addAttrGuard
(
BOX_CLS_OFFSET
,
(
uint64_t
)
descr
->
cls
);
...
@@ -1026,7 +1026,7 @@ Box* dataDescriptorInstanceSpecialCases(GetattrRewriteArgs* rewrite_args, const
...
@@ -1026,7 +1026,7 @@ Box* dataDescriptorInstanceSpecialCases(GetattrRewriteArgs* rewrite_args, const
Box
*
descr
,
RewriterVar
*
r_descr
,
bool
for_call
,
Box
**
bind_obj_out
,
Box
*
descr
,
RewriterVar
*
r_descr
,
bool
for_call
,
Box
**
bind_obj_out
,
RewriterVar
**
r_bind_obj_out
)
{
RewriterVar
**
r_bind_obj_out
)
{
// Special case: data descriptor: member descriptor
// Special case: data descriptor: member descriptor
if
(
descr
->
cls
==
member_cls
)
{
if
(
descr
->
cls
==
member_
descriptor_
cls
)
{
static
StatCounter
slowpath
(
"slowpath_member_descriptor_get"
);
static
StatCounter
slowpath
(
"slowpath_member_descriptor_get"
);
slowpath
.
log
();
slowpath
.
log
();
...
@@ -1722,7 +1722,7 @@ bool dataDescriptorSetSpecialCases(Box* obj, Box* val, Box* descr, SetattrRewrit
...
@@ -1722,7 +1722,7 @@ bool dataDescriptorSetSpecialCases(Box* obj, Box* val, Box* descr, SetattrRewrit
getset_descr
->
set
(
obj
,
val
,
getset_descr
->
closure
);
getset_descr
->
set
(
obj
,
val
,
getset_descr
->
closure
);
return
true
;
return
true
;
}
else
if
(
descr
->
cls
==
member_cls
)
{
}
else
if
(
descr
->
cls
==
member_
descriptor_
cls
)
{
BoxedMemberDescriptor
*
member_desc
=
static_cast
<
BoxedMemberDescriptor
*>
(
descr
);
BoxedMemberDescriptor
*
member_desc
=
static_cast
<
BoxedMemberDescriptor
*>
(
descr
);
PyMemberDef
member_def
;
PyMemberDef
member_def
;
memset
(
&
member_def
,
0
,
sizeof
(
member_def
));
memset
(
&
member_def
,
0
,
sizeof
(
member_def
));
...
...
src/runtime/types.cpp
View file @
ad8eddcf
...
@@ -655,7 +655,7 @@ extern "C" void closureGCHandler(GCVisitor* v, Box* b) {
...
@@ -655,7 +655,7 @@ extern "C" void closureGCHandler(GCVisitor* v, Box* b) {
extern
"C"
{
extern
"C"
{
BoxedClass
*
object_cls
,
*
type_cls
,
*
none_cls
,
*
bool_cls
,
*
int_cls
,
*
float_cls
,
BoxedClass
*
object_cls
,
*
type_cls
,
*
none_cls
,
*
bool_cls
,
*
int_cls
,
*
float_cls
,
*
str_cls
=
NULL
,
*
function_cls
,
*
instancemethod_cls
,
*
list_cls
,
*
slice_cls
,
*
module_cls
,
*
dict_cls
,
*
tuple_cls
,
*
str_cls
=
NULL
,
*
function_cls
,
*
instancemethod_cls
,
*
list_cls
,
*
slice_cls
,
*
module_cls
,
*
dict_cls
,
*
tuple_cls
,
*
file_cls
,
*
member_cls
,
*
closure_cls
,
*
generator_cls
,
*
complex_cls
,
*
basestring_cls
,
*
property_cls
,
*
file_cls
,
*
member_
descriptor_
cls
,
*
closure_cls
,
*
generator_cls
,
*
complex_cls
,
*
basestring_cls
,
*
property_cls
,
*
staticmethod_cls
,
*
classmethod_cls
,
*
attrwrapper_cls
,
*
pyston_getset_cls
,
*
capi_getset_cls
,
*
staticmethod_cls
,
*
classmethod_cls
,
*
attrwrapper_cls
,
*
pyston_getset_cls
,
*
capi_getset_cls
,
*
builtin_function_or_method_cls
,
*
attrwrapperiter_cls
,
*
set_cls
,
*
frozenset_cls
;
*
builtin_function_or_method_cls
,
*
attrwrapperiter_cls
,
*
set_cls
,
*
frozenset_cls
;
...
@@ -2069,8 +2069,8 @@ void setupRuntime() {
...
@@ -2069,8 +2069,8 @@ void setupRuntime() {
module_cls
=
new
BoxedHeapClass
(
object_cls
,
&
moduleGCHandler
,
offsetof
(
BoxedModule
,
attrs
),
0
,
sizeof
(
BoxedModule
),
module_cls
=
new
BoxedHeapClass
(
object_cls
,
&
moduleGCHandler
,
offsetof
(
BoxedModule
,
attrs
),
0
,
sizeof
(
BoxedModule
),
false
,
static_cast
<
BoxedString
*>
(
boxStrConstant
(
"module"
)));
false
,
static_cast
<
BoxedString
*>
(
boxStrConstant
(
"module"
)));
member_cls
=
new
BoxedHeapClass
(
object_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedMemberDescriptor
),
false
,
member_
descriptor_
cls
=
new
BoxedHeapClass
(
object_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedMemberDescriptor
),
false
,
static_cast
<
BoxedString
*>
(
boxStrConstant
(
"membe
r"
)));
static_cast
<
BoxedString
*>
(
boxStrConstant
(
"member_descripto
r"
)));
capifunc_cls
=
new
BoxedHeapClass
(
object_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedCApiFunction
),
false
,
capifunc_cls
=
new
BoxedHeapClass
(
object_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedCApiFunction
),
false
,
static_cast
<
BoxedString
*>
(
boxStrConstant
(
"capifunc"
)));
static_cast
<
BoxedString
*>
(
boxStrConstant
(
"capifunc"
)));
method_cls
=
new
BoxedHeapClass
(
object_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedMethodDescriptor
),
false
,
method_cls
=
new
BoxedHeapClass
(
object_cls
,
NULL
,
0
,
0
,
sizeof
(
BoxedMethodDescriptor
),
false
,
...
@@ -2100,7 +2100,7 @@ void setupRuntime() {
...
@@ -2100,7 +2100,7 @@ void setupRuntime() {
float_cls
->
tp_mro
=
BoxedTuple
::
create
({
float_cls
,
object_cls
});
float_cls
->
tp_mro
=
BoxedTuple
::
create
({
float_cls
,
object_cls
});
function_cls
->
tp_mro
=
BoxedTuple
::
create
({
function_cls
,
object_cls
});
function_cls
->
tp_mro
=
BoxedTuple
::
create
({
function_cls
,
object_cls
});
builtin_function_or_method_cls
->
tp_mro
=
BoxedTuple
::
create
({
builtin_function_or_method_cls
,
object_cls
});
builtin_function_or_method_cls
->
tp_mro
=
BoxedTuple
::
create
({
builtin_function_or_method_cls
,
object_cls
});
member_
cls
->
tp_mro
=
BoxedTuple
::
create
({
membe
r_cls
,
object_cls
});
member_
descriptor_cls
->
tp_mro
=
BoxedTuple
::
create
({
member_descripto
r_cls
,
object_cls
});
capifunc_cls
->
tp_mro
=
BoxedTuple
::
create
({
capifunc_cls
,
object_cls
});
capifunc_cls
->
tp_mro
=
BoxedTuple
::
create
({
capifunc_cls
,
object_cls
});
module_cls
->
tp_mro
=
BoxedTuple
::
create
({
module_cls
,
object_cls
});
module_cls
->
tp_mro
=
BoxedTuple
::
create
({
module_cls
,
object_cls
});
method_cls
->
tp_mro
=
BoxedTuple
::
create
({
method_cls
,
object_cls
});
method_cls
->
tp_mro
=
BoxedTuple
::
create
({
method_cls
,
object_cls
});
...
@@ -2155,7 +2155,7 @@ void setupRuntime() {
...
@@ -2155,7 +2155,7 @@ void setupRuntime() {
float_cls
->
finishInitialization
();
float_cls
->
finishInitialization
();
function_cls
->
finishInitialization
();
function_cls
->
finishInitialization
();
builtin_function_or_method_cls
->
finishInitialization
();
builtin_function_or_method_cls
->
finishInitialization
();
member_cls
->
finishInitialization
();
member_
descriptor_
cls
->
finishInitialization
();
module_cls
->
finishInitialization
();
module_cls
->
finishInitialization
();
capifunc_cls
->
finishInitialization
();
capifunc_cls
->
finishInitialization
();
method_cls
->
finishInitialization
();
method_cls
->
finishInitialization
();
...
...
src/runtime/types.h
View file @
ad8eddcf
...
@@ -85,9 +85,9 @@ extern "C" Box* getSysStdout();
...
@@ -85,9 +85,9 @@ extern "C" Box* getSysStdout();
extern
"C"
{
extern
"C"
{
extern
BoxedClass
*
object_cls
,
*
type_cls
,
*
bool_cls
,
*
int_cls
,
*
long_cls
,
*
float_cls
,
*
str_cls
,
*
function_cls
,
extern
BoxedClass
*
object_cls
,
*
type_cls
,
*
bool_cls
,
*
int_cls
,
*
long_cls
,
*
float_cls
,
*
str_cls
,
*
function_cls
,
*
none_cls
,
*
instancemethod_cls
,
*
list_cls
,
*
slice_cls
,
*
module_cls
,
*
dict_cls
,
*
tuple_cls
,
*
file_cls
,
*
none_cls
,
*
instancemethod_cls
,
*
list_cls
,
*
slice_cls
,
*
module_cls
,
*
dict_cls
,
*
tuple_cls
,
*
file_cls
,
*
enumerate_cls
,
*
xrange_cls
,
*
member_
cls
,
*
method_cls
,
*
closure_cls
,
*
generator_cls
,
*
complex_cls
,
*
basestring
_cls
,
*
enumerate_cls
,
*
xrange_cls
,
*
member_
descriptor_cls
,
*
method_cls
,
*
closure_cls
,
*
generator_cls
,
*
complex
_cls
,
*
property_cls
,
*
staticmethod_cls
,
*
classmethod_cls
,
*
attrwrapper_cls
,
*
pyston_getset_cls
,
*
capi
_getset_cls
,
*
basestring_cls
,
*
property_cls
,
*
staticmethod_cls
,
*
classmethod_cls
,
*
attrwrapper_cls
,
*
pyston
_getset_cls
,
*
builtin_function_or_method_cls
,
*
set_cls
,
*
frozenset_cls
,
*
code_cls
;
*
capi_getset_cls
,
*
builtin_function_or_method_cls
,
*
set_cls
,
*
frozenset_cls
,
*
code_cls
;
}
}
#define unicode_cls (&PyUnicode_Type)
#define unicode_cls (&PyUnicode_Type)
#define memoryview_cls (&PyMemoryView_Type)
#define memoryview_cls (&PyMemoryView_Type)
...
@@ -732,7 +732,7 @@ public:
...
@@ -732,7 +732,7 @@ public:
BoxedMemberDescriptor
(
PyMemberDef
*
member
)
BoxedMemberDescriptor
(
PyMemberDef
*
member
)
:
type
((
MemberType
)
member
->
type
),
offset
(
member
->
offset
),
readonly
(
member
->
flags
&
READONLY
)
{}
:
type
((
MemberType
)
member
->
type
),
offset
(
member
->
offset
),
readonly
(
member
->
flags
&
READONLY
)
{}
DEFAULT_CLASS_SIMPLE
(
member_cls
);
DEFAULT_CLASS_SIMPLE
(
member_
descriptor_
cls
);
};
};
class
BoxedGetsetDescriptor
:
public
Box
{
class
BoxedGetsetDescriptor
:
public
Box
{
...
...
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