Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain joinpoint locations on Clava.rebuild() #41

Open
lm-sousa opened this issue Sep 24, 2021 · 3 comments
Open

Retain joinpoint locations on Clava.rebuild() #41

lm-sousa opened this issue Sep 24, 2021 · 3 comments

Comments

@lm-sousa
Copy link
Member

Wrap up of the discussion:

  • Maintain a record of all joinpoint objects currently in existence (vars in a LARA/JS script).
  • When doing a rebuild, target each joinpoint on record with a distinctive pragma.
  • Pass the annotated code through Clang.
  • Map the new joinpoints to the existing variables.
  • Remove the pragmas annotations.
  • Return to user space.

Problems:

  1. Non-code joinpoints (file, type, etc.) can't be annotated with pragmas.
@lm-sousa
Copy link
Member Author

Type variables could be kept track of by using another variable.
Types are shared between C variables.
We could find the first var in the AST with the type we need and tag it with a pragma just as we for jp vars.

The same can be done for files.
Find the first jp where we can add a data pragma and tag it. (var X with ID Y stores the fileJp of this jp)

@lm-sousa
Copy link
Member Author

lm-sousa commented Oct 22, 2021

It might be faster to search all other existing joinpoint js variables before analysing the AST directly.
Most likely a file or type joinpoint was found through another jp.

@joaobispo
Copy link
Member

joaobispo commented Dec 10, 2021

Join points are wrappers around AST nodes that provide a common interface and allow different languages with different ASTs to be handled in a similar way.

Taking this into consideration, join points are treated as shorted-lived objects, every time we access an AST node, a new join point is potentially created. Persistence should be viewed at the level of the AST, hence the current decision to store data objects as pragmas, whenever a node supports a pragma.

All data objects are mapped to AST node ids, not join points. When a join point accesses a data object, it uses a map of data objects for the current context. Pushing and popping ASTs from the AST stack do not change the context of data objects, so if a node maintains its id, it is possible to communicate information between pushes and pops.

Since node ids do not persist between rebuilds, we only persist data objects of nodes that can be directly annotated with pragmas.

In short: all data objects are mapped by node id (i.e. $jp.astId), and persist across Clava.pushAst()/popAst(). Only nodes that support pragma annotations (e.g. $statement, $function) persist data objects across Clava.rebuild().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants