Collection attributes are not flushed correctly when using concurrent-evaluation.

Issue #289 resolved
Alfred Åkesson
created an issue

When using the grammar

A::= B*; B;

with the collection attribute

coll ArrayList<B> A.bs();
B contributes this to A.bs();

the code gets an error

 A a = new A();
 a.addB(new B());
 testEqual(a.bs().size(),1); 
 a.flushTreeCache(); 
 a = a.treeCopy();
 a.flushTreeCache();
 a.addB(new B());
 testEqual(2,a.bs().size()); // a.bs().size() becomes 1

when compiled with concurrent-evaluation.

For test see: https://bitbucket.org/jastadd/jastadd-test/pull-requests/7/test-related-to-issue-289/diff

Comments (3)

  1. Jesper Öqvist

    When developing concurrent evaluation I did not implement flushing. I think I was planning to add that later, but forgot about it. Flushing should not be difficult to implement, though, so I'll see if I can add it quickly now.

    Flushing will only be safe if no other thread concurrently tries to evaluate an attribute.

  2. Jesper Öqvist

    Implement flushing for concurrent evaluation

    ASTNode.flushTreeCache() was not implemented when generating code for concurrent evaluation. This makes flushing work with concurrent evaluation. However, note that flushing is only safe if no other thread is concurrently evaluating attributes or trying to flush the cache.

    fixes #289 (bitbucket)

    → <<cset 7219bc7f39fd>>

  3. Log in to comment