Commit c4804fe4 authored by Kevin Modzelewski's avatar Kevin Modzelewski

member_descriptor_ics.py

parent c4a4b013
......@@ -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);
}
......
......@@ -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(1500);
o1->member_object_ex = PyInt_FromLong(1600);
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);
......
# expected: reffail
# run_args: -n
# statcheck: noninit_count('slowpath_member_descriptor_get') <= 1500
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment