You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With recent changes to the compiler, we've lost the ability to create easy name mangles based on a byte representation of the Automata. Instead, we now face the somewhat easier task of generating name mangles from a type tree! As an example, consider these two cases:
type Point is {int x, int y}
function f(null|Point p):
...
function f(null|{int x, int y} p):
...
These functions are overloading each other and, hence, we need a mangling mechanism which distinguishes them. A simple strategy (based on the approach used for type signatures in JVM bytecode) might be:
Primitives. Let null, bool, byte, int, be represented by N, B, Y, I respectively.
Arrays. Let a type of the form T[] be represented as [f(T) (where f(T) is the representation of T)
Unions, Intersections and Negations. These should be represented directly using the obvious (infix) letters |, & and !.
Records. These should be represented simply enclosed in { and } with, for each field, the type first and then the name.
References. These should be represented by the infix operator *.
Nominals. These should be represented as L ... ; (I suppose this is homage to Java bytecode)
Following this alphabet, we would have the following signatures for the two methods given above:
null|Point is represented as n|LPoint;
null|{int x, int y} is represnted as n|{ILx;ILy;}
I guess an important question is: do we want to retain some level of human readability?
Another important issue is to ensure that types are in canonical form. More specifically, we need to generate the same mangles for the following two functions:
function f(int|null x):
...
function f(null|int x):
...
This ensures some (though not total) resistance against issues of binary compatibility.
The text was updated successfully, but these errors were encountered:
This is a temporary fix for addressing the issue of name mangling.
Specifically, it implements name mangling by reusing the existing
BinaryTypeWriter. That class is, however, scheduled to be replaced ...
so this is only deferring the final solution.
With recent changes to the compiler, we've lost the ability to create easy name mangles based on a byte representation of the
Automata
. Instead, we now face the somewhat easier task of generating name mangles from a type tree! As an example, consider these two cases:These functions are overloading each other and, hence, we need a mangling mechanism which distinguishes them. A simple strategy (based on the approach used for type signatures in JVM bytecode) might be:
null
,bool
,byte
,int
, be represented byN
,B
,Y
,I
respectively.T[]
be represented as[f(T)
(wheref(T)
is the representation ofT
)|
,&
and!
.{
and}
with, for each field, the type first and then the name.*
.L ... ;
(I suppose this is homage to Java bytecode)Following this alphabet, we would have the following signatures for the two methods given above:
null|Point
is represented asn|LPoint;
null|{int x, int y}
is represnted asn|{ILx;ILy;}
I guess an important question is: do we want to retain some level of human readability?
Another important issue is to ensure that types are in canonical form. More specifically, we need to generate the same mangles for the following two functions:
This ensures some (though not total) resistance against issues of binary compatibility.
The text was updated successfully, but these errors were encountered: