Re: [Jastadd] [Q] When is a lazy attribute not cached?

From: Görel Hedin <gorel_at_cs.lth.se>
Date: Tue, 17 Apr 2012 07:38:17 +0200

Hi Hyunik,

A lazy attribute is not cached when it depends on an AST node that is in the process of being rewritten. If the attribute is accessed at a later time, when the AST nodes it depends on are all in their final rewritten state, the attribute will be cached. For more details see our ECOOP 2004 paper: Rewritable Reference Attributed Grammars.

Cheers,
Görel
 
17 apr 2012 kl. 05.07 skrev Na, Hyunik:

> Hello JastAdd developers,
>
> It seems that a lazy attribute is not always cached.
>
> For example, I found that the MethodAccess.decls() attribute (which is declared lazy) is not cached, but calculated many times
> in a case when it leads to the type checking process that I added to JastAddJ.
>
> Perhaps, the answer is in the following line appearing in the decls() method of MethodAccess.java which JastAdd generates.
>
> if(isFinal && num == state().boundariesCrossed) decls_computed = true;
>
> It seems that the ‘decls_computed’ field decides whether to use the cached value or not,
> and it is set only when the condition, “isFinal && num == state().boundariesCrossed”, is satisfied.
> And, it seems that my type checking process makes that condition unsatisfied.
>
> What does the condition mean?
> And, how can I cache all my lazy attributes?
>
> Thank you.
>
> - Hyunik.
> _______________________________________________
> JastAdd mailing list
> JastAdd_at_cs.lth.se
> https://mail1.cs.lth.se/cgi-bin/mailman/listinfo/jastadd
Received on Tue Apr 17 2012 - 07:38:19 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 16 2014 - 17:19:06 CEST