mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-07-26 21:08:45 +08:00
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:
+3
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user