Skip to content

Commit 7efe0c6

Browse files
author
EnzeXing
committed
Adding documentation for abstract syntax
1 parent d86190f commit 7efe0c6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

compiler/src/dotty/tools/dotc/transform/init/Objects.scala

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,33 @@ object Objects:
6666

6767
// ----------------------------- abstract domain -----------------------------
6868

69+
/** Syntax for the data structure abstraction used in abstract domain:
70+
*
71+
* ve ::= ObjectRef(class)
72+
* | OfClass(class, vs[outer], ctor, args, env)
73+
* | OfArray(object[owner], regions)
74+
* | Fun(..., env)
75+
* | Cold // abstract values in domain
76+
* vs ::= Set(ve) // set of abstract values
77+
*
78+
* refMap = ( ObjectRef | OfClass ) -> ( valsMap, varsMap, outersMap ) // refMap stores field informations of an object or instance
79+
* valsMap = valsym -> vs // maps immutable fields to their values
80+
* varsMap = valsym -> addr // each mutable field has an abstract address
81+
* outersMap = class -> vs // maps outer objects to their values
82+
*
83+
* arrayMap = OfArray -> addr // an array has one address that stores the join value of every element
84+
*
85+
* heap = addr -> vs // only this map's entries can be modified
86+
*
87+
* env = (valsMap, Option[env]) // stores local variables in the residing method, and possibly outer environments
88+
*
89+
* addr ::= localVarAddr(regions, valsym, owner)
90+
* | fieldVarAddr(regions, valsym, owner) // independent of OfClass/ObjectRef
91+
* | arrayAddr(regions, owner) // independent of array element type
92+
*
93+
* regions ::= List(sourcePosition)
94+
*/
95+
6996
sealed abstract class Value:
7097
def show(using Context): String
7198

0 commit comments

Comments
 (0)