Commit d08ae559 authored by gsamain's avatar gsamain

Make cypclass use temporaries

parent 6f6e64f5
...@@ -5761,6 +5761,10 @@ class SimpleCallNode(CallNode): ...@@ -5761,6 +5761,10 @@ class SimpleCallNode(CallNode):
if i > 0: # first argument doesn't matter if i > 0: # first argument doesn't matter
some_args_in_temps = True some_args_in_temps = True
arg = arg.coerce_to_temp(env) arg = arg.coerce_to_temp(env)
elif arg.type.is_cyp_class:
if i > 0:
some_args_in_temps = True
arg = arg.coerce_to_temp(env)
args[i] = arg args[i] = arg
# handle additional varargs parameters # handle additional varargs parameters
...@@ -5828,6 +5832,8 @@ class SimpleCallNode(CallNode): ...@@ -5828,6 +5832,8 @@ class SimpleCallNode(CallNode):
elif self.type.is_memoryviewslice: elif self.type.is_memoryviewslice:
self.is_temp = 1 self.is_temp = 1
# func_type.exception_check = True # func_type.exception_check = True
elif self.type.is_cyp_class:
self.is_temp = 1
if self.is_temp and self.type.is_reference: if self.is_temp and self.type.is_reference:
self.type = PyrexTypes.CFakeReferenceType(self.type.ref_base_type) self.type = PyrexTypes.CFakeReferenceType(self.type.ref_base_type)
...@@ -6278,6 +6284,10 @@ class InlinedDefNodeCallNode(CallNode): ...@@ -6278,6 +6284,10 @@ class InlinedDefNodeCallNode(CallNode):
if i > 0: # first argument doesn't matter if i > 0: # first argument doesn't matter
some_args_in_temps = True some_args_in_temps = True
arg = arg.coerce_to_temp(env) arg = arg.coerce_to_temp(env)
elif arg.type.is_cyp_class:
if i > 0: # first argument doesn't matter
some_args_in_temps = True
arg = arg.coerce_to_temp(env)
self.args[i] = arg self.args[i] = arg
if some_args_in_temps: if some_args_in_temps:
......
...@@ -5432,7 +5432,7 @@ class SingleAssignmentNode(AssignmentNode): ...@@ -5432,7 +5432,7 @@ class SingleAssignmentNode(AssignmentNode):
if use_temp or rhs.is_attribute or ( if use_temp or rhs.is_attribute or (
not rhs.is_name and not rhs.is_literal and not rhs.is_name and not rhs.is_literal and
rhs.type.is_pyobject): (rhs.type.is_pyobject or rhs.type.is_cyp_class)):
# things like (cdef) attribute access are not safe (traverses pointers) # things like (cdef) attribute access are not safe (traverses pointers)
rhs = rhs.coerce_to_temp(env) rhs = rhs.coerce_to_temp(env)
elif rhs.type.is_pyobject: elif rhs.type.is_pyobject:
...@@ -5640,7 +5640,7 @@ class CascadedAssignmentNode(AssignmentNode): ...@@ -5640,7 +5640,7 @@ class CascadedAssignmentNode(AssignmentNode):
rhs = rhs.coerce_to(lhs_types.pop(), env) rhs = rhs.coerce_to(lhs_types.pop(), env)
if not rhs.is_name and not rhs.is_literal and ( if not rhs.is_name and not rhs.is_literal and (
use_temp or rhs.is_attribute or rhs.type.is_pyobject): use_temp or rhs.is_attribute or rhs.type.is_pyobject or rhs.type.is_cyp_class):
rhs = rhs.coerce_to_temp(env) rhs = rhs.coerce_to_temp(env)
else: else:
rhs = rhs.coerce_to_simple(env) rhs = rhs.coerce_to_simple(env)
......
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