bug fixed & more efficient callfv

I changed callfv's way of calling a function with arguments in vm_vec.
now callfv fetches arguments from val_stack directly,so it runs test/fib.nas from 2.4s to 1.9s.

delete operand callf,add operands callfv & callfh.

also,i check val_stack's top to make sure there is not a stack overflow.
This commit is contained in:
Valk Richard Li
2021-06-03 21:49:31 +08:00
parent a68bf85f04
commit 8e29a3ec5b
9 changed files with 164 additions and 135 deletions

View File

@@ -137,7 +137,7 @@ while(error>0.0005)
}
cnt+=1;
show+=1;
if(show==300)
if(show==350)
{
show=0;
print('epoch ',cnt,':',error,'\r');

View File

@@ -5,4 +5,5 @@ var fib=func(x)
return fib(x-1)+fib(x-2);
}
for(var i=0;i<31;i+=1)
print(fib(i),'\n');
print(fib(i),'\n');