да небедет таких проблем...
твой код
function fa(i: integer): integer;
begin
while i<1000 do begin
i := fa(i) + 1;
end;
fa:=i;
end;
----
будет преобразован в промежуточный java код
----
public static int fa(int i)
{
int varK1 = 0;
for(; (byte)(i < 1000 ? -1 : 0) != 0; i = fa(i) + 1);
varK1 = i;
return j;
}
и никакой генерации этого кода в 1000 повторениях....
затем он преобразуется в код JavaAsm для окончательной компиляции
---
.method public static fa(I)I
.limit stack 2
.limit locals 2
.var 0 is i I from LABEL0x0 to LABEL0x20
.var 1 is varK1 I from LABEL0x2 to LABEL0x20
.line 15
LABEL0x0:
iconst_0
istore_1
.line 16
LABEL0x2:
iload_0
sipush 1000
if_icmplt LABEL0xd
iconst_0
goto LABEL0xe
LABEL0xd:
iconst_m1
LABEL0xe:
i2b
ifeq LABEL0x1c
iload_0
invokestatic proj1/fa(I)I
iconst_1
iadd
istore_0
goto LABEL0x2
.line 17
LABEL0x1c:
iload_0
istore_1
.line 18
iload_1
ireturn
LABEL0x20:
.end method