Commit 4a45a634 authored by gsamain's avatar gsamain

Make cypclass use temporaries

parent c0c7651a
...@@ -5770,6 +5770,10 @@ class SimpleCallNode(CallNode): ...@@ -5770,6 +5770,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
...@@ -5837,6 +5841,8 @@ class SimpleCallNode(CallNode): ...@@ -5837,6 +5841,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)
...@@ -6204,6 +6210,10 @@ class InlinedDefNodeCallNode(CallNode): ...@@ -6204,6 +6210,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:
......
...@@ -5491,7 +5491,7 @@ class SingleAssignmentNode(AssignmentNode): ...@@ -5491,7 +5491,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:
...@@ -5699,7 +5699,7 @@ class CascadedAssignmentNode(AssignmentNode): ...@@ -5699,7 +5699,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