Open jiyuuchc opened 1 year ago
Looking a bit further. It seems the bug is actually in Treeo.
The problem is Treeo try to auto-annotate, which create instance-level field_metadata, which are all different for different instances. This causes problems in JIT because passing new instances to a function triggers unnecessary recompiling of the function.
I see two ways to solve the problem:
(1) Do not perform auto-annotation after init call. Instead the user should explicit invoke auto-annotation, with the understanding that the call alters tree_structure
or
(2) Manually annotation all tx classes to ensure a class-level metadata already exist for fields created in init
After some more testing, I found that adding a eq() method to class treeo.types.FieldMetadata solves all the issues.
This seems to be the cleanest solution.
Hey @jiyuuchc!
Not actively maintaining Treex/Treeo but happy to approve a PR + create a new release if you want to send it.
Bug:
Instances of the same tx.Module have different tree_structure
Patch is simple: