📝 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) 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}; return {vm_num,res};
} }
nasal_ref builtin_sysargv(nasal_ref* local,nasal_gc& gc) nasal_ref builtin_sysargv(nasal_ref* local,nasal_gc& gc)

View File

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

View File

@ -477,15 +477,8 @@ struct nasal_gc
nasal_ref*& _canary, nasal_ref*& _canary,
nasal_ref*& _top, nasal_ref*& _top,
nasal_ref* _stk): nasal_ref* _stk):
pc(_pc), pc(_pc),localr(_localr),memr(_memr),funcr(_funcr),upvalr(_upvalr),
localr(_localr), canary(_canary),top(_top),stack(_stk),coroutine(nullptr),temp(nil){}
memr(_memr),
funcr(_funcr),
upvalr(_upvalr),
canary(_canary),
top(_top),
stack(_stk),
temp(nil){}
void mark(); void mark();
void sweep(); void sweep();
void init(const std::vector<std::string>&,const std::vector<std::string>&); 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), nasal_vm():pc(0),localr(nullptr),memr(nullptr),funcr(nil),
upvalr(nil),canary(nullptr),top(stack), upvalr(nil),canary(nullptr),top(stack),
num_table(nullptr),str_table(nullptr), 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( void run(
const nasal_codegen&, const nasal_codegen&,
const nasal_import&, const nasal_import&,
@ -785,11 +786,12 @@ inline void nasal_vm::opr_callfh()
} }
inline void nasal_vm::opr_callb() 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; (++top)[0]=nil;
// this ++top should not be used like: (++top)[0] here // this ++top should not be used like: (++top)[0] here
// because if running a builtin function about coroutine // 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); top[0]=(*builtin[imm[pc]].func)(localr,gc);
if(top[0].type==vm_none) if(top[0].type==vm_none)
die("native function error."); die("native function error.");