вторник, 21 сентября 2010 г.

Code generation for YAR polymorphic methods

Added for .NET backend.

All process consists of :

YAR => semantic tree => call codegen(Semantic tree, .NET backend) => IL ASM

Here is a sample:

YAR
function abc < T,U,Z > (a:integer;b:U):Z;
c,d:T;
e:Z;
f:U;
begin
c:=d;
f:=b;
result:=e;
end;

=>

IL ASM

.method static public !!Z abc < T,U,Z > (int32 a,!!U b) cil managed
{
.locals init(!!U f,!!Z e,!!T c,!!T d)
ldloc d
stloc c
ldarg b
stloc f
ldloc e
ret
}

Комментариев нет: