On Mar 4, 2006, at 18:05, Nicolas Cannasse wrote:
-Cj does not produce different results than -j on the Win32 build of
Parrot. Is -Cj supported on this architecture ?
Yes, it should work. It might depend on, how fib is actually written in
PIR. As said this option is in a rather early state. Compiling a
subroutine to machine code is currently only done, if all Parrot
registers are fitting into CPU registers. The fib function below is
working here on x86/linux.
Mmm - actually -C needs computed goto, which isn't supported by all C
compilers. You can try:
$ ./parrot -Sj fib.pir 38
Fib(38): 63245986
Nicolas
leo
.sub main :main
.param pmc argv
.local int argc, n
argc = argv
n = 1
unless argc == 2 goto argsok
$S0 = argv[1]
n = $S0
argsok:
$P0 = getinterp
$P0.'recursion_limit'(100000)
.local pmc array
array = new .FixedFloatArray
array = 2
$I1 = FibInt(n)
array[0] = n
array[1] = $I1
$S0 = sprintf <<"END", array
Fib(%d): %d
END
print $S0
.end
.sub FibInt
.param int n
unless n < 2 goto endif
.return(1)
endif:
.local int tmp
tmp = n - 2
$I0 = FibInt(tmp)
tmp = n - 1
tmp = FibInt(tmp)
$I0 += tmp
.return($I0)
.end