Difference between revisions of "XCSG:Variable"

From AtlasWiki
Jump to: navigation, search
(Specifications: switching to node and tag templates)
(Specifications: adding memoryBarrier tag for Java volatile variables)
Line 13: Line 13:
  
 
{{XCSGTag
 
{{XCSGTag
| name = Volatile
+
| name = volatile
 
| description = Present if the code indicates the variable requires special treatment because the variable's value can be changed externally, e.g. by hardware.
 
| description = Present if the code indicates the variable requires special treatment because the variable's value can be changed externally, e.g. by hardware.
 
}}
 
}}
  
 
{{XCSGTag
 
{{XCSGTag
| name = Immutable
+
| name = memoryBarrier
 +
| description = Indicates that reading from the variable creates a "happens before" relationship to any code (in any thread) that previously wrote to the variable.
 +
| references = [http://docs.oracle.com/javase/specs/jls/se5.0/html/classes.html#8.3.1.4 JLS, SE 5.0: volatile fields]
 +
}}
 +
 
 +
{{XCSGTag
 +
| name = immutable
 
| description = Present if the variable cannot be changed after initialization.
 
| description = Present if the variable cannot be changed after initialization.
 
}}
 
}}

Revision as of 13:40, 9 April 2014

The term variable is used by many authors to refer to any assignable entity. Unfortunately the same term is used by others to refer only to local variables. In XCIL, we use the terms Variable (for any assignable entity) and LocalVariable (for a variable defined by a method body).

The semantics of Variable are those common to all its subtypes, i.e. Attribute, AssociationEnd, ArrayElement, Parameter, and LocalVariable.

The meaning of volatile is that common to C++ and Java.


Specifications

Metaclass Variable
Extends AddressableEntity
Description An assignable entity that represents a portion of the system’s state, i.e. an attribute, an array element, an out or inout parameter, or a local variable.
Direct Subkinds CallInput, Field, ProgramVariable, StackVariable
All Superkinds Node, ModelElement
Specified In Edges
In Edge Predecessor Multiplicity Description
DataFlow (Edge) DataFlow (Node) Connects DataFlow nodes to one another and to Variables, linking the origin of data to locations that it is modified or consumed.
Specified Out Edges
Out Edge Successor Multiplicity Description
DataFlow (Edge) DataFlow (Node) Connects DataFlow nodes to one another and to Variables, linking the origin of data to locations that it is modified or consumed.
DefinedAs TypeAlias 0..1 Connects a Variable or DataFlow node which received its Type via a TypeAlias (such as a C/C++ typedef) to that TypeAlias.
InstanceVariableWritten InstanceVariableAssignment Connects a value (DataFlow (Node) or Variable) representing an object instance to an InstanceVariableAssignment representing a write to a field of that object.
TypeOf Type 1 Links a Variable or DataFlow node to its Type
Known Possible In Edges
In Edge Predecessor Multiplicity Description
HasVariable Namespace 1 Links a Classifier or Package to one of its Variables.
InterproceduralDataFlow Assignment Represents data flows between Functions, or involving Variables visible to multiple Functions.

Inherited From In Edge Predecessor Multiplicity Description
Node Contains Node 1 Indicates that the predecessor contains the successor in a sense specified by the specific type of Contains edge.
Known Possible Out Edges
Out Edge Successor Multiplicity Description
InterproceduralDataFlow DataFlow (Node) Represents data flows between Functions, or involving Variables visible to multiple Functions.

Inherited From Out Edge Successor Multiplicity Description
Node Contains Node Indicates that the predecessor contains the successor in a sense specified by the specific type of Contains edge.
Tag volatile
Description Present if the code indicates the variable requires special treatment because the variable's value can be changed externally, e.g. by hardware.
Tag memoryBarrier
Description Indicates that reading from the variable creates a "happens before" relationship to any code (in any thread) that previously wrote to the variable.
Tag immutable
Description Present if the variable cannot be changed after initialization.

Language mappings

Individual language mappings are provided for each subtype of Variable (Attribute, AssociationEnd, ArrayElement, Parameter, and LocalVariable).