User Tools

Site Tools


lara:docs:specs3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
lara:docs:specs3 [2016/07/30 16:48]
joaobispo created
lara:docs:specs3 [2019/09/22 15:47] (current)
Line 14: Line 14:
 ===== Joinpoint Actions ===== ===== Joinpoint Actions =====
  
-(recommended syntax: $jp.exec <​action_name>​. Could it be $jp.action <​action_name>​ instead?)+Previous syntax:  
 + 
 +<code lara> 
 +   ​$jp.exec result : <​action_name>;​ 
 +</​code>​ 
 + 
 + 
 +New syntax:  
 + 
 +<code lara> 
 +   var result = $jp.exec <​action_name>;​ 
 +</​code>​ 
 + 
 +If '​result'​ is a variable that already exists, '​var'​ can be omitted: 
 + 
 + 
 +<code lara> 
 +   ​result = $jp.exec <​action_name>;​ 
 +</​code>​ 
 + 
 +The keyword '​.exec'​ can be omitted if you prefix the name of the action with the target join point, and add parenthesis:​ 
 + 
 +<code lara> 
 +  result = $jp.<​action_name>​();​ 
 +</​code>​ 
 + 
 +/* (recommended syntax: $jp.exec <​action_name>​. Could it be $jp.action <​action_name>​ instead?​) ​*/
  
 ==== Default Actions ==== ==== Default Actions ====
Line 22: Line 48:
 === Action Insert === === Action Insert ===
  
-(only supports before/​after,​ around/​replace removedgranularity is statement level)+  * only supports before/​after,​ around/​replace removed ​ 
 +  * granularity is statement level 
 +  * Consider supporting joinpoints as input, instead of only literal text
  
 === Action Replace === === Action Replace ===
Line 30: Line 58:
 ===== Aspect Calls ===== ===== Aspect Calls =====
  
-(recommended ​syntax: var new Aspect(); call a;)+Previous syntax:  
 + 
 +<code lara> 
 +   call result : AnAspect(); 
 +</​code>​ 
 + 
 + 
 +New syntax: ​ 
 + 
 +<code lara> 
 +   var result ​call AnAspect(); 
 +</​code>​ 
  
 ===== Tools ('​run'​) ===== ===== Tools ('​run'​) =====
Line 58: Line 98:
  
 E.g., select body.loop end will recursively return all the loops inside the body, there is no simple way to select only the loops that are directly under the body (excluding nested loops). E.g., select body.loop end will recursively return all the loops inside the body, there is no simple way to select only the loops that are directly under the body (excluding nested loops).
 +
 +
 +=== *Tentative solution* ===
 +
 +Add joinpoints specifically for direct children selection. '​select function.stmt'​ selects all statements, '​select function.childStmt'​ selects only the direct children of the function.
 +
 +
 +/*
  
 ==== Insert Order ==== ==== Insert Order ====
Line 72: Line 120:
 Should it appear like this: Should it appear like this:
  
-'​before_2'​ +  ​'​before_2'​ 
-'​before_1'​ +  '​before_1'​ 
-+  
-'​after_1'​ +  '​after_1'​ 
-'​after_2'​+  '​after_2'​
  
 Or like this? Or like this?
  
-'​before_1'​ +  ​'​before_1'​ 
-'​before_2'​ +  '​before_2'​ 
-+  
-'​after_2'​ +  '​after_2'​ 
-'​after_1'​+  '​after_1'​ 
 +   
 +=== *Tentative Solution* === 
 + 
 +Always insert the closest possible to the node. For the previous example, this means that the insertion order would be like: 
 + 
 + 
 +  '​before_1'​ 
 +  '​before_2'​ 
 +  a 
 +  '​after_2'​ 
 +  '​after_1'​ 
 +   
 +*/   
 +   
 +/* 
 + 
 +==== String Literals ==== 
 + 
 + 
 + 
 +Currently, the preferred way to do String literals in LARA is to use quotes: 
 + 
 +'a string in LARA'​ 
 + 
 +LARA also supports double quotes, but they are internally translated to single quotes, so there can be problems when using quote literals: 
 + 
 +"a string with a quote ' " -> 'a string with a quote ' ' 
 + 
 +We can 1) normalize on the LARAC side and escape the quote or 2) identify the type of String (' or ") and generate code accordingly 
 + 
 +*/ 
 + 
 +==== '​exit'​ Joinpoint in '​scope'/'​body'​ ==== 
 + 
 +Should the joinpoint '​scope'​ be able to select its '​exit'​ points? This joinpoint would represent all the static exits that can be detected in the code (e.g., end of scope, return statements, throw statements). 
 + 
 +Possible problems: 
 +  * When a scope does not explicitly return (equivalent to the $body.insert when $body is empty); 
 +  * We cannot detect dynamic exits such as exceptions (is this relevant?​) 
 +  * When a return statement has computation (e.g., return a+2), the $exit.insert before does not have this computation into account (possible solution, LARA action that extracts computation from returns to a variable, e.g., lara_temp_1 = a + 2; return lara_temp_1;​) 
 + 
 + 
 +==== Insert Begin/End in '​scope'/'​body'​ ==== 
 + 
 +Joinpoint '​scope'​ is being used in Clava as the base joinpoint for the '​body'​ joinpoint. While $body.insert before/​after conceptually inserts before/​after the first/last statement of the body, when it is a '​scope'​ we want to be able to insert before/​after it. 
 + 
 + 
 +=== *Tentative Solution* === 
 + 
 +$scope.insert before/​after inserts before/​after the scope, as expected. Add two new actions, insertBegin and insertEnd, that behaves like $body.insert before/​after.  
 + 
 +If '​body'​ is also used as an alias of '​scope',​ for compatibility reasons, $body.insert before/​after must continue to be supported. '​scope'​ can detect if it is being used as a '​body',​ and in case of insert before/​after,​ issue a warning telling that insertBegin/​End should be used instead. 
lara/docs/specs3.1469890130.txt.gz · Last modified: 2019/09/22 15:46 (external edit)