Ticket #146 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

FlattenInListTransform is disabled

Reported by: dagss Owned by: scoder
Priority: critical Milestone: 0.11
Component: Code Generation Keywords:
Cc:

Description

PersistentNode doesn't play nice with the new temps. It is only used in FlattenInListTransform, which I've disabled.

My advice would be to rewrite FlattenInListTransform to make use of TempsBlockNode instead, and simply delete PersistentNode (creative though as it was).

Change History

Changed 4 years ago by robertwb

Yes, PersistentNode was introduced because CloneNode wasn't sophisticated enough. TempsBlockNode is certainly a better option (not sure when I'll get around to fixing this though, but sometimes).

Changed 4 years ago by scoder

I re-enabled it for the trivial case of a simple lhs of the comparison, in which case a CloneNode does the right thing.

Fixing it for the cases that require a temp cannot be done with a TempsBlockNode as it's not an ExprNode. Plus, the transform runs before type analysis, so that TempHandle(type) doesn't work. A lazy TempHandle that uses a delegating property for its .type attribute might work here.

Changed 4 years ago by scoder

It's not as easy as I thought. Enabling it and using a normal CloneNode will crash for temporary Python values on the lhs as they will be decrefed right after the first comparison. Instead, the temp must be deallocated after finishing the entire 'or' cascade (and not inside the last operand of the rhs either!). This cannot easily be done with the current tree nodes.

Changed 4 years ago by scoder

  • owner changed from somebody to scoder

Changed 4 years ago by scoder

  • owner changed from scoder to somebody

I tried moving the transform after the type analysis phase. That won't work as the list/tuple will force everything into Python types, so that we loose the information what the original C type was that could be compared directly. So the transform must run at a relatively early stage.

Changed 4 years ago by scoder

  • owner changed from somebody to scoder
  • status changed from new to assigned

Changed 4 years ago by scoder

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.