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
c4804fe4
Commit
c4804fe4
authored
Apr 15, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
member_descriptor_ics.py
parent
c4a4b013
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+10
-6
test/test_extension/descr_test.c
test/test_extension/descr_test.c
+5
-9
test/tests/member_descriptor_ics.py
test/tests/member_descriptor_ics.py
+0
-1
No files found.
src/runtime/objmodel.cpp
View file @
c4804fe4
...
...
@@ -2065,7 +2065,8 @@ Box* dataDescriptorInstanceSpecialCases(GetattrRewriteArgs* rewrite_args, BoxedS
RewriterVar
::
SmallVector
normal_args
;
RewriterVar
::
SmallVector
float_args
;
float_args
.
push_back
(
r_unboxed_val
);
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
boxFloat
,
normal_args
,
float_args
);
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
boxFloat
,
normal_args
,
float_args
)
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
setReturn
(
r_rtn
,
ReturnConvention
::
HAS_RETURN
);
}
...
...
@@ -2102,7 +2103,8 @@ Box* dataDescriptorInstanceSpecialCases(GetattrRewriteArgs* rewrite_args, BoxedS
case
BoxedMemberDescriptor
:
:
STRING
:
{
if
(
rewrite_args
)
{
RewriterVar
*
r_interm
=
rewrite_args
->
obj
->
getAttr
(
member_desc
->
offset
,
rewrite_args
->
destination
);
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
boxStringOrNone
,
r_interm
);
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
boxStringOrNone
,
r_interm
)
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
setReturn
(
r_rtn
,
ReturnConvention
::
HAS_RETURN
);
}
...
...
@@ -2111,9 +2113,11 @@ Box* dataDescriptorInstanceSpecialCases(GetattrRewriteArgs* rewrite_args, BoxedS
}
case
BoxedMemberDescriptor
:
:
STRING_INPLACE
:
{
if
(
rewrite_args
)
{
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
boxStringFromCharPtr
,
rewrite_args
->
rewriter
->
add
(
rewrite_args
->
obj
,
member_desc
->
offset
,
rewrite_args
->
destination
));
RewriterVar
*
r_rtn
=
rewrite_args
->
rewriter
->
call
(
true
,
(
void
*
)
boxStringFromCharPtr
,
rewrite_args
->
rewriter
->
add
(
rewrite_args
->
obj
,
member_desc
->
offset
,
rewrite_args
->
destination
))
->
setType
(
RefType
::
OWNED
);
rewrite_args
->
setReturn
(
r_rtn
,
ReturnConvention
::
HAS_RETURN
);
}
...
...
@@ -2819,7 +2823,7 @@ template <ExceptionStyle S> Box* _getattrEntry(Box* obj, BoxedString* attr, void
if
(
unlikely
(
rewriter
.
get
()
&&
rewriter
->
aggressiveness
()
<
5
))
{
RewriterVar
*
r_rtn
=
rewriter
->
call
(
true
,
(
void
*
)
_getattrEntry
<
S
>
,
rewriter
->
getArg
(
0
),
rewriter
->
getArg
(
1
),
rewriter
->
loadConst
(
0
,
Location
::
forArg
(
2
)));
rewriter
->
loadConst
(
0
,
Location
::
forArg
(
2
)))
->
setType
(
RefType
::
OWNED
)
;
rewriter
->
commitReturning
(
r_rtn
);
rewriter
.
reset
(
NULL
);
}
...
...
test/test_extension/descr_test.c
View file @
c4804fe4
...
...
@@ -57,7 +57,7 @@ static struct PyMemberDef descr_memberlist[] = {
static
void
descr_tester_dealloc
(
descr_tester_object
*
mc
)
{
printf
(
"dealloc"
);
printf
(
"dealloc
\n
"
);
if
(
mc
->
member_object
)
Py_DECREF
(
mc
->
member_object
);
...
...
@@ -66,7 +66,7 @@ descr_tester_dealloc(descr_tester_object *mc)
PyObject_GC_UnTrack
(
mc
);
PyObject_GC_Del
(
mc
);
printf
(
"done dealloc"
);
printf
(
"done dealloc
\n
"
);
}
PyDoc_STRVAR
(
descr_tester_doc
,
"descr_tester doc"
);
...
...
@@ -154,7 +154,7 @@ initdescr_test(void)
return
;
Py_INCREF
(
&
descr_tester
);
descr_tester_object
*
o1
=
PyObject_New
(
descr_tester_object
,
&
descr_tester
);
descr_tester_object
*
o1
=
PyObject_
GC_
New
(
descr_tester_object
,
&
descr_tester
);
if
(
o1
==
NULL
)
return
;
o1
->
member_short
=
SHRT_MAX
;
...
...
@@ -171,14 +171,11 @@ initdescr_test(void)
o1
->
member_uint
=
UINT_MAX
;
o1
->
member_ulong
=
ULONG_MAX
;
o1
->
member_bool
=
1
;
o1
->
member_object
=
PyInt_FromLong
(
15
);
o1
->
member_object_ex
=
PyInt_FromLong
(
16
);
o1
->
member_object
=
PyInt_FromLong
(
15
00
);
o1
->
member_object_ex
=
PyInt_FromLong
(
16
00
);
o1
->
member_long_long
=
LLONG_MAX
;
o1
->
member_ulong_long
=
ULLONG_MAX
;
o1
->
member_pyssizet
=
(
Py_ssize_t
)((
1ULL
<<
(
8
*
sizeof
(
Py_ssize_t
)
-
1
))
-
1
);
// max Py_ssize_t
Py_INCREF
(
o1
);
Py_INCREF
(
o1
->
member_object
);
Py_INCREF
(
o1
->
member_object_ex
);
descr_tester_object
*
o2
=
PyObject_GC_New
(
descr_tester_object
,
&
descr_tester
);
...
...
@@ -204,7 +201,6 @@ initdescr_test(void)
o2
->
member_ulong_long
=
0
;
o2
->
member_pyssizet
=
o1
->
member_pyssizet
+
1
;
// min Py_ssize_t
Py_INCREF
(
o2
);
PyObject
*
m
;
m
=
Py_InitModule
(
"descr_test"
,
DescrTestMethods
);
...
...
test/tests/member_descriptor_ics.py
View file @
c4804fe4
# expected: reffail
# run_args: -n
# statcheck: noninit_count('slowpath_member_descriptor_get') <= 1500
...
...
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