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 b2e85de7a7
commit a3d629a08e
9 changed files with 164 additions and 135 deletions
+3 -2
View File
@@ -172,14 +172,15 @@ nasal_val* builtin_setsize(std::vector<nasal_val*>& local_scope,nasal_gc& gc)
nasal_val* builtin_system(std::vector<nasal_val*>& local_scope,nasal_gc& gc)
{
nasal_val* ret_addr=gc.gc_alloc(vm_num);
nasal_val* str_addr=local_scope[1];
if(str_addr->type!=vm_str)
{
builtin_err("system","\"str\" must be string");
return nullptr;
}
system(str_addr->ptr.str->data());
return gc.nil_addr;
ret_addr->ptr.num=(double)system(str_addr->ptr.str->data());
return ret_addr;
}
nasal_val* builtin_input(std::vector<nasal_val*>& local_scope,nasal_gc& gc)