📝 fix some wanings.

This commit is contained in:
ValKmjolnir 2022-07-11 23:53:23 +08:00
parent 8cc69c709f
commit d1a7d32e7b
4 changed files with 11 additions and 14 deletions

View File

@ -1367,7 +1367,9 @@ nasal_ref builtin_corun(nasal_ref* local,nasal_gc& gc)
}
nasal_ref builtin_millisec(nasal_ref* local,nasal_gc& gc)
{
double res=std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
double res=std::chrono::duration_cast<std::chrono::milliseconds>
(std::chrono::high_resolution_clock::now().time_since_epoch())
.count();
return {vm_num,res};
}
nasal_ref builtin_sysargv(nasal_ref* local,nasal_gc& gc)

View File

@ -20,7 +20,7 @@ private:
void interact();
public:
nasal_dbg():
next_step(false),
next_step(false),fsize(0),
bk_fidx(0),bk_line(0){}
void run(
const nasal_codegen&,

View File

@ -477,15 +477,8 @@ struct nasal_gc
nasal_ref*& _canary,
nasal_ref*& _top,
nasal_ref* _stk):
pc(_pc),
localr(_localr),
memr(_memr),
funcr(_funcr),
upvalr(_upvalr),
canary(_canary),
top(_top),
stack(_stk),
temp(nil){}
pc(_pc),localr(_localr),memr(_memr),funcr(_funcr),upvalr(_upvalr),
canary(_canary),top(_top),stack(_stk),coroutine(nullptr),temp(nil){}
void mark();
void sweep();
void init(const std::vector<std::string>&,const std::vector<std::string>&);

View File

@ -125,7 +125,8 @@ public:
nasal_vm():pc(0),localr(nullptr),memr(nullptr),funcr(nil),
upvalr(nil),canary(nullptr),top(stack),
num_table(nullptr),str_table(nullptr),
gc(pc,localr,memr,funcr,upvalr,canary,top,stack){}
gc(pc,localr,memr,funcr,upvalr,canary,top,stack),
files(nullptr),bytecode(nullptr),detail_info(false){}
void run(
const nasal_codegen&,
const nasal_import&,
@ -785,11 +786,12 @@ inline void nasal_vm::opr_callfh()
}
inline void nasal_vm::opr_callb()
{
// reserve place for builtin function return, in fact this code is changed because of coroutine
// reserve place for builtin function return,
// in fact this code is changed because of coroutine
(++top)[0]=nil;
// this ++top should not be used like: (++top)[0] here
// because if running a builtin function about coroutine
// this (top) will be set to another context.top, instead of main_context.top
// (top) will be set to another context.top, instead of main_context.top
top[0]=(*builtin[imm[pc]].func)(localr,gc);
if(top[0].type==vm_none)
die("native function error.");