Cache declarations in aspect

Issue #252 resolved
Jesper Öqvist created an issue

JastAdd 2.1.13

We want to add separate cache declarations for attributes inside aspects, like in the existing cache configuration files. For example:

aspect Y {
  syn T A.x();
  uncache A.x();
}
aspect Y {
  syn T A.x();
  cache A.x(); // Equivalent to syn lazy T A.x();
}

This would allow to declare some attributes to never be cached, even when using --cache=all.

With this change there is no need for separate cache configuration files. The cache analyzer tool should output aspect files instead of cache configuration files.

Cache configuration precedence

If an attribute is declared as lazy, but later a cache declaration declares it as uncache, then the cache declaration should take precedence. Multiple conflicting cache declarations for the same attribute should give an error message.

Cache configuration refinement

Cache declarations could have refined syntax in a later version of JastAdd, but this is not something we want to add right now so a separate issue should be created regarding that if it turns out to be needed.

Gobal caching configuration

The --cache=config option enabled loading of cache configuration files. The cache configuration files are redundant with the inclusion of cache declarations in aspects, so that option can be removed.

The --cache=implicit option worked by enabling caching for all attributes, and then loading the cache configuration and overwriting the cache mode for each attribute by the configured caching behavior. This is also obsolete because --cache=all does the same thing when cache declarations are in aspects instead of separate files.

Comments (9)

  1. Jesper Mattsson

    Would it then be allowed to have the cashe/uncashe specification in another aspect? Or perhaps even refine/change it in another aspect?

    aspect X {
      syn T A.x();
    }
    aspect Y {
      cache A.x();
    }
    aspect Z {
      refine Y uncashe A.x();
    }
    
  2. Jesper Öqvist reporter

    If an attribute is declared lazy the cache declaration should take precedence, but what should happen when we have conflicting cache declarations?

  3. Jesper Öqvist reporter

    @jespermattsson Yes, the cache declarations should be able to exist in separate aspects from the attributes they annotate.

  4. Jesper Mattsson

    With conflicting declarations, I'd say you have to give an error - there is no way to resolve the conflict. To be able to change it in an extending aspect once it has been set, I guess there would have to be something like the refine syntax for it.

  5. Jesper Öqvist reporter
    • edited description

    Update description to reflect the points in the comments about conflicting cache declarations and cache declaration refining.

  6. Jesper Öqvist reporter

    The words cache and uncache are already keywords in the aspect file parser (Jrag.jjt), for example:

    unexpected token "cache":
       syn int A.cache() = 3;
                 ^^^^^
    

    This means that we don't need to add new keywords to implement this feature.

  7. Jesper Öqvist reporter
    • edited description

    Updated issue description with a plan for the --cache=config and --cache=implicit options.

  8. Jesper Öqvist reporter

    Cache declarations in aspects

    Added support for cache declarations in aspects. This makes separate cache configuration files obsolete, so the support for cache configuration files has been removed. The --cache=implicit and --cache=config options were also removed. The --cache=analyze option now generates a cache analyzer that can generate a cache configuration aspect.

    fixes #252 (bitbucket)

    → <<cset 9430332bc3a5>>

  9. Log in to comment