optimize codes. details:

1. delete gc::builtin_alloc
2. add convenient way of getting new string object: gc::newstr, and shrink the size of codes
3. update doc
4. add gc::temp to be used in native/module functions to avoid being recognized as garbage incorrectly when triggered mark-sweep
This commit is contained in:
ValKmjolnir
2022-07-07 17:51:30 +08:00
parent 75c46fa727
commit fb25a4973c
7 changed files with 128 additions and 209 deletions

View File

@@ -109,11 +109,10 @@ void execute(const std::string& file,const std::vector<std::string>& argv,const
}
else if(cmd&VM_EXECTIME)
{
timeb begin,end;
ftime(&begin);
auto start=std::chrono::high_resolution_clock::now();
vm.run(gen,linker,argv,cmd&VM_OPCALLNUM,cmd&VM_DBGINFO);
ftime(&end);
std::cout<<"process exited after "<<((end.time-begin.time)*1.0+end.millitm/1000.0-begin.millitm/1000.0)<<"s.\n";
auto end=std::chrono::high_resolution_clock::now();
std::cout<<"process exited after "<<(end-start).count()*1.0/std::chrono::high_resolution_clock::duration::period::den<<"s.\n";
}
else if(cmd&VM_EXEC)
vm.run(gen,linker,argv,cmd&VM_OPCALLNUM,cmd&VM_DBGINFO);